question

Roger W avatar image
0 Likes"
Roger W asked Ben Wilson edited

Running Webkit to call a FlexScript function (fireFlexSimEvent())

I am trying to get a Javascript to run a flexscript through this fireflexsimevent() command I have been seeing around the forums. I have the flexscript to open and close the port of a processor. However, I am clueless with how to work with JS to execute this flexscript command. the examples I downloaded from forums (https://answers.flexsim.com/questions/21092/web-communication-within-flexsim.html) are probably different version to mines as I cannot see what they are doing. (I use version 16.1.2).


Could anyone point my in the right direction on how this is done?

Choose One
FlexSim 16.1.2
webkitfireflexsimeventjavascriptcallwebscriptmethod
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Ben Wilson avatar image
2 Likes"
Ben Wilson answered Ben Wilson edited

Hi @Roger W,

Please carefully review this comment and attached sample model:

https://answers.flexsim.com/comments/37482/view.html

There you'll find a 16.0.0 sample model that demonstrates both:

  1. callwebscriptmethod() - calls a Javascript function living in your Webkit GUI from within FlexSim. You can find this example in the Processor's OnEntry trigger.
  2. fireFlexsimEvent() - calls FlexScript inside the model from within the Webkit window's HTML/Javascript. Find this example in the htmlWidget's html code.

Also, please take note of @Jörg Vogel's comment above regarding closing of ports. My answer is an answer to your top question (how to use fireFlexsimEvent()), but you want to be sure that the functionality you're calling within FlexSim is still best practices for FlexSim modeling.

Comment back with any Webkit related questions.

Or start a new question for other topics, like ports, etc.

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.