Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hello everyone,
We use Creo10.0. and Java Object Toolkit to run a macroA:
~ Command `ProCmdUtilTrailTrain`
< 2 0.118519 178 0 0 100 1920 0 0 1080 13
~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` `file_open`
~ Select `file_open` `Ph_list.Filelist` 1 `macroB.txt`
~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd`It should call another macro - macroB.txt
When we run macroA manually in Creo using "Play Trail File" it works fine.
When we run it using Java Object Toolkit - RunMacro method, it opens the dialog but the last step - clicking the "Open" button - is not performed. If we watch it in the UI and click the Open button manually, it correctly calls macroB.
Thank you for any hint.
If I understand correctly macroA is a mapkey and macroB is a trail file.
it looks like the Java Object Toolkit method does not get the hand back.
The following article suggests to activate the window before firing the trail file : https://www.ptc.com/en/support/article/CS129591
Both are trail files.
We want to run them from Java on a backend server.
I tried the advice from the linked article but it didn't help. Also it is for older Creo version.
No idea if this helps, but you can start Creo with a trail file, maybe you can reverse the task, and later pick the application button within the trail.
And in async mode you can fire mapkeys, but for a long sequence you may have other issues.
You need to give the control back to Creo, else it is recursive/nested. Check to do the trail task with Toolkit 🙂
Or first run the app calls, save, and after then run a separate trail file session, it is all a hack!.
You can do all the stuff via mapkeys as well, this mapkey can be loaded on start via the config file and can be call via '%', but I guess you know that. But a mapkey could be able to close a toolkit button call. On top you can load a config file with toolkit, to setup mapkeys and call them later.
I would not run a nested trail file, I would prepare them to run one after the other. Trail files have no status, they work or crash, mapkeys NOT and they can be nested. You can write lines (with Toolkit) to the trail file to watch your asyn process as well.
You can also setup a parameter marker in your model, this may help if the same button is pressed more than one time to continue with the next step.
Have fun 😉, all my 2 Cents!
Thank you for the extensive answer. I'm busy on another issue and get back to this one hopefully soon.
Thanks!
Hello @JD_10306057,
It looks like you have some responses from some community members. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution.
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.
Thanks,
Vivek N.
Community Moderation Team.
Other options:
BTW: What is the result if you do this in a different stack order, so the trail file will fire a mapkey?
