A complete guide to Creo Mapkeys using OS Scripts (System Commands). This guide covers the "Why," the syntax, practical examples, security considerations, and troubleshooting.
Let’s build a real-world example. You have an assembly, MAIN_ASSEMBLY.ASM. You want a single keystroke that:
Creo Mapkeys cannot natively pass Creo parameters (like &model_name) directly inline. However, you can use a two-step workaround:
Method: Write to a temporary file
Inside your Mapkey, use ~ Command ProCmdUtilSystem system("echo %CURRENT_MODEL% > C:\temp\var.txt");
Then your OS script reads that file.
Better: Use Creo’s trail file or relations to print parameters. creo mapkey os script example
Example: Create a relation that writes a parameter to a text file:
RELATION: OUTPUT_TEXT = "MODEL=" + rel_model_name()
WRITE(OUTPUT_TEXT, "C:/temp/model_name.txt")
Then your OS script parses model_name.txt.
The syntax for calling an OS script from a Mapkey is surprisingly simple. You use the OS_Script command within the Mapkey definition. A complete guide to Creo Mapkeys using OS
Basic Syntax:
OS_Script <FullPathToScript> <Arguments>
Critical Warning: Creo does not wait for the OS script to finish. It launches the script asynchronously and immediately continues the Mapkey. To force a wait, you must use the !OS_Script (with an exclamation mark), which pauses Creo until the script returns an exit code.