Jump to content

Search the Community

Showing results for tags 'emergency processclose'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Today I had to reboot my PC, due to something I did not see in time, again. So I wrote a, for emergencies, close all scripts, script. Not much code wise but handy to have compiled and running at PC's startup. Just in case... . If Not @Compiled Then Opt("MustDeclareVars", 1) ; this script is meant to run compiled, as Admin if possible. Global $sSelfHiddenTitle = "~~~" & StringTrimRight(@ScriptName, 4) & "~~~" If WinExists($sSelfHiddenTitle) Then HotKeyPressed() MsgBox(262144 + 64, "Emergency Close ALL Autoit processes for user " & @UserName, 'press "Ctrl - Alt - Shift - PAUSE" to execute emergency ProcessClose', 15) Exit 2 EndIf AutoItWinSetTitle($sSelfHiddenTitle & @AutoItPID & "~~~") HotKeySet("!+^{PAUSE}", "HotKeyPressed") ; Alt-Ctrl-Shift-Pause Opt("TrayMenuMode", 3) Global $idCloseEmAll = TrayCreateItem("-= Emergency close all AU3s (Shift-Ctrl-Alt-Pause or DoubleClick tray icon) =-") TrayCreateItem("") ; Create a separator line. Global $idProcessCloseAllAutoit3 = TrayCreateItem('ProcessClose( all "Autoit3 Process" ) - for au3''s') TrayCreateItem("") Global $idCloseAllHiddenWin = TrayCreateItem('WinClose( all "AutoIt v3" hidden windows ) - for compiled or not') TrayCreateItem("") Global $idKillAllWin_CLASS_AutoItv3 = TrayCreateItem('WinKill( all "CLASS:AutoIt v3" ) - KILL''EM ALL !') ; TrayCreateItem("") Global $idBrowseFolderSelf = TrayCreateItem("Browse self folder") TrayCreateItem("") Global $idExit = TrayCreateItem("Exit") TrayCreateItem("") Global $idCancel = TrayCreateItem("Cancel") TraySetState(1) ; Show the tray menu. TraySetClick(16) ; 16 = Releasing secondary mouse button TraySetToolTip("Emergency close ALL AutoIt's" & @CR & "by DoubleClick or Shift-Ctrl-Alt-Pause" & @CR & "RightClick for menu" & @CR & @CR & @CR & " ") Global Const $TRAY_EVENT_PRIMARYDOUBLE = -13 main() Func main() While 1 Switch TrayGetMsg() Case $idCloseEmAll, $TRAY_EVENT_PRIMARYDOUBLE ; If HotKeyPressed() = 0 Then While f_CloseAllHiddenWin() Sleep(2000) WEnd ToolTip('Done with "AutoIt v3"', 50, 50, "Emergency close !", 1) Sleep(2000) ToolTip("") EndIf Case $idProcessCloseAllAutoit3 HotKeyPressed() Case $idCloseAllHiddenWin While f_CloseAllHiddenWin() Sleep(2000) WEnd ToolTip('Done with "AutoIt v3"', 50, 50, "Emergency close !", 1) Sleep(2000) ToolTip("") Case $idKillAllWin_CLASS_AutoItv3 While f_idKillAllWin_CLASS_AutoItv3() Sleep(2000) WEnd ToolTip('Done with "CLASS:AutoIt v3"', 50, 50, "Emergency close !", 1) Sleep(2000) ToolTip("") Case $idExit Return Case $idBrowseFolderSelf ShellExecute(@ScriptDir) EndSwitch WEnd EndFunc ;==>main Func HotKeyPressed() Local $i = 0 ToolTip("ProcessClose: AutoIt3 # " & $i, 50, 50, "Emergency close !", 1) Do While ProcessExists("Autoit3.exe") $i += 1 ToolTip("ProcessClose: AutoIt3.exe # " & $i, 50, 50, "Emergency close !", 1) ProcessClose("AutoIt3.exe") WEnd While ProcessExists("AutoIt3_x64.exe") $i += 1 ToolTip("ProcessClose: AutoIt3_x64.exe # " & $i, 50, 50, "Emergency close !", 1) ProcessClose("AutoIt3_x64.exe") WEnd Sleep(2000) Until (Not ProcessExists("AutoIt3.exe") And Not ProcessExists("AutoIt3_x64.exe")) ToolTip("") Return $i EndFunc ;==>HotKeyPressed Func f_idKillAllWin_CLASS_AutoItv3() Local $n, $i = 0, $aWinList = WinList("[CLASS:AutoIt v3]") ToolTip(' WinKill: ' & UBound($aWinList) - 1 & ' "CLASS:AutoIt v3" ', 50, 50, "Emergency close !", 1) For $n = 1 To UBound($aWinList) - 1 If StringInStr($aWinList[$n][0], $sSelfHiddenTitle) Then ContinueLoop WinKill($aWinList[$n][1]) $i += 1 Next Return $i EndFunc ;==>f_idKillAllWin_CLASS_AutoItv3 Func f_CloseAllHiddenWin() Local $n, $i = 0, $aWinList = WinList("AutoIt v3") ToolTip(' WinClose: ' & UBound($aWinList) - 1 & ' "AutoIt v3" ', 50, 50, "Emergency close !", 1) For $n = 1 To UBound($aWinList) - 1 WinClose($aWinList[$n][1]) $i += 1 Next Return $i EndFunc ;==>f_CloseAllHiddenWin It eventually happens, so if it ever does, you're ready. Edit (2017.01.27): Added, in case of "is compiled, better close all AutoIt v3 hidden windows" and "OMG, kill all [CLASS:AutoIt v3] windows". Also added double click the tray icon to execute.
×
×
  • Create New...