PearlJamFanatic Posted October 18, 2010 Share Posted October 18, 2010 I have an autoIT script that does the following 1)wait for the IE crash dialog. There are two kinds of ie crash dilalogs first one has text similar to "Internet explorer has encountered a problem and needs to shutdown.." and has a close button. the second one has similar text but is bigger in size and has Send and Don't Send buttons. 2) Click the Close or Don't Send button respectively depending on the ie crash dialog that pop's up. This script works for the dialog that has close button but does not work for the other dialog box that has Don't Send button. Can you please see where i went wrong? #include <File.au3> AutoItSetOption("WinTitleMatchMode", "2") ; set the select mode to select using substring If $CmdLine[0] < 1 Then; Arguments are not enough MsgBox(0, "Error", "Supply all the arguments, Log File Name is Mandatory") Exit EndIf _FileCreate($CmdLine[1]) WinWait("Internet Explorer","Internet Explorer ha") If Not WinActive("Internet Explorer","Internet Explorer ha") Then WinActivate("Internet Explorer","Internet Explorer ha") $file = FileOpen($CmdLine[1], 2) FileWrite($file, "ERROR: Internet Explorer Crashed.") If ControlClick("Internet Explorer","Internet Explorer ha","&Close")=0 Then ControlClick("Internet Explorer","Internet Explorer ha","&Don't Send") EndIf FileClose($file) EndIf If WinExists("Internet Explorer","Internet Explorer ha") Then $file = FileOpen($CmdLine[1], 2) FileWrite($file, "ERROR: Internet Explorer Crashed.") FileClose($file) WinClose("Internet Explorer","Internet Explorer ha") EndIf Link to comment Share on other sites More sharing options...
jaberwacky Posted October 18, 2010 Share Posted October 18, 2010 (edited) It's this portion of your code: If Not WinActive("Internet Explorer","Internet Explorer ha") Then WinActivate("Internet Explorer","Internet Explorer ha") Remove it and it works fine. Here is my example using a clone of the IE crashed message box. Now keep in mind that this ugly hack is just a monster that I had to create because I couldn't get IE to crash -- GASP! expandcollapse popup#include <File.au3> AutoItSetOption("WinTitleMatchMode", 2) ; set the select mode to select using substring AutoItSetOption("GUIOnEventMode", 1) Global $FILE = @DesktopDir & "\file.txt" _FileCreate($FILE) Global Const $IE_Title = "Internet Explorer" Global Const $IE_Text = "Internet Explorer ha" ; clone the IE message box GUICreate($IE_Title) GUISetOnEvent(-3, "term") GUICtrlCreateLabel("Internet Explorer has crashed", 10, 10) ; be sure to comment this out if you want to simulate the messagebox with a DontSend button Global $buttonClose = GUICtrlCreateButton("&Close", 50, 50) GUICtrlSetOnEvent($buttonClose, "_Close") ; be sure to comment this out if you want to simulate the messagebox with a CLose button ;~ Global $buttonDontSend = GUICtrlCreateButton("&Don't Send", 100, 50) ;~ GUICtrlSetOnEvent($buttonDontSend, "_DontSend") GUISetState() WinWait($IE_Title, $IE_Text) FileOpen($FILE, 2) FileWrite($FILE, "ERROR: Internet Explorer Crashed.") If Not ControlClick($IE_Title, $IE_Text, "&Close") Then ControlClick($IE_Title, $IE_Text, "&Don't Send") EndIf FileClose(1) Func _Close() ConsoleWrite("Close" & @LF) EndFunc ;==>_Close Func _DontSend() ConsoleWrite("DontSend" & @LF) EndFunc ;==>_DontSend Func term() Exit EndFunc ;==>term Edited October 18, 2010 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? 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