Script Example | Creo Mapkey Os
Tip: You can use the start command to run the script in a separate window if you don't want Creo to wait for it to finish. 2. Running a VBScript (.vbs)
mapkey $F1 ~ Close `main_dlg_cur` `main_dlg_cur`;
' Send keystrokes to Creo to create a new drawing WshShell.SendKeys("%du") ' Trigger rename WshShell.SendKeys("^c") ' Copy to clipboard WshShell.SendKeys("^a") ' Select all WshShell.SendKeys("^n") ' New file WshShell.SendKeys("^v") ' Paste name
You must wrap the path in quotation marks. In config.pro , you often need to escape quotes or handle them carefully depending on the Creo version. The safest method is using the DOS 8.3 filename (short name) or environment variables, but quoted strings usually work: creo mapkey os script example
@echo off REM This script expects one argument: the full path of the exported STEP file set STEP_FILE=%1
mapkey $F8 @SYSTEM C:\Program Files\MyApp\run.exe;
One of the most common uses of OS scripts is to copy configuration files to ensure consistent settings across sessions: Tip: You can use the start command to
This advanced mapkey saves your current work and uses an external command-line tool (like 7-Zip) to compress the files into a timestamped backup folder.
Launch a script to backup a current session or export BOMs to specific network drives.
And here's what the corresponding VBScript ( create_drawing.vbs ) might look like: In config
Creo mapkeys easily break when reading paths with spaces. Avoid spaces in file paths (e.g., use C:\Creo_Scripts\ instead of C:\My Creo Scripts\ ).
Inside your Mapkey, use ~ Command ProCmdUtilSystem system("echo %CURRENT_MODEL% > C:\temp\var.txt") ;