Skip to main content
11-Garnet
April 14, 2025
Solved

Automating Creo Shutdown

  • April 14, 2025
  • 2 replies
  • 1526 views

Hi everyone,

 

I'm working on automating a process using a batch file that will be triggered as a scheduled task. The steps I'm trying to automate are as follows:

 

1- Launch Creo Parametric (version 10.0.7.0)

2- Start a tool that interacts with Creo to run it automatically in the background.

3- Shut down the configurator.

4- Shut down Creo itself.

 

Parts 2 and 3 are not a problem: this tool was developed by our consultants using the Creo toolkit. It's simply a matter of invoking one batch file to start it and another to stop it. The issue is with the shutdown of Creo. I don't want to use a brute-force taskkill command to close Creo, as I'd prefer a more graceful and proper way to do it. I considered simulating keyboard shortcuts (such as Alt+F+X) to close the program, using either VBScript or AutoHotkey, but here's the catch: since this task will be running as a scheduled task, with no user logged in, none of these solutions will work because they require the UI to be accessible (i.e., user must be logged in).

 

Does anyone have suggestions or ideas for an approach that would work in this scenario, where the task is running without an active user session? Unfortunately, we do not have a license for the Creo toolkit, so solutions that rely on it are not an option for us.

 

Any help or guidance would be very much appreciated.

Thanks in advance!

Giacomo

Best answer by GiacomoS

Hello,

 

Thank you for your reply.

In the end, we asked our consultant to develop a closure for Creo using the Toolkit.

 

Regards,

Giacomo

 

2 replies

16-Pearl
April 14, 2025

Start Creo Parametric in non-graphics mode & run a trail file. The trail file can start your toolkit program using @system to launch your .bat script, shut down the configurator (again using @system), and then exit Creo Parametric.

 

Regards,

 

Dan N.

GiacomoS11-GarnetAuthor
11-Garnet
April 15, 2025

Hello Dan,

 

Thank you for your response!

I tried following your suggestion: I took a trail file generated by simply opening and closing Creo, and added the line

 

~ @system("C:\path\file.bat")

 

right before the shutdown command.

Then, I launched Creo in non-graphics mode using the following command:

 

start C:\path\parametric.exe -g:no_graphics "path_trail_file"

 

Creo launches and shuts down correctly, following the trail file as expected. However, the batch file seems to be completely ignored during execution - there’s no indication that it runs at all. I'm not sure if I'm missing something in the syntax or configuration, or if additional steps are required for the @system call to be processed properly.

 

Best wishes,

Giacomo

16-Pearl
April 15, 2025
Giacomo,
 
I suspect that your .bat file runs to completion which gives control back to Creo Parametric and the next command is to exit instead of running the toolkit processes and then exiting.
 
Some other thoughts:
Can you run your toolkit programs via a mapkey or menu picks (vs via a separate .bat file)?
If the first toolkit program is initiated, does Creo Parametric run that program to completion before running any other commands (running synchronously vs asynchronously)?
If the toolkits run synchronously, create a trail file that runs both of your toolkit programs via menu/mapkey and then exits.  Run your start C:\path\parametric.exe -g:no_graphics "path_trail_file" command again, and it should run.  You can remove the -g:no_graphics part to test it in graphics mode first.
 
If the programs won't run synchronously, you can setup a listener of sorts to detect when the first toolkit program is complete, run the second toolkit program, detect when it is done, and then kill the Creo Parametric process (which I understand you're trying to avoid).
 
Have you looked at running Creo Parametric in batch mode for this?  It may be able to perform the exit a bit more gracefully.
 
Regards,
 
Dan N.
 
18-Opal
April 18, 2025

I guess it is an async application which connects to Creo on Starting the app. ask the developer to add an option to end Creo if the job is done, this could be done by an environment var. So about 5 lines of code.

 

Stop Creo in synchronous mode

 

extern ProError ProEngineerEnd( void );
/*


Purpose: Terminates a Creo Parametric session. In synchronous mode,
the function also terminates any Creo Parametric TOOLKIT process
started by the current Creo Parametric session.

 

...

 

*/

GiacomoS11-GarnetAuthorAnswer
11-Garnet
April 28, 2025

Hello,

 

Thank you for your reply.

In the end, we asked our consultant to develop a closure for Creo using the Toolkit.

 

Regards,

Giacomo