hm_registerkeyproc
Registers a script or command to a keyboard shortcut.
Syntax
hm_registerkeyproc key file command
Type
HyperMesh Tcl Query Command
Description
Registers a script or command to a keyboard shortcut.
Inputs
- key
- The key to register. This utilizes standard Tcl keysyms. There are three shortcut combinations that can be used, Control-<key>, Shift-<key> and Control-Shift-<key>. Note that when Shift is used in a combination, the key must be upper case.
- file
- The full path and file name of a Tcl script to register. If specified, the script is sourced when executing the shortcut. If not needed, must be set as {}.
- command
- The name of a command or procedure to execute. If specified, the command or procedure is run when executing the shortcut. If file is defined, the script is sourced before running the command. If not needed, must be set as {}.
Examples
To register hm_callhelp to the F1 key:
hm_registerkeyproc F1 {} "hm_callhelp"
To register the color panel to the Shift-F1 key:
hm_registerkeyproc Shift-F1 {} "hm_pushpanel {color}"
To register the script C:\temp\my_script.tcl to the r key:
hm_registerkeyproc r {C:/temp/my_script.tcl} {}
To register the script C:\temp\my_script.tcl and the procedure
::my_proc::main
to the R key:
hm_registerkeyproc Shift-R {C:/temp/my_script.tcl} {::my_proc::main}
Errors
Incorrect usage results in a Tcl error. To detect
errors, you can use the catch
command:
if { [ catch {command_name...} ] } {
# Handle error
}
Version History
13.0.110