Hi Ralph and Martin,

As far as I know, Martin's example is the best way to do this when you have
a specific keystroke you'd like executed (especially if that keystroke
activates some app's functionality).

I just wanted to mention there is an alternative, when what you want done is
to execute some built-in WE functionality; this alternative is especially
useful when people may have changed the hotkey associated with the
functionality.  In my example below, I show how you could execute some WE
functionality (such as read line) not by inserting the  keystroke usually
used to read a line (control numericpad center), but by telling WE to
execute the functionality by its name instead of by the keystroke:
 
Set we = CreateObject("WindowEyes.Application")
WE.application.executeHotkey hkLine ' this does the same as inserting a
control-numericpad center

hth,

Chip


> -----Original Message-----
> From: martin webster [mailto:[email protected]] 
> Sent: Monday, May 21, 2012 3:50 PM
> To: [email protected]
> Subject: RE: calling WE functions or hotkeys from an external program
> 
> Hi Ralf,
> Try this, I'm not sure if this is what you want, but this 
> snippet will execute the hotkey insert "t", the time and date 
> window-eyes hotkey running as an external app written in 
> VBScript. Just press enter on what ever you decide to call 
> the snippet and it should run. you need window-eyes 7.5 to 
> run this though.
> begin snippet:
> Set we = CreateObject("WindowEyes.Application")
> set MyHotkey = we.Keyboard.Key("Insert-t") wscript.Sleep 2000
> MyHotkey.Insert()
> wscript.Sleep 1000
> we.Speech.Speak "all done exiting script"
> 
> Hope this helps.
> Warm regards.
> Martin Webster.
> I.T. team leader for Kirklees visual impairment network.
> 
> 
> --- On Mon, 5/21/12, Ralf Kefferpuetz 
> <[email protected]> wrote:
> 
> > From: Ralf Kefferpuetz <[email protected]>
> > Subject: RE: calling WE functions or hotkeys from an 
> external program
> > To: [email protected]
> > Date: Monday, May 21, 2012, 4:04 PM
> > Hello Bruce,
> > 
> > many thanks for that. Let me make myself a bit more clear.
> > What I want to
> > achieve is the following:
> > 1) I have WE apps running with hotkeys assigned to their functions, 
> > which is a normal app hotkey behavior. The user can execute these 
> > functions by pressing the defined hot key.
> > 2) now I want to execute this functions from an external program 
> > either by firing the hotkey or by calling the global 
> function in the 
> > app In your example you are using the version method, which comes 
> > directly from the WE object, but how to execute an app 
> defined hotkey 
> > or global function?
> > Here is a small example, see this tiny app:
> > Set myHotkey = Keyboard.RegisterHotkey("Control-f12",
> > "InsertDate")
> > function InsertDate()
> >     Keyboard.InsertString Time & " on " &
> > FormatDateTime(Date,1)
> > End function
> > Now, is it possible to fire the Control-F12 hotkey or the function
> > InsertDate() from within a program?
> > I'm not sure if I could make it a bit more clear.
> > 
> > Regards,
> >   Ralf
> > 
> > Ralf Heinrich Kefferpuetz
> > Web: http://www.keffi.eu
> > Facebook: http://www.facebook.com/Keffi.eu Germany
> > 
> > -----Original Message-----
> > From: BT [mailto:[email protected]]
> > Sent: Monday, May 21, 2012 4:12 PM
> > To: [email protected]
> > Subject: Re: calling WE functions or hotkeys from an 
> external program
> > 
> > 
> > Hi Ralf,
> > 
> >     Just use the create object from your calling
> > app in the format such as 
> > below. This is the python comtypes call and what ever you
> > use as your com 
> > types method is the format you must use.
> >     Note the individual method is after the first
> > period.
> > 
> > WeTts = CreateObject( "windoweyes.application")
> > weVersion = WeTts.Version
> > WeTts.Speech.Speak (" The version of we is: %s" %
> > weVersion)
> > 
> > Sent: Monday, May 21, 2012 4:10 AM
> > Subject: calling WE functions or hotkeys from an external
> > program
> > 
> > 
> > Hi all,
> > 
> > I'm looking for a way to call hotkeys, or functions, from WE
> > apps in an
> > external program.
> > An example for reading the active window would be:
> > WindowEyes.Application.ExecuteHotkey(130)
> > So, can an app register an unique hotkey ID?
> > Are there other ways to access an function in a public
> > running app?
> > 
> > Many thanks for your ideas,
> >   Ralf
> > 
> > Ralf Heinrich Kefferpuetz
> > Web: http://www.keffi.eu
> > Facebook: http://www.facebook.com/Keffi.eu
> > Germany
> > 
> > 
> > 
> 

Reply via email to