Hi Martin,

While I don't know Jscript at all, I suspect the problem is your use of p1
and p2 when calling the RegisterHotKey method.  I don't know what the
significance of the brackets is, but in this case you don't want any
parameters passed in the third and forth places at all (just add commas
enough so you will end up with 5 parameters if that's allowed in Jscript).
Passing parameters of any type in the third and forth places will cause
filtering to occur, and cause a second parameter to be necessary for your
routine which is to be called (which for some reason GW makes be the first
parameter in your called routine).

So, I think your statement should look like:

var MyHotkey = Keyboard.RegisterHotKey("Control-Shift-Windows-h",
 "SpeakHelloWorld",,, true)

Hth,

Chip

-----Original Message-----
> From: martin webster [mailto:[email protected]]
> Sent: Saturday, December 22, 2012 8:16 AM
> To: [email protected]
> Subject: help with JScript example
> 
> Hi all,
> I cannot get the following example to work using JScript. Can somebody
> help please.
> // Detect if a key has been pressed twice in succession
> var p1, p2;
> var MyHotkey = Keyboard.RegisterHotKey("Control-Shift-Windows-h",
> "SpeakHelloWorld", [p1, p2], true)
>  function SpeakHelloWorld(firstPress)
> {
> Speak(firstPress);
>        if (!firstPress) {
>                   Speak("Key pressed twice in succession");
> }
> }
> Warm regards.
> Martin Webster.
> I.T. Director for Kirklees Visual Impairment Network.

Reply via email to