question

Joe S2 avatar image
0 Likes"
Joe S2 asked Jason Lightfoot edited

Can I execute an onPress trigger with Flexscript

Good Afternoon,

I'm trying to programmatically create models in Flexsim using a userlibrary I have previously created.
However I'm finding out that in some of the Custom GUIs reach out to a wide variety of various locations within the model so much so to the point where I think it would be easier to simply call the onPress command within Flexsim.

I've looked into the executefsnode function but it doesn't seem like it functions in the same way as simply hitting the apply button.

Does anyone know if this is possible and if so how I could implement such a feature?

Thank you,

FlexSim 20.2.3
flexscriptflexscript coding
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

Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Jason Lightfoot edited

I would rather copy the required code from the OnPress node into a usercommand and then call that command in the OnPress and from your new 'automation' method.

You say executefsnode doesn't work for you as it's not the same as hitting "Apply" but you were talking about firing the code in OnPress so that's a little confusing.

executefsnode will fire it correctly if you pass the node in twice. Eg.:

treenode onPressNode=views().find("active/GUI 13327938144/button3").find(">OnPress");
executefsnode(onPressNode,onPressNode);
5 |100000

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