NoN_Stop

iBot Window Manager

May 25th, 2011
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.29 KB | None | 0 0
  1. #include <ButtonConstants.au3>
  2. #include <GUIConstantsEx.au3>
  3. #include <ListViewConstants.au3>
  4. #include <WindowsConstants.au3>
  5. #include <GUIListBox.au3>
  6. Opt("GUIOnEventMode", 1)
  7. Opt("TrayMenuMode", 3)
  8. Opt("TrayOnEventMode", 1)
  9. #Region ### START Koda GUI section ### Form=
  10. $Form1 = GUICreate("iBot Window Manager", 347, 249, 302, 218)
  11. $MenuItem1 = GUICtrlCreateMenu("File")
  12. $exit = GUICtrlCreateMenuItem("Exit", $MenuItem1)
  13. $MenuItem3 = GUICtrlCreateMenu("Help")
  14. $about = GUICtrlCreateMenuItem("About", $MenuItem3)
  15. GUICtrlSetOnEvent(-1, "About")
  16. GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
  17. GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Hide")
  18. $List = GUICtrlCreateList("", 8, 8, 225, 209)
  19. $ListView1context = GUICtrlCreateContextMenu($List)
  20. $MenuItem2 = GUICtrlCreateMenuItem("Refresh", $ListView1context)
  21. $Button1 = GUICtrlCreateButton("Hide", 240, 8, 97, 25, $WS_GROUP)
  22. GUICtrlSetOnEvent(-1, "Hide")
  23. $Button2 = GUICtrlCreateButton("Show", 240, 48, 97, 25, $WS_GROUP)
  24. GUICtrlSetOnEvent(-1, "Show")
  25. $Button3 = GUICtrlCreateButton("Kill", 240, 96, 97, 25, $WS_GROUP)
  26. GUICtrlSetBkColor(-1, 0xFF0000)
  27. GUICtrlSetOnEvent($Button3, "Kill")
  28. GUICtrlSetOnEvent($exit, "_Exit")
  29. GUICtrlSetOnEvent($MenuItem2, "GetWindows")
  30. TraySetOnEvent(-13, "_Tray")
  31. GUISetState(@SW_SHOW)
  32.  
  33. #EndRegion ### END Koda GUI section ###
  34. GetWindows()
  35.  
  36. While 1
  37.     Sleep(100) ; to keep the program running :)
  38. WEnd
  39.  
  40. Func About()
  41.     MsgBox(0, "iBot Window Manager", "Created by NoN_Stop")
  42. EndFunc   ;==>About
  43. Func _Exit()
  44.     Exit
  45. EndFunc   ;==>_Exit
  46. Func _Hide()
  47.     If BitAND(WinGetState($Form1), 1) Or Not BitAND(WinGetState($Form1), 16) Then
  48.         WinSetState($Form1, "", @SW_HIDE)
  49.     EndIf
  50. EndFunc   ;==>_Hide
  51. Func _Tray()
  52.     If BitAND(WinGetState($Form1), 1) Or Not BitAND(WinGetState($Form1), 16) And BitAND(WinGetState($Form1), 2) Then
  53.         WinSetState($Form1, '', @SW_HIDE)
  54.     Else
  55.         WinSetState($Form1, '', @SW_SHOW)
  56.     EndIf
  57. EndFunc   ;==>_Tray
  58. Func GetWindows()
  59.     Local $win
  60.     $win = WinList("[CLASS:CLIENT]")
  61.     For $i = 1 To $win[0][0]
  62.         If $win[$i][0] <> "" Then
  63.             _GUICtrlListBox_AddString($List, $win[$i][0])
  64.         EndIf
  65.     Next ; gets sro_client windows
  66.     $win = WinList("[CLASS:ThunderRT6FormDC]")
  67.     For $i = 1 To $win[0][0]
  68.         If $win[$i][0] <> "" Then
  69.             If StringInStr($win[$i][0], "iB0t") And Not StringInStr($win[$i][0], "Forgotten") Then
  70.                 _GUICtrlListBox_AddString($List, $win[$i][0])
  71.             EndIf
  72.         EndIf
  73.     Next ; gets iBot windows
  74.  
  75.     $win = WinList("[CLASS:ConsoleWindowClass]")
  76.     For $i = 1 To $win[0][0]
  77.         If $win[$i][0] <> "" Then
  78.             If StringInStr($win[$i][0], "HACK") Then
  79.                 _GUICtrlListBox_AddString($List, $win[$i][0])
  80.             EndIf
  81.         EndIf
  82.     Next ; gets
  83. EndFunc   ;==>GetWindows
  84. Func Hide()
  85.     $read = GUICtrlRead($List)
  86.     If $read <> "" Then
  87.         $handle = WinGetHandle($read)
  88.         WinSetState($handle, '', @SW_HIDE)
  89.     EndIf
  90. EndFunc   ;==>Hide
  91. Func Kill()
  92.     $read = GUICtrlRead($List)
  93.     If $read <> "" Then ; checks if selected any window
  94.         $handle = WinGetHandle($read)
  95.         WinKill($handle)
  96.         $index = _GUICtrlListBox_FindString($List, $read) ; gets the number of the selected window
  97.         _GUICtrlListBox_DeleteString($List, $index) ;deletes the selected window
  98.     EndIf
  99.  
  100. EndFunc   ;==>Kill
  101. Func Show()
  102.     $read = GUICtrlRead($List)
  103.     If $read <> "" Then
  104.         $handle = WinGetHandle($read)
  105.         WinSetState($handle, '', @SW_SHOW)
  106.     EndIf
  107. EndFunc   ;==>Show
Advertisement
Add Comment
Please, Sign In to add comment