KeyScript
Author Jon Visick
Message No.

http://groups.yahoo.com/group/power-pro/message/10721

File Name
Requirements KeyTrap plugin, Powerpro v3.7+
Description: A single script to handle functions assigned to keys using the KeyTrap plugin. Specifically intended to handle the "extra" keys on extended keyboards, but useful for any key combination used to run a program, show a bar, etc.
Notes:

How to use this script:

  1. Install the KeyTrap plugin
  2. Identify codes for keys that will be used to start programs, etc.
  3. Set up KeyTrap.ini file. In the Command field for each key, use runfile.KeyScript@[label], where [label] corresponds to one of the subroutines in the KeyScript.txt file

       Example:
       0,0,0,35,255,1,,runfile.KeyScript@Calc,0,1,0,,,,, Special Key 1
       0,0,0,31,255,1,,runfile.KeyScript@WP,0,1,0,,,,,   Special Key 2
       0,0,0,91,91,1,,runfile.KeyScript@Menu,0,1,0,,,,,  Win key

  4. Edit KeyScript.txt so that each subroutine carries out desired function for the corresponding key. See examples below.

@Calc
; Special Key #1 opens the calculator
if(anywindow "Calc98*") do
    window show "Calc98*"
    ; If the calculator is already running, bring it to the top
    ; rather than starting a new instance
else
    "C:\Program Files\Accessories\Calc98\calc.exe"
endif
quit

@WP
; Special Key #2 opens WordPerfect
if(anywindow "*WordPerfect*") do
    window show "*WordPerfect*"
else
    "C:\Program Files\WP\Programs\wpwin8.exe"
endif
quit

@Menu
; Win key opens main program launch bar and moves mouse there
; so it won't autohide
Bar Show start bar
Mouse ab 15 757
quit