That's because you took my pseudo code too literally. Try this:

Dim myKey : Set myKey = Keyboard.RegisterHotkey("Control-shift-Z", "mySub", nothing, Array("see", "dog", "run"))

Aaron

On 3/30/2011 4:35 PM, Jared Wright wrote:
If I load:

Keyboard.RegisterHotkey("Control-shift-Z", "mySub", nothing, Array("see", "dog", "run"))

sub mySub(aParms)
speak aParms(0) & aParms(1) & aParms(2)
End Sub



I get:
hotkeypassing.vbs - Microsoft VBScript compilation error
Line 1 Column 89
Keyboard.RegisterHotkey("Control-shift-Z", "mySub", nothing, Array("see", "dog",
"run"))ยท
Cannot use parentheses when calling a Sub
< 0x800A0414 >

On 3/30/2011 3:49 PM, Aaron Smith wrote:
I will often do something like:

Keyboard.RegisterHotkey("Control-Blah", "MySub", SomeWindow, Array(x, y, z))

and then

Sub MySub(parmArray)
firstParm : parmArray(0)
secondParm : parmArray(1)
thirdParm : parmArray(2)
End Sub

Aaron

On 3/30/2011 3:28 PM, Jared Wright wrote:
Just wanted some clarification on passing parameters to hotkey
routines, and I'm sort of hoping someone on here will know already and
save me some trial and error work. Sorry, cheating a bit I guess. If I
want to pass more than one parameter to my hotkey routine, is the best
practice to wrap them all up in a collection of some sort? For
instance, I want to pass the XML Key ID so I can have its description
spoken by key describer, as shown in the WE Script Framework's setup
of hotkeys. But I also want to pass a second variable to the routine
for actual use in the execution of the hotkey. If it matters, I
presently want to pass either another string or a key object, I
haven't yet decided, but I'm sure this'll come up for me in future
plenty of times with a variety of datatypes. Ideally I could just
overload registerHotkey with six parameters instead of five, but
somehow I doubt it'll be that easy. Thanks in advance for the knowledge.


--
Aaron Smith
Web Development * App Development * Product Support Specialist
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com

To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.



--
Aaron Smith
Web Development * App Development * Product Support Specialist
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com

To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.

Reply via email to