system command in Flexscript to run script on cmd line

system command in Flexscript to run script on cmd line

asb_praneeth
Not applicable
602 Views
2 Replies
Message 1 of 3

system command in Flexscript to run script on cmd line

asb_praneeth
Not applicable

[ FlexSim 19.1.0 ]

Hello,

I want to run a script on the command line and get the output of the script back to flexsim. I want to run python script and get the suggestion of ML algorithm in to the simulation.

Example C++ code.

std::string filename = "/home/abc/xyz/Learning.py";
std::string command = "python ";
command += filename;
system(command.c_str());

I want to get the output of the script and use that in simulation.

Can anyone suggest the command like system which will be used to run the script on cmd line.

0 Likes
Accepted solutions (1)
603 Views
2 Replies
Replies (2)
Message 2 of 3

JordanLJohnson
Autodesk
Autodesk
Accepted solution

The runprogram() command takes command line arguments, and passes them to the WinExec function. To get the output of the script, you will need some way to detect when your script is finished, since this command does not block.

.


Jordan Johnson
Principal Software Engineer
>

Message 3 of 3

philboboADSK
Autodesk
Autodesk

If you want to wait for a return value, then you could use a C++ DLL instead of FlexScript.

See How to let runprogram() wait for batch file (.bat) to finish



Phil BoBo
Sr. Manager, Software Development