question

Stan Davis avatar image
0 Likes"
Stan Davis asked Stan Davis commented

How to Call Model Scripts Outside Script Console

In addition to User Commands, I create a number of model scripts via the Script Console. I would like to call some of them directly via Button OnPress events. How do I do that without having to create a User Command first? Thanks.

FlexSim 22.2.2
script
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

Phil BoBo avatar image
0 Likes"
Phil BoBo answered Stan Davis commented

You can add a node in the tree with FlexScript data and call nodefunction() on it, or you can copy it into a text node and call executefsnode() on it, or you can put it in a string somewhere and call executestring() on it, or you can create a user command, as you are aware. You can also copy/paste the code into your Button's OnPress code.

A user command is the best option for storing reusable code in the model to be called from multiple places. Why would you not want to "create a User Command first"? Your qualification makes no sense; a user command does exactly what you want to do. I don't understand.

· 1
5 |100000

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

Stan Davis avatar image Stan Davis commented ·
Phil, Thanks for providing the options. I'll stay with the User Command route. - Stan
0 Likes 0 ·