cjwessel Posted September 9, 2009 Share Posted September 9, 2009 I have created a script that opens a Notepad element and does a replace of a string. This looks like it works fine. Where in run into problems is if the search string does not exist then Note pad closed but the script does not. What can I do to check the error conditions with Notepad? WinWaitActive("display.html - Notepad") Send("!E") Send("R") Send("!ndisplay") Send("!pwhy") Send("!A") Send("{ESC}{ESC}") ; Now quit by pressing Alt-f and then x (File menu -> Exit) Send("!f") Send("x") ; Now a screen will pop up and ask to save the changes, the window is called ; "Notepad" and has some text "Yes" and "No" WinWaitActive("Notepad") Send("y") Link to comment Share on other sites More sharing options...
Zedna Posted September 9, 2009 Share Posted September 9, 2009 Look at AdlibEnable() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 9, 2009 Share Posted September 9, 2009 (edited) I have created a script that opens a Notepad element and does a replace of a string. This looks like it works fine. Where in run into problems is if the search string does not exist then Note pad closed but the script does not. What can I do to check the error conditions with Notepad? WinWaitActive("display.html - Notepad") Send("!E") Send("R") Send("!ndisplay") Send("!pwhy") Send("!A") Send("{ESC}{ESC}") ; Now quit by pressing Alt-f and then x (File menu -> Exit) Send("!f") Send("x") ; Now a screen will pop up and ask to save the changes, the window is called ; "Notepad" and has some text "Yes" and "No" WinWaitActive("Notepad") Send("y") Why not just read the text from the Edit1 control, modify it with AutoIt and then write it back? WinWaitActive("display.html - Notepad") $hNotepad = WinGetHandle("display.html - Notepad") $sText = ControlGetText($hNotepad, "", "[CLASS:Edit; INSTANCE:1]") StringReplace($sText, "display", "why") ControlSetText($hNotepad, "", "[CLASS:Edit; INSTANCE:1]") For that matter, why bother with Notepad at all? You could FileRead()/StringReplace()/FileWrite() event easier. Edited September 9, 2009 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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