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

How to get a company script to run when users double-click models and keep thumbnails!

Highlighted
Aquamarine

How to get a company script to run when users double-click models and keep thumbnails!

Ok. This took me a while to work through and I though I would share it for others.

My goal was simple, avoid users from starting Creo without going through the company start-up script. This meant, that if they double-clicked a .asm or .prt... it would have to load the script and pass the file name through. Along with this, I wanted to keep the thumbnails that PTC Thumbnail viewer generates in Windows. The solution is to use the below code after running the silent install code:

The first portion of code changes the startup path for each extension class to the path of the startup script (RegOpenPath)

The class name (prtFile, asmFile, etc) was found by going to HKEY_CLASSES_ROOT in regedit and viewing the default data value

reg add "HKLM\SOFTWARE\Classes\prtFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

reg add "HKLM\SOFTWARE\Classes\asmFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

reg add "HKLM\SOFTWARE\Classes\drwFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

reg add "HKLM\SOFTWARE\Classes\proeFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

reg add "HKLM\SOFTWARE\Classes\dgmFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

reg add "HKLM\SOFTWARE\Classes\frmFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

reg add "HKLM\SOFTWARE\Classes\layFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

reg add "HKLM\SOFTWARE\Classes\mfgFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

reg add "HKLM\SOFTWARE\Classes\mrkFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

reg add "HKLM\SOFTWARE\Classes\phaFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

reg add "HKLM\SOFTWARE\Classes\psfFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

reg add "HKLM\SOFTWARE\Classes\secFile\Shell\Open\Command" /ve /d "\"%RegOpenPath%\" \"%%1\"" /f >nul

The below code gives a name (RegOpenName) to your script so it can be viewed in Control Panel\All Control Panel Items\Default Programs\Set Associations

reg add "HKCR\Local Settings\Software\Microsoft\Windows\Shell\MuiCache" /v "%RegOpenPath%"  /d "%RegOpenName%" /f >nul