GDB2222 Posted September 21, 2009 Share Posted September 21, 2009 I want to continue working on whatever else I happen to be doing and occasionally send some text to another, minimised, application using autoit. Ideally, I don't want to be aware that this is happening. So far, the best I have been able to come up with is to switch focus, send the keys, then switch back to the original app. The code is as follows: $handleAct = WinGetHandle("[ACTIVE]") ; Get handle of current application $handleNotepad = WinGetHandle("Untitled - Notepad") ; Get handle of Notepad - which is already running Sleep (5000) ; Continue to work on current app WinActivate ($handleNotepad) ; activate notepad and send some text send("text to notepad {ENTER}") send("text2 to notepad {ENTER}") WinActivate($handleAct) ; revert back to original app This is very clunky. There must be a better way, no? Link to comment Share on other sites More sharing options...
jvanegmond Posted September 21, 2009 Share Posted September 21, 2009 Your alternative could be to use ControlSend. github.com/jvanegmond Link to comment Share on other sites More sharing options...
GDB2222 Posted September 21, 2009 Author Share Posted September 21, 2009 Your alternative could be to use ControlSend. Thanks for the VERY quick response. That is an excellent idea. Sadly, this is not a standard windows programme, and the info tool does not list any controls. Any other ideas? BTW, can you change the rate at which key strokes are sent? Link to comment Share on other sites More sharing options...
jvanegmond Posted September 21, 2009 Share Posted September 21, 2009 Try using ControlSend without specifying the control parameter, use an empty string. That sometimes works. The rate at which keys are sent can be controlled with the AutoIt options SendKeyDelay and SendKeyDownDelay. See AutoItSetOption. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Bert Posted September 21, 2009 Share Posted September 21, 2009 Is the app a flash app? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
GDB2222 Posted September 21, 2009 Author Share Posted September 21, 2009 Try using ControlSend without specifying the control parameter, use an empty string. That sometimes works.Thanks - that works brilliantly. Problem solved. Link to comment Share on other sites More sharing options...
GDB2222 Posted September 21, 2009 Author Share Posted September 21, 2009 Sorry, I can't see a 'mark as answered' button. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 21, 2009 Share Posted September 21, 2009 Haha, I was joking. : ) Thanks for voting +1 though. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now