Found a lot of information here and there that helped, but no actual script examples of what I was trying to do, which is to reproduce some two-key combinations like the old WordStar/WordMaster keystrokes. Here is what I came up with, for the particular keystrokes ^ks (save), ^kd (done: save and close), and ^kx (exit). The particular output was for InDesign CS3 but the output is fairly standard Windows conventions, so should work for most programs.
Note that if you hit ^k and then pause, there is a reminder that pops up with the list of keys you can hit.
Code:
;--------------------------------------------------------------------------
; FUNCTION GETCMD()
;--------------------------------------------------------------------------
GetCmd(Desc,Title)
{
Input, Selection, L1 M T2
If Errorlevel = Timeout
{
Progress, c01 fm12 wm600 fs10 ws300 zh0, %Desc%, , %Title%, , Arial
Input, Selection, L1 M
Progress, Off
}
Return Selection
}
;--------------------------------------------------------------------------
; ^k hotkeys
;--------------------------------------------------------------------------
^k::
{
s = !f {s}
d = !f {c}
x = !f {x}
ShortCutKeys = s,d,x
Description = s = save d = done - save and close x = exit
WinTitle = ^k Shortcuts
UserInput := GetCmd(Description, WinTitle)
If UserInput in %ShortCutKeys%
{
Command := %UserInput%
sendinput %Command%
}
Return
}
[ Moderator!: [code] tagged ]