Creo Mapkeys

A Mapkey in Creo is another name for a macro. They contain one or more commands to be executed in the Creo session. They are executed using a sequence of characters typed into the session.

They are normally created in the 'Mapkeys' editor, which also saves them to config files.

Format

mapkey {SEQUENCE} @MAPKEY_NAME{DESCRIPTION};@MAPKEY_LABEL{NAME};\
mapkey(continued) {CONTENT};

Where:

  • {SEQUENCE} is the character sequence.
  • {DESCRIPTION} is description shown in the Mapkey Editor.
  • {DESCRIPTION} is description shown in the Mapkey Editor.

Note the mapkey spans multiple lines, using \ to end a line and then mapkey(continued) on the next line.

Valid Characters

Here is a list of valid characters that can make up a makey sequence:

abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789?></.,":';|}{\][+_)(*&^%$#@!~=-`

Alternatively the function keys (F1-F12) can be used by using the dollar sign e.g. $F4

Examples

These can be placed in creo config files (config.pro/sup), and will be loaded on start up.

Calling Command Line

The @SYSTEM macro can be used to run programs from the command line.

When run is typed, it runs a batch file located in the current working directory:

mapkey run @MAPKEY_NAMEThis runs a bat file.;@MAPKEY_LABELRun Bat File;\
mapkey(continued) @SYSTEMbatfile.bat;

In order to run programs in other directorys it needs to be escaped:

mapkey run @MAPKEY_NAMEThis runs a bat file.;@MAPKEY_LABELRun Bat File;\
mapkey(continued) @SYSTEMC:\\temp\\batfile.bat;

If there is a space in the path or filename it wont work (or at least i can't get it to). I have tried using brackets "C:\Program Files\7-Zip\7z.exe" but that doesn't work. A workaround I found is to use windows short paths, create a batch file called shortname.bat:

@ECHO OFF
echo %~s1

Then call that with your long path:

C:\>shortname.bat "C:\Program Files\7-Zip\7z.exe"
C:\PROGRA~1\7-Zip\7z.exe

You can then use that in your mapkey (with escaped slashes):

mapkey(continued) @MAPKEY_LABELPurge;\
mapkey(continued) @SYSTEMC:\\PROGRA~1\\7-Zip\\7z.exe;

If you want to chain command line programs, use a & symbol between them (called left to right):

mapkey(continued) @MAPKEY_LABELPurge;\
mapkey(continued) @SYSTEMC:\\PROGRA~1\\7-Zip\\7z.exe & pause;

Calling Purge

If your system PATH contains the Creo bin path (which it should):

mapkey purge @MAPKEY_NAMEThis purges the working directory.;@MAPKEY_LABELPurge;\
mapkey(continued) @SYSTEMpurge;

If however your PATH is not set correctlym use the short name (shown above) to the bin path:

mapkey purge @MAPKEY_NAMEThis purges the working directory.;@MAPKEY_LABELPurge;\
mapkey(continued) @SYSTEMC:\\PROGRA~1\\PTC\\CREO2~1.0\\PARAME~1\\bin\\purge & pause;

(This is for Creo 2.0, your installation may be different).

Reset Dialog Location

Creo dialogs (open and save) annoying rememeber their last used location, this resets it back to the current working directory (useful for saving file mapkeys):

mapkey reset-loc @MAPKEY_NAMEReset dialog location;@MAPKEY_LABELReset Location;\
mapkey(continued) ~ Command `ProCmdSessionChangeDir` ;\
mapkey(continued) ~ Close `file_open` `file_open`;

Calling Other Mapkeys

You can call other Mapkeys using this syntax:

%reset-loc;

This will call the reset-loc mapkey. I also use them to create aliases of other mapkeys for example:

mapkey $f4 @MAPKEY_NAMEOutput;%zr;%laser;

Click Here for a list of all the mapkeys in this blog.