rundocument("open","C:\Users\PAHT_TO_EXAMPLE.csv") is returning 2, and nothing opens... What could be the reason?
Second question: Is the return value an errormsg ? And if so, how can I read it?
Thanks
rundocument("open","C:\Users\PAHT_TO_EXAMPLE.csv") is returning 2, and nothing opens... What could be the reason?
Second question: Is the return value an errormsg ? And if so, how can I read it?
Thanks
Is your model something you could upload so we can look at it? If it contains proprietary information, you can always upload it to a private question so only FlexSim U.S. can see it.
Hi @Tanner Poulton,
Thanks for your quick reply.
I've opened a new model and tried it, I get the same return value.
Thanks
Jarek
I'm not positive, but it could be that it's not a ".doc" file. Here's an excerpt from the User Manual that might help:
What are you hoping to import? Is it a table?
The rundocument() command returns the result of ShellExecute, a Windows API function. If the returned value is less than 32, then the return value indicates an error code. In this case, error code 2 indicates that the file is not found. See this link for more information on ShellExecute, and see this link for error code values and descriptions.
My guess is that this has to do with the \ character. In a string literal, be sure to use \\, to escape the \ character:
rundocument("open","C:\\Users\\PAHT_TO_EXAMPLE.csv")
thanks for that reply, it solved the error.
If I would like to do Error handling on this, e.g.
if rundoc < 32 ; printout msg;
How would I do that in Flexsim?
Thanks,
Jarek
You can print messages to the output console using print() or pt() and pr(). You can print messages to the system console using mpt() and mpr(). If you want a dialog box to appear, you can use the msg() command. You could also write a file, using fpt() and fpr().
@jordan.johnson I meant the following:
int errorcode = rundocument(...);
if (errorcode < 32)
{
mpt(ErrorcodeToString(errorcode));
}
So I want to know if it's possible in Flexsim to get something like FormatMessage to be able to do error handling around this. If ErrorcodeToString is a simple user-defined command I would also be keen to hear your ideas on how to do that.
Hope this was clear. Many Thanks.
19 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved