question

Kim Jh avatar image
1 Like"
Kim Jh asked Adrian Haws edited

How to save user command's code in text file with FlexScript?

Choose One
flexscriptuser commandstext file
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

·
Matthew Gillespie avatar image
3 Likes"
Matthew Gillespie answered

The following code will open a new file in your FlexSim projects folder and then loop through all the user commands printing their code to the text file.

treenode commands = node("MODEL:/Tools/UserCommands");

fileopen(concat(documentsdir(), "\\commands.txt"), "w");

for(int i = 1; i <= content(commands); i++) {
	fpt(gets(first(rank(commands, i)))); fpr();
}

fileclose();
5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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