How to check device name

patryk_u2
Not applicable
1 View
4 Replies
Message 1 of 5

How to check device name

patryk_u2
Not applicable

[ FlexSim 22.2.2 ]

Is it possible to display or check the device name in FlexSim?

1670961475416.png

0 Likes
Accepted solutions (1)
2 Views
4 Replies
Replies (4)
Message 2 of 5

joerg_vogel
Not applicable
Because it is a data of system your approach could be to evaluate it by command of net in command console. Or you look into view tree, if it is data of license information in view tree.
0 Likes
Message 3 of 5

joerg_vogel
Not applicable
0 Likes
Message 4 of 5

andrew_o2
Not applicable

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.

0 Likes
Message 5 of 5

ben_wilson5K2EV
Autodesk
Autodesk
Accepted solution

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!

0 Likes