FaT3oYCG Posted October 13, 2008 Share Posted October 13, 2008 (edited) I made a simple script that you can use to hide and show windows on your computer, I mainly made it for myself but thought that it mght be nice to share it with everyone. I don't really code in AutoIt much but I do sometimes use other languages. So here is the code for the Window Hider application. I know there is a singleton thing or whatever it is, but using the method that I did for my script seemed simpler. expandcollapse popupTraySetState(2) If WinExists("Window Hider - V0.01 Created By FaT3oYCG - Running") Then MsgBox(0, "Warning!", 'Another instance of "Window Hider" has been detected' & @CRLF & @CRLF & "Exiting ...") Exit EndIf HotKeySet("^{space}", "Show_All") HotKeySet("^d", "Hide_Active") HotKeySet("^t", "Show_ToolTip") HotKeySet("^e", "Quit") $Main = GUICreate("Window Hider - V0.01 Created By FaT3oYCG - Running", 0, 0, @DesktopWidth, @DesktopHeight) Dim $Hidden_Windows[100] Dim $Hidden_Num = 1 While 1 $Windows = WinList() WEnd Func Show_All() For $i = 1 to ($Hidden_Num - 1) If $Hidden_Windows[$i] <> "" Then WinSetState($Hidden_Windows[$i], "", @SW_SHOW) EndIf Next $Hidden_Num = 1 EndFunc Func Hide_Active() If WinGetTitle("[ACTIVE]") <> "" Then $Hidden_Windows[$Hidden_Num] = WinGetTitle("[ACTIVE]") $Hidden_Num += 1 WinSetState("[ACTIVE]", "", @SW_HIDE) EndIf EndFunc Func Show_ToolTip() ToolTip("Press:" & @CRLF & "Ctrl & t to show this Tool Tip" & @CRLF & "Ctrl & d to hide the active (selected) window" & @CRLF & "Ctrl & Space Bar to show all hidden windows"& @CRLF & 'Ctrl & e to exit "Window Hider"') Sleep(2000) ToolTip("") EndFunc Func Quit() MsgBox(0, "Closing!", '"Window Hider" has been closed') WinKill("Window Hider - V0.01 Created By FaT3oYCG - Running") Exit EndFunc Edited October 13, 2008 by FaT3oYCG Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right. Link to comment Share on other sites More sharing options...
spudw2k Posted October 13, 2008 Share Posted October 13, 2008 (edited) Pretty cool. I made on pretty similar. Uses Trayicon. Click Tray icon to hide/restore windows. Ctrl+Shift+Alt+H hides active win or Hides/Displays Tray Icon if no window is active. expandcollapse popup#NoTrayIcon #Include <GuiComboBox.au3> #include <Array.au3> Dim $trayshow = 1 Dim $hiddenwins[1] Opt("TrayMenuMode",1) TraySetIcon("Shell32.dll",-95) TraySetToolTip("HideInTray") $hide = TrayCreateItem("&Hide") $trayexit = TrayCreateItem("Exit") TrayCreateItem("") HotKeySet("!^+h","_HideThisWin") ;Ctrl+Shift+Alt+H While 1 $msg = TrayGetMsg() If $msg = $hide Then _HideWin() If $msg = $trayexit Then _Exit() For $i = 0 to UBound($hiddenwins)-1 If $i <= UBound($hiddenwins)-1 Then If $msg = $hiddenwins[$i] Then _UnHideWin($i) EndIf Next WEnd Func _HideThisWin() $winlist = WinList() For $i = 1 to $winlist[0][0] If IsVisible($winlist[$i][0]) And WinActive($winlist[$i][0]) And $winlist[$i][0] <> "Program Manager" And $winlist[$i][0] <> "" Then _HideWin($winlist[$i][0] & "(" & $winlist[$i][1] & ")") Return 0 EndIf Next If $trayshow Then $trayshow = 0 TraySetState(2) Else $trayshow = 1 TraySetState(1) EndIf EndFunc Func _Exit() Do _UnHideWin(0) Until $hiddenwins[0] = "" Exit EndFunc Func _UnHideWin($i) $hwnd = TrayItemGetText($hiddenwins[$i]) If Not $hwnd Then Return 0 $hwnd = StringLeft($hwnd,StringInstr($hwnd,"(0")-1) $hwnd = WinGetHandle($hwnd) If Not StringInstr(WinGetTitle($hwnd),"AutoIt") Then WinSetState($hwnd,"",@SW_SHOW) TrayItemDelete($hiddenwins[$i]) _ArrayDelete($hiddenwins,$i) If Not IsArray($hiddenwins) Then Dim $hiddenwins[1] EndFunc Func _HideWin($hwnd = 0) If Not $hwnd Then $hwnd = _PickWin() If Not $hwnd Then Return 0 EndIf If Not $hiddenwins[0] Then $hiddenwins[0] = TrayCreateItem($hwnd) Else ReDim $hiddenwins[UBound($hiddenwins)+1] $hiddenwins[UBound($hiddenwins)-1] = TrayCreateItem($hwnd) EndIf $hwnd = StringLeft($hwnd,StringInstr($hwnd,"(0")-1) $hwnd = WinGetHandle($hwnd) WinSetState($hwnd,"",@SW_HIDE) EndFunc Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 EndFunc Func _PickWin() $winX = @DesktopWidth * .4 $winY = @DesktopHeight * .325 $pickgui = GUICreate("Pick Window to Hide",$winX * .55,$winY * .35,-1,-1) $wins = GUICtrlCreateCombo("",(($winX * .55)-($winX * .5))/2,(($winY * .5)-($winY * .35))/2,$winX * .5,$winY * .35) $winlist = WinList() For $i = 1 to $winlist[0][0] If IsVisible($winlist[$i][0]) And $winlist[$i][0] <> "Program Manager" And $winlist[$i][0] Then _GUICtrlComboBox_AddString($wins,$winlist[$i][0] & "(" & $winlist[$i][1] & ")") Next GUISetState() WinSetOnTop($pickgui,"",1) WinActivate("Pick Window") WinWaitActive("Pick Window") While 1 $msg = GuiGetMsg() If $msg = -3 Then ExitLoop WEnd $hwnd = GuiCtrlRead($wins) GuiDelete($pickgui) If $hwnd Then Return $hwnd Return 0 EndFunc Edited October 13, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
FaT3oYCG Posted October 13, 2008 Author Share Posted October 13, 2008 nice, i would add a gui to mine or some more options but i really only created it for myself and it does what i need it to, as i am going to use it in college so that i can hide windows i dont want my teach to see, im not too bothered about it restoring them all because that just helps me, i will probably only use it to hide one window at a time anyway. Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now