Martin,
You should create (and check the value of) a variable that holds the
result of
ActiveWindow.Children.FilterByClassAndModule("Edit", "NOTEPAD")
because it may come back with Nothing. If you end up passing Nothing as the
FilterBy parameter, you're effectively registering a global hotkey that will
execute anywhere.
Aaron
On 2/14/2012 11:36 AM, martin webster wrote:
Hi All,
I am trying to use the FilterBy parameter of the registerHotkey property and it doesn't seemed to
work for me. The following snippet should be able to detect that the notepad window is active and
say "this is notepad" only and only when the notepad window is active, but at present
this snippet says "this is notepad" when any application is active. I only want the
hotkey to fire when notepad is active, so how do I set this parameter.
Begin VBScript:
' keyboard example using the FilterBy parameter
Dim myHotkey
Set myHotkey = Keyboard.RegisterHotkey("h", "HandleKey",
ActiveWindow.Children.FilterByClassAndModule("Edit", "NOTEPAD"))
Sub HandleKey()
Speak "this is notepad"
End Sub
Warm regards.
Martin Webster.
--
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.