Skip to content

Instantly share code, notes, and snippets.

@crazy4groovy
Forked from philipbjorge/notepad_cleaner.au3
Created September 5, 2013 19:03
Show Gist options
  • Save crazy4groovy/6454599 to your computer and use it in GitHub Desktop.
Save crazy4groovy/6454599 to your computer and use it in GitHub Desktop.
; Stupid simple autoit script for cleaning up "orphaned" notepad instances
; I end up with dozens of notepad instances after a day of coding and it's a pain to close all these manually
; as I do want to keep some of them.
; Public Domain
; Philip Bjorge
; June 2, 2012
Local $windows=WinList()
For $i = 1 To $windows[0][0]
If StringInStr($windows[$i][0], "Notepad", 0) Then
WinSetState($windows[$i][1], "", @SW_MAXIMIZE)
If MsgBox(4, "Notepad Cleaner", "Do you want to kill this notepad instance?", 0, $windows[$i][1]) = 6 Then
WinClose($windows[$i][1])
WinWaitActive("Notepad", "Save")
;WinWaitActive("Notepad", "Do you want to save") ; When running under Windows XP
Send("!n")
EndIf
EndIf
Next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment