Guest Buck Posted March 3, 2004 Share Posted March 3, 2004 'Elo all: I had some problems using ControlSetText, so I decided to try the example in the help file: Example RunWait("notepad") ControlSetText("Untitled -", "", "Edit1", "New Text Here" ) I think RunWait is wrong, because that will have the script wait until notepad exits until it continues execution. Another problem is the title - "Untitled -". My notepad opens with a title of "Untitled - Notepad", as well as the few other PC's I checked. If I modify the example code to: Run("notepad") $var = ControlSetText("Untitled - Notepad", "", "Edit1", "New Text Here" ) msgbox(0,"Debug", $var) This still does not work, and ControlSetText returns a 0. If I open notepad first from the start menu, and run this code: $var = ControlSetText("Untitled - Notepad", "", "Edit1", "New Text Here" ) msgbox(0,"Debug", $var) It does work. I'm going to play with it a bit more, and see if I can get it working with the app I actually need, but in the meantime: Anyone else have these problems? Anybody see some dumb mistake? Thanks for your help . . . Link to comment Share on other sites More sharing options...
Developers Jos Posted March 3, 2004 Developers Share Posted March 3, 2004 If I open notepad first from the start menu, and run this code: $var = ControlSetText("Untitled - Notepad", "", "Edit1", "New Text Here" ) msgbox(0,"Debug", $var) It does work.The ControlSetText is probably already performed with the Notepad program running. Adding a WinWait between the Run and ControlSetText statement will probably solve it. Run("notepad") WinWait ("Untitled - Notepad", "", 2) $var = ControlSetText("Untitled - Notepad", "", "Edit1", "New Text Here" ) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Guest Buck Posted March 5, 2004 Share Posted March 5, 2004 That did it. Thanks! Link to comment Share on other sites More sharing options...
Administrators Jon Posted March 5, 2004 Administrators Share Posted March 5, 2004 Oops. I'll change it. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Developers Jos Posted March 5, 2004 Developers Share Posted March 5, 2004 Oops. I'll change it.i am missing the oops here.... Should the ControlSetText wait for a window to become active ?? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valik Posted March 5, 2004 Share Posted March 5, 2004 i am missing the oops here.... Should the ControlSetText wait for a window to become active ??Its not meant to wait for it to be active, its just meant to wait for it to exist. Most of the time, Run("notepad") then ControlSetText("") immediately after will probably fail because Notepad hasn't finished being created yet. Link to comment Share on other sites More sharing options...
Administrators Jon Posted March 5, 2004 Administrators Share Posted March 5, 2004 The example in the help file uses RunWait. It will only continue to the next line (ControlSetText) when notepad is closed. Oops. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Developers Jos Posted March 5, 2004 Developers Share Posted March 5, 2004 ok understand the oops now... valik... i am a bit lost about your statement. i thought it just returns a 0 if the windows isn't found. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valik Posted March 5, 2004 Share Posted March 5, 2004 ok understand the oops now... valik... i am a bit lost about your statement. i thought it just returns a 0 if the windows isn't found. I didn't understand what you were not understanding, ignore my post. 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