cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Translate the entire conversation x

Automating Creo Shutdown

GiacomoS
7-Bedrock

Automating Creo Shutdown

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

ACCEPTED SOLUTION

Accepted Solutions
GiacomoS
7-Bedrock
(To:RPN)

Hello,

 

Thank you for your reply.

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

 

Regards,

Giacomo

 

View solution in original post

7 REPLIES 7

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.

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

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.
 

Hi Dan,

 

After discussing it, we realized that using a trail file wasn't the right approach, as we needed Creo to remain open. In the end, we asked our consultant to create a closure command using Creo Toolkit.

 

Thank you anyway for the time you took to reply to me.

 

Sincerely,

Giacomo

Hi @GiacomoS,

I wanted to see if you got the help you needed.

If so, please mark the appropriate reply as the Accepted Solution or please feel free to detail in a reply what has helped you and mark it as the Accepted Solution. It will help other members who may have the same question.

Of course, if you have more to share on your issue, please pursue the conversation.

Thanks,


Catalina
PTC Community Moderator
PTC
RPN
17-Peridot
17-Peridot
(To:GiacomoS)

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.

 

...

 

*/

GiacomoS
7-Bedrock
(To:RPN)

Hello,

 

Thank you for your reply.

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

 

Regards,

Giacomo

 

Announcements

Top Tags