Jump to content

Close Porgram if its "non responding"


Recommended Posts


I need an script what closes an program when its non responding. but before he close the program it should check every 1 minute if its active and every minute it should activate it per mouseclick or something and then it should close it when its non responding.

can someone write me a little script what can do this?

sorry for my bad english.

what the script should do:

closes a program what is non responding

activate the window/program every 1 minute

hope that someone can help me.


best regards

Link to comment
Share on other sites

Search the forum for 'Hung Application' this will show you many examples of how closing an application that is hanging.

UDF List:

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

@guinness: Thank you very much, will do this.

ok find this one:

; 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

but what should i write here: If _NotResponding("TITLE HERE", "TEXT HERE[OPTIONAL]", 1) at the "title here". the title when its frozen or the nromal title?

i mean example "firefox.exe" or "firefox.exe - not responding". and when i want to give this in an loop and check if its not responding every 1 minute then i should write:

While 1





thanks for help.



Edited by Poksi
Link to comment
Share on other sites

Ok i got it now with a normal batch file, started with autoit :oops:. dont need autoit but i use it to start the batchfile :D

got this info and help from an user from the german autoit forum:

$File = FileOpen(@ScriptDir & 'killtask.bat', 2)
FileWrite($File, 'taskkill /f /fi "status eq not responding"')
While Sleep(6000)
    RunWait(@ScriptDir & 'killtask.bat', @SystemDir, @SW_HIDE)

is exactly that what i need.

Link to comment
Share on other sites

Title is either a partial or full window title, usually... and if the UDF author did his/her homework, you could use window handles (My preferred method) too.

Window titles are mutable. Handles are not.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...