Is it possible to display or check the device name in FlexSim?
Is it possible to display or check the device name in FlexSim?
Hi @Patryk, was Joerg Vogel's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.
If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.
I've played a bit with code like the following:
string cmd = programdatadir()+"gethostname.bat"; string hostfile = programdatadir()+"hostname.txt"; fileopen(cmd, "w"); fpt("hostname > \""+hostfile+"\""); fileclose(); runprogram(cmd); fileopen(hostfile, "r"); string hostname = filereadline(); fileclose(); return hostname;
It isn't ideal. It works best if FlexSim is running with elevated privileges. If not, sometimes it takes running it twice to actually read the hostname from the written file.
It also flashes a black command prompt window, and sometimes makes FlexSim lose window focus.
If anything, it is a starting point to discover maybe a better way of doing it.
Joerg's C++ suggestion might be the best way. You could encapsulate the functionality you need in a DLL, then call it from FlexSim and get the value directly, rather than the above workaround writing and reading to files and launching a command prompt.
Good luck!
Try to catch the name by c++
https://learn.microsoft.com/en-us/windows/desktop/api/Winbase/nf-winbase-getcomputernamea
15 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