dandymcgee Posted July 26, 2006 Posted July 26, 2006 Hi, I'm just a noobie in the world of AutoIt, and really I'm just messing around with the funtions right now. I'm trying to get an AutoIt program to send text to a hidden notepad window. I know it can be done because I used to have an example program a while back that did this. That example got lost when i formatted my hard drive . I've posted my script below: Run("Notepad.exe") Sleep(500) Send("Hello{Enter}") Sleep(500) WinSetTitle("Untitled - Notepad", "Hello", "Hiding") Sleep(500) Send("Hiding window...{Enter}") Sleep(500) WinSetState("Hiding", "Hiding window...", @SW_HIDE) Sleep(500) ControlSend("Hiding", "Hiding window...", 15, "The window was hidden when this was typed.") Sleep(500) WinSetState("Hiding", "Hiding window...", @SW_SHOW) Sleep(500) Send("This program will now shut down.{Enter}") Sleep(100) Send("!{F4}") Sleep(500) Send("N") Sleep(100) Exit Thank You in advance for all your guys help. - Dan [Website]
dandymcgee Posted July 26, 2006 Author Posted July 26, 2006 OH yeah, I wanted to know why every once in a while ill find a thread in which the same person periodically types "BUMP"? LOL this is probably a very noob question but thanks. - Dan [Website]
MHz Posted July 26, 2006 Posted July 26, 2006 (edited) You cannot interact with hidden windows using Send. You need ControlSend or ControlSetText for this example. This works fine. Run('Notepad', '', @SW_HIDE) WinWait('Untitled') ControlSend('Untitled', '', 'Edit1', 'Some text') Sleep(1000) WinSetState('Untitled', '', @SW_SHOW) ControlSend does not need an Active window as was incorrectly mentioned in the link. Edited July 26, 2006 by MHz
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