Yes, that should work.  I did notice after posting the code that it
includes a reference to an oHomer object variable.  That works when
calling Homer Shared Object functions from another script.  If you are
copying an pasting some of the functions, however, drop the oHomer.
prefix before a function name.

Jamal

On Tue, 7 Jul 2009, Jeff Bishop wrote:

> Date: Tue, 7 Jul 2009 09:11:41 -0700
> From: Jeff Bishop <j...@jeffbishop.com>
> Reply-To: gw-scripting@gwmicro.com
> To: gw-scripting@gwmicro.com
> Subject: Re: Some custom keyboard functions
>
> Jamal,
>
> Does this code work if I pass in a key like:
>
> Control-Windows-Alt-F12
>
>
> ----- Original Message -----
> From: "Jamal Mazrui" <empo...@smart.net>
> To: <gw-scripting@gwmicro.com>
> Sent: Tuesday, July 07, 2009 9:06 AM
> Subject: Some custom keyboard functions
>
>
> > Given that inserting a key combination by name has been a recent topic, I
> > thought I'd share some functions of HomerSharedObject.vbs in this area.
> >
> > Hope this helps,
> > Jamal
> >
> > Public Function KeyboardBypass(sName)
> > ' Insert a key directly to the focused window, bypassing Window-Eyes
> > ExecuteHotkey hkBypass
> > KeyboardInsert sName
> > End Function
> >
> > Public Function KeyboardGetModifiers(sName)
> > ' Get modifier flags of a key
> >
> > Dim iReturn
> > Dim oKey
> >
> > Set oKey = Keyboard.Key(sName)
> > iReturn = 0
> > If oKey.FilterApplication = kfsDown Then iReturn = iReturn Or
> > kmApplication
> > If oKey.FilterAlt = kfsDown Then iReturn = iReturn Or kmAlt
> > If oKey.FilterControl = kfsDown Then iReturn = iReturn Or kmControl
> > If oKey.FilterInsert = kfsDown Then iReturn = iReturn Or kmInsert
> > If oKey.FilterNumlock = kfsDown Then iReturn = iReturn Or kmNumlock
> > If oKey.FilterNumpad = kfsDown Then iReturn = iReturn Or kmNumpad
> > If oKey.FilterShift = kfsDown Then iReturn = iReturn Or kmShift
> > If oKey.FilterWindows = kfsDown Then iReturn = iReturn Or kmWindows
> > KeyboardGetModifiers = iReturn
> > End Function
> >
> > Public Function KeyboardInsert(sName, bSuppressInterrupt)
> > ' Insert a key by name, and specify whether to suppress interruptability
> > so that speech in progress continues
> >
> > Dim aKeys
> > Dim iOldInterrupt, iIndex, iModifiers
> > Dim oKey
> > Dim sKey
> >
> > Set oKey = Keyboard.Key(sName)
> > iModifiers = KeyboardGetModifiers(oKey)
> > If Right(sName, 1) = "-" Then
> > sKey = "-"
> > Else
> > aKeys = Split(sName, "-")
> > sKey = aKeys(UBound(aKeys))
> > End If
> > Set oKey = Keyboard.Key(s)
> > iIndex = oKey.Index
> >
> > If bSuppressInterrupt Then iOldInterrupt =
> > oHomer.KeyboardSetInterrupt(kimOff)
> > Keyboard.InsertKey iIndex, iModifiers
> > If bSuppressInterrupt Then oHomer.KeyboardSetInterrupt(iOldInterrupt)
> > End Function
> >
> > Public Function KeyboardSetInterrupt(iNewState)
> > ' Set state of interruptability, and return previous setting so it may be
> > restored
> >
> > KeyboardSetInterrupt = ActiveSettings.Keyboard.Interruptability
> > ActiveSettings.Keyboard.Interruptability = iNewState
> > End Function
> >
> >
> >
>

Reply via email to