Jump to content

Window Detector Tool


Pa Callender
 Share

Recommended Posts

This tool displays the results from WinList. I have posted it because it is very interesting to see the results (up to 25 "Default IME" windows, etc.). It allows you to refine your search by setting requested Window Title and Text, and removing Windows from the list. However it is very buggy - and I mean very buggy!

Todo:

  • Custom GUI instead of Notepad
  • "Ignore" list editing
  • General tidying
How to use:

Run the program. If a notepad window doesn't appear, press ESC and run the script again.

Press F10 to remove windows from the list.

Press F9 to change the requested Title and Text.

Press Pause to hold list (useful for scrolling down).

Press Esc to quit.

Do not close notepad as the script is still in memory.

Please remember that this is no custom GUI as of yet - no GUICreate, just Notepad.

Here it is:

#Include <Misc.au3>
HotKeySet ( "{ESC}" , "GBye" )
HotKeySet ( "{PAUSE}" , "ToggleRun" )
HotKeySet ( "{F10}" , "AddIgnore" )
HotKeySet ( "{F9}" , "ChangeRequest" )
$Run = True
$Ignore = ""
Run ( "notepad.exe" )
WinWait ( "Untitled - Notepad" )
WinSetTitle ( "Untitled - Notepad" , "" , "Window Detector Tool - [All Windows]" )
ControlDisable ( "Window Detector Tool" , "" , "Edit1" )
$Request = Default
$RequestText = Default

While 1
 If $Request == "" and $RequestText == "" Then
  WinSetTitle ( "Window Detector Tool" , "" , "Window Detector Tool - [All Windows]" )
 ElseIf $Request == "" and $RequestText <> "" Then ;$Request == "" and $RequestText == ""
  WinSetTitle ( "Window Detector Tool" , "" , "Window Detector Tool - [Windows with text of " & $RequestText & "]" )
 ElseIf $Request <> "" and $RequestText == "" Then ;$Request == "" and $RequestText == ""
  WinSetTitle ( "Window Detector Tool" , "" , "Window Detector Tool - [" & $RequestText & "]" )
 ElseIf $Request <> "" and $RequestText <> "" Then ;$Request == "" and $RequestText == ""
  WinSetTitle ( "Window Detector Tool" , "" , "Window Detector Tool - [" & $Request & " with text of " & $RequestText & "]" )
 EndIf ;$Request == "" and $RequestText == ""
 While $Run == True
  If $Request == "" and $RequestText == "" Then
   WinSetTitle ( "Window Detector Tool" , "" , "Window Detector Tool - [All Windows]" )
  ElseIf $Request == "" and $RequestText <> "" Then ;$Request == "" and $RequestText == ""
   WinSetTitle ( "Window Detector Tool" , "" , "Window Detector Tool - [Windows with text of " & $RequestText & "]" )
  ElseIf $Request <> "" and $RequestText == "" Then ;$Request == "" and $RequestText == ""
   WinSetTitle ( "Window Detector Tool" , "" , "Window Detector Tool - [" & $RequestText & "]" )
  ElseIf $Request <> "" and $RequestText <> "" Then ;$Request == "" and $RequestText == ""
   WinSetTitle ( "Window Detector Tool" , "" , "Window Detector Tool - [" & $Request & " with text of " & $RequestText & "]" )
  EndIf ;$Request == "" and $RequestText == ""
  $List = WinList ( )
  $DisplayList = ""
  For $Index = 1 to $List[0][0]
   If $List[$Index][0] <> "" And ( Not StringInStr ( $Ignore , "|" & $List[$Index][0] & "|" ) ) Then $DisplayList &= $List[$Index][0] & @CRLF
  Next
  ControlSetText ( "Window Detector Tool" , "" , "Edit1" , $DisplayList)
  Sleep ( 2000 )
 WEnd ;$Run == True
WEnd ;1

Func GBye ( )
 Exit
EndFunc ;GBye ( )

Func ToggleRun ( )
 If $Run == False Then
  $Run = True
 Else ;$Run == False
  $Run = False
 EndIf ;$Run == False
EndFunc ;ToggleRun ( )

Func AddIgnore ( )
 $Ignore = $Ignore & "|" & InputBox ( "Window Detector Tool" , "Enter the title of the window you wish to ignore" & @CrLf & @CrLf & "(This list may not be modified)" ) & "|"
EndFunc ;AddIgnore ( )

Func ChangeRequest ( )
 $Request = InputBox ( "Window Detector Tool" , "Enter the partial title of the window you wish to detect" , $Request )
 $RequestText = InputBox ( "Window Detector Tool" , "Enter the partial text of the window you wish to detect" , $RequestText )
EndFunc

Func OnAutoItExit ( )
 WinClose ( "Window Detector Tool" )
EndFunc
[size="4"]YOU SHALL NOT PARSE!![/size]
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
 Share

  • Recently Browsing   0 members

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