Still not quite there, as this functionality doesn't quite do what I was
after.  I have the following problems:

1 - If the second press of the registered key doesn't occur within a
specified time period, the behaviour of the key should reset, so the next
press will be processed as if it's the first;

2 - The behaviour for subsequent presses within the time-out should toggle,
so the first press runs, say, func1, the second func2, the third func1, the
fourth func2, etc...  I've tried the following:

If firstPress Then
func1
Else
Func2
firstPress = True
End If
 
However, it doesn't look like it's allowable to change the value of
firstPress in this way.  The code runs, but repeated presses of the key are
all processed through func2.

Best wishes.

Tim Burgess
Raised Bar Ltd
Phone:  +44 (0)1827 719822

Don't forget to vote for improved access to music and music technology at

http://www.raisedbar.net/petition.htm
 
-----Original Message-----
From: Tim Burgess [mailto:[EMAIL PROTECTED] 
Sent: 12 October 2008 10:22
To: gw-scripting@gwmicro.com
Subject: RE: Keyboard handling

OK, I thought I could drop the optional parameter place holder - all becomes
clear and thanks again. 

Best wishes.

Tim Burgess
Raised Bar Ltd
Phone:  +44 (0)1827 719822

Don't forget to vote for improved access to music and music technology at

http://www.raisedbar.net/petition.htm
 
-----Original Message-----
From: Aaron Smith [mailto:[EMAIL PROTECTED]
Sent: 11 October 2008 18:45
To: gw-scripting@gwmicro.com
Subject: Re: Keyboard handling

Tim Burgess wrote:
> This method for handling double-presses doesn't seem to work for me.  
> Here's my key definition:
> 
> Set NowKey = Keyboard.RegisterHotkey( "Control-Shift-F6", "SayNow", 
> SONAR_PRODUCER, True)

You're missing a piece, so you're actually passing true as your optional
parameter rather than the first press parameter.

The docs say:

object.RegisterHotkey(Key, FunctionName, FilterBy, Parameter, FirstPress)

So you would need:

Set NowKey = Keyboard.RegisterHotkey( "Control-Shift-F6", "SayNow",
SONAR_PRODUCER, "", True)

Instead of the empty string, you can just leave that parameter empty, like
this:

Set NowKey = Keyboard.RegisterHotkey( "Control-Shift-F6", "SayNow",
SONAR_PRODUCER, , True)

Then, in your routine declaration, you'll add the optional parameter, even
though you're not using it, like this:

Sub SayNow(optionalParm, firstPress)
        If firstPress Then
                Speak "first press"
        Else
                Speak "not first press"
        End If
End Sub

Make sense?

Aaron

--
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
GW Micro
Phone: 260/489-3671
Fax: 260/489-2608
WWW: http://www.gwmicro.com
FTP: ftp://ftp.gwmicro.com
Technical Support & Web Development


Reply via email to