Ron and Aaron,

could a function be added to the toolkit for now to make this easier?
say one that would return an object containing the index and the
modifiers from the passed string?

Chip




------------------------------

Chip Orange
Database Administrator
Florida Public Service Commission

chip.ora...@psc.state.fl.us
(850) 413-6314

 (Any opinions expressed are solely those of the author and do not
necessarily reflect those of the Florida Public Service Commission.)
 

> -----Original Message-----
> From: Ron Parker [mailto:r...@gwmicro.com] 
> Sent: Monday, July 06, 2009 9:20 AM
> To: gw-scripting@gwmicro.com
> Subject: Re: inserting keys by name ...
> 
> Jeff Bishop wrote:
> > Hello,
> >  
> > What would be the best way to insert a key such as 
> > Control-Windows-Numpad-+ as the key name to the InsertKey method? I 
> > would like to pass to a generic function the key name to act on and 
> > have it insert that value in an InsertKey function.
> >  
> 
> 
> You couldn't have asked this question before 7.1 shipped?  <smile>
> 
> Unfortunately, it's not a simple matter of passing the string 
> directly 
> to some method.  We've made a note to add something useful to 
> the object 
> model in the future to make that easier.
> 
> For now, you have to use Keyboard.Key to turn the string into a Key 
> object, then build a KeyModifiers value from the various FilterBlah 
> properties of the Key object:
> 
> 
> Dim km
> Dim k
> Set k = Keyboard.Key( stringValue )
> km = 0
> If k.FilterShift = kfsDown Then
>   km = km + kmShift
> End If
> If k.FilterControl = kfsDown Then
>   km = km + kmControl
> End If
> ' et cetera
> Keyboard.InsertKey k.Index, km
> 
> 
> There's not a strict one-to-one correspondence between the keys that 
> Keyboard.Key and friends will give you and the keys that you can 
> insert.  For example, InsertKey doesn't attempt to do anything with 
> numlock, so if you need to deal with NumOn or NumOff you will need to 
> use InsertKeyDown and InsertKeyUp as needed to toggle it before and 
> after inserting your key.
> 
> 
> 

Reply via email to