StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 About
 Did you know...
 DYK: acSendKeys and Window Focus
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Rob

USA
2573 Posts

Posted - 04/22/2012 :  14:37:39  Show Profile  Visit Rob's Homepage  Reply with Quote
Did you know...

The acSendKeys action simply injects the specified keys into Windows as if you typed them directly. This means the the keys will be received by the window which currently has focus (active window).

If you want to send keys to an inactive window, it needs to be activated first. The following Lua script will store the current foreground window handle in memory, activate the window where the gesture began, send the keys, then re-activate the window which was previously active:

local iHandle = acGetForegroundWindow()
acActivateWindow(nil, gsx, gsy)
acSendKeys("Type some stuff")
acActivateWindow(iHandle, nil, nil)

dantist

5 Posts

Posted - 05/13/2014 :  10:29:21  Show Profile  Reply with Quote
Hi Rob,

I just registered to thank you for this great hint! I'm currently switching from Opera to Chrome and try to rebuild the great Opera mouse-gestures. Auto-focussing Chrome during the new tab-gesture is a great step forward. To do so I'm just using the second line, no need for focussing back to the previous application.

Cheers,
Dan
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000