Aaron,
Try this script:
Dim CursorKeyEvent : CursorKeyEvent = ConnectEvent(Application,
"OnCursorKey", "OnCursorKey")
Function OnCursorKey(CursorKey, isBeforeAction, defaultActionAborted)
If isBeforeAction Then
Dim strAction1 : strAction1 = CursorKey.FirstAction.Description
Speak TypeName(strAction1)
Speak strAction1
End If
OnCursorKey = False
End Function
It reports a variable type of string and the name of the first action,
usually. Try substituting ActionID for Description and the same error comes
back. It is supposed to return a value of Enum. Can you store this in a
string variable? I thought it was a string.
I have found that it is not always reporting the first action correctly.
With it set to Description, associated the script with Notepad. I found the
following incorrect responses:
Home said Undefined, actually Character After.
CTRL-Home said Selected text, actually Line.
CTRL-End said Undefined, actually Line.
F3 and Shift-F3 said Undefined, actually Line.
This was using the Description property. I was using the intermediate Home
and End keys. Hopefully, the ActionID, if we could get it to work, would be
more accurate. I checked my object types in the previous script and they
were right. objAction1 was a CursorKeyAction object. This script also
worked if you put in Description instead of ActionID but it showed the same
key assignment mistakes.
Let me know what you find out. Somethings seems not just right here to me.
Vic
-----Original Message-----
From: Aaron Smith [mailto:[email protected]]
Sent: Saturday, January 31, 2009 5:57 PM
To: [email protected]
Subject: Re: OnCursorKey Event
Vic,
You should print out the type name of objAction1 to verify that you got
a CursorKeyAction object.
Aaron
Vic Beckley wrote:
> Can anyone tell me why this script will not work?
>
>
>
> Dim CursorKeyEvent : CursorKeyEvent = ConnectEvent(Application,
> "OnCursorKey", "OnCursorKey")
>
>
>
> Function OnCursorKey(CursorKeyId, isBeforeAction, defaultActionAborted)
>
> If isBeforeAction Then
>
> Dim objAction1 : Set objAction1 = CursorKeyId.FirstAction
>
> Dim objAction2 : Set objAction2 = CursorKeyId.SecondAction
>
> Dim strAction1 : strAction1 = objAction1.ActionID
>
> Dim strAction2 : strAction2 = objAction2.ActionID
>
> Speak strAction1
>
> Speak strAction2
>
> End If
>
> OnCursorKey = False
>
> End Function
>
>
>
> I get this error when I use a cursor key with the script running.
>
>
>
> CursorKeyTest.vbs - Microsoft VBScript runtime error
>
> Line 7 Column 18
>
> Object doesn't support this property or method: 'objAction1.ActionID'
>
>
>
> < 0x800A01B6 >
>
>
>
> Vic
>
>
>
--
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
__________ NOD32 3815 (20090131) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com