Slabdog Posted April 14, 2009 Share Posted April 14, 2009 I have applications that crash under Vista with the error message "APPNAME has stopped working". Because the systems are left unattended, I need an AutoIt script that automatically presses the "Close Program" button that is shown in the error dialog. I tried using WinWaitActive for this, but it doesn't work. Furthermore, when I use Au3Info it is frozen while the error message is displayed, so I can't find out any other information about the dialog box. The script I use works in XP, just not Vista (with the window titles changed, of course). Can anyone help? Link to comment Share on other sites More sharing options...
Slabdog Posted April 15, 2009 Author Share Posted April 15, 2009 I tried putting #RequireAdmin at the top of the script, but that made no difference. Link to comment Share on other sites More sharing options...
FinalVersion Posted April 15, 2009 Share Posted April 15, 2009 I don't know if hitting enter will get rid of it so yeah. $i = 0 ;Count how many times i saved your life While 1 While (WinExists("Title","Text")) ;make sure we get rid of it WinActivate("Title","Text") ;activate it WinActive("Title","Text") ;Check if activate it Send("{ENTER} ") ;send enter to close it WinClose("Title","Text") ;make sure it closes :) If Not (WinExists("Title")) Then ;make sure it went away before we increase saved life count $i = $i + 1 ;increase saved life count EndIf WEnd If Not (ProcessExists("Your Program")) Then ;make sure your program is still running ExitLoop ;if not then lets end this script EndIf Sleep(100) WEnd MsgBox(4096, "Stats", "I saved your life " & $i & " many times!") [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 15, 2009 Moderators Share Posted April 15, 2009 Slabdog,A bit of searching (good tip ;-) ) found this little function which might help:; finding if an application is hung ; neogia If _NotResponding("TITLE HERE", "TEXT HERE[OPTIONAL]", 1) Then ; The last parameter indicates whether you want to close the hung app or not. MsgBox(0,"", "Hung Application, closing app now.") Else MsgBox(0,"", "Application running as intended.") EndIf Func _NotResponding($title, $text, $closeIfHung = 0) $hWnd = WinGetHandle($title, $text) If $hWnd == "" Then MsgBox(0,"Error","Could not find window") Exit EndIf $retArr = DllCall("user32.dll", "int", "IsHungAppWindow", "hwnd", $hWnd) If @error == 0 Then If $retArr[0] == 1 Then If $closeIfHung Then ProcessClose(WinGetProcess($title, $text)) EndIf Return 1 EndIf Else Return 0 EndIf EndFuncM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
FinalVersion Posted April 15, 2009 Share Posted April 15, 2009 Slabdog, A bit of searching (good tip ;-) ) found this little function which might help:; finding if an application is hung ; neogia If _NotResponding("TITLE HERE", "TEXT HERE[OPTIONAL]", 1) Then ; The last parameter indicates whether you want to close the hung app or not. MsgBox(0,"", "Hung Application, closing app now.") Else MsgBox(0,"", "Application running as intended.") EndIf Func _NotResponding($title, $text, $closeIfHung = 0) $hWnd = WinGetHandle($title, $text) If $hWnd == "" Then MsgBox(0,"Error","Could not find window") Exit EndIf $retArr = DllCall("user32.dll", "int", "IsHungAppWindow", "hwnd", $hWnd) If @error == 0 Then If $retArr[0] == 1 Then If $closeIfHung Then ProcessClose(WinGetProcess($title, $text)) EndIf Return 1 EndIf Else Return 0 EndIf EndFunc M23This would work better since mine just kills the error window. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
Slabdog Posted April 17, 2009 Author Share Posted April 17, 2009 A bit of searching (good tip ;-) ) found this little function which might help:; finding if an application is hung Melba23, A bit of testing (good tip ;-) ) found that your solution didn't work. Please enlighten me as to what search terms you used to find that snippet, because I searched and came up with nada. Your GoogleFu is obviously superior to mine (although searching for "Vista" and "crash" gave plenty of hits). I eventually got round the problem by setting the following registry keys: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting] "ForceQueue"=dword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\Consent] "DefaultConsent"=dword:00000001 which stopped the box from being shown in the first place. It's not an AutoIt solution, but it does the job I needed it to do. Thanks to you and Godly for trying to help, anyway. I appreciate it. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 17, 2009 Moderators Share Posted April 17, 2009 Slabdog,I do not have a program that regularly crashes so I have never been able to prove that neogia's function actually worked! Sorry it did not work for you - however, it seems to be generally accepted that it does (for example see here and here).As to searching - I use a "param +param +param etc" searches all the time. That seems to give the best results - although it still needs a good rummage through the returned threads. :-) In this case I looked for "detect +not +responding" and found it at #11.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Slabdog Posted April 17, 2009 Author Share Posted April 17, 2009 M23, Ah, I was searching for Vista and "Stopped working" and combinations of that. I didn't think of "Not responding" because that isn't in the error box I was trying to clear. But at least people searching for this issue in future will find this thread. Thanks again! 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