Sign in to follow this  
Followers 0
Shade

Window Hider

30 posts in this topic

Hey, I'm pretty new to AutoIt. I wrote this script that hides a window and then shows it again. Check it out, tell me what you think. :)

WinHider.au3

Share this post


Link to post
Share on other sites



Hey, I'm pretty new to AutoIt. I wrote this script that hides a window and then shows it again. Check it out, tell me what you think. :)

Welcome to AutiIt Shade, well done on your first script.

You'll find many useful (and not so useful) things that AutoIt can do

If you're never sure about something just ask in the appropriate forum as generally someone somewhere is always watching

rick


Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites

Excellent work for your first script ... and post :)!


Share this post


Link to post
Share on other sites

nice.. :)

Share this post


Link to post
Share on other sites

Mom looking over your shoulder... ?

:)


Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@JoshDB

Lol. Yeah kinda. I made it so I could hide any window of something I wasn't supposed to be doing at the time - like playing games, browsing the forums, etc.

Edited by Shade

Share this post


Link to post
Share on other sites

Very Good job!

Can't get this to work!

Trying to make it so you can hide 2 windows.

HotKeySet ("^+z", "Hide")
HotKeySet ("^+x", "Show")
HotKeySet ("+z", "Hide2")
HotKeySet ("+x", "Show2")
Opt("TrayIconHide", 1)
$hidden = "no"
$hidden2 = "no"
While 1
    If $hidden = "yes" Then
        Sleep (10)
    Else
        Global $title = WinGetTitle("")
        Sleep (10)
    EndIf
    If $hidden2 = "yes" Then
        Sleep(10)
    Else
        Global $title2 = WinGetTitle("")
        Sleep(10)
    EndIf
WEnd

Func Hide()
    $hidden = "yes"
    If WinExists("" & $title) Then
    WinSetState ("" & $title, "", @SW_HIDE)
    EndIf
EndFunc

Func Show()
    $hidden = "no"
    If WinExists("" & $title) Then
    WinSetState ("" & $title, "", @SW_SHOW)
    EndIf
EndFunc

Func Hide2()
    $hidden2 = "yes"
    If WinExists("" & $title2) Then
    WinSetState ("" & $title2, "", @SW_HIDE)
    EndIf
EndFunc

Func Show2()
    $hidden2 = "no"
    If WinExists("" & $title2) Then
    WinSetState ("" & $title2, "", @SW_SHOW)
    EndIf
EndFunc

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

I don't see anything wrong with your code... Strange.


Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

i think Ur titles in wrong place

Edited by rambo3889

My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

Think this work

HotKeySet ("^+z", "Hide")
HotKeySet ("^+x", "Show")
HotKeySet ("+z", "Hide2")
HotKeySet ("+x", "Show2")
Opt("TrayIconHide", 1)
$hidden = "no"
$hidden2 = "no"
While 1
    If $hidden = "yes" Then
        Sleep (10)
    Else
        Global $title = WinGetTitle("")
        Sleep (10)
    EndIf
    If $hidden2 = "yes" Then
        Sleep(10)
    Else
        Global $title2 = WinGetTitle("")
        Sleep(10)
    EndIf
WEnd

Func Hide()
    $hidden = "yes"
    If WinExists($title) Then
    WinSetState ($title, "", @SW_HIDE)
    EndIf
EndFunc

Func Show()
    $hidden = "no"
    If WinExists( $title) Then
    WinSetState ($title , "", @SW_SHOW)
    EndIf
EndFunc

Func Hide2()
    $hidden2 = "yes"
    If WinExists($title2 ) Then
    WinSetState ($title2, "", @SW_HIDE)
    EndIf
EndFunc

Func Show2()
    $hidden2 = "no"
    If WinExists($title2) Then
    WinSetState $title2 ,"", @SW_SHOW)
    EndIf
EndFunc

My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Well actually that doesn't work, but this does (came from you rambo, just some mistakes fixed):

HotKeySet ("^z", "Hide")
HotKeySet ("^!z", "Show")
HotKeySet ("^x", "Hide2")
HotKeySet ("^!x", "Show2")
Opt("TrayIconHide", 1)
$hidden = "no"
$hidden2 = "no"
While 1
    If $hidden = "yes" Then
        Sleep (10)
    Else
        Global $title = WinGetTitle("")
        Sleep (10)
    EndIf
    If $hidden2 = "yes" Then
        Sleep(10)
    Else
        Global $title2 = WinGetTitle("")
        Sleep(10)
    EndIf
WEnd

Func Hide()
    $hidden = "yes"
    If WinExists($title) Then
    WinSetState ($title, "", @SW_HIDE)
    EndIf
EndFunc

Func Show()
    $hidden = "no"
    If WinExists( $title) Then
    WinSetState ($title , "", @SW_SHOW)
EndIf
EndFunc

Func Hide2()
    $hidden2 = "yes"
    If WinExists($title2 ) Then
    WinSetState ($title2, "", @SW_HIDE)
    EndIf
EndFunc

Func Show2()
    $hidden2 = "no"
    If WinExists($title2) Then
    WinSetState ($title2 ,"", @SW_SHOW)
    EndIf
EndFunc

Regards

Edited by marfdaman

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Wow! Thanks guys. I was trying to get it to hide two windows, but I was really tired at the time and just stuck with the one window. I'm definetly going to use this one now. Great job! :)

Edited by Shade

Share this post


Link to post
Share on other sites

It still only hides 1 window for me. Please fix.


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

It still only hides 1 window for me. Please fix.

LOL, as long as you've been here, you would think you would try to contribute a fix yourself if it didn't work right.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Firestorm -

I am using the one that marfdaman used:

HotKeySet ("^+z", "Hide")
HotKeySet ("^+x", "Show")
HotKeySet ("^!z", "Hide2")
HotKeySet ("^!x", "Show2")
Opt("TrayIconHide", 1)
$hidden = "no"
$hidden2 = "no"
While 1
    If $hidden = "yes" Then
        Sleep (10)
    Else
        Global $title = WinGetTitle("")
        Sleep (10)
    EndIf
    If $hidden2 = "yes" Then
        Sleep(10)
    Else
        Global $title2 = WinGetTitle("")
        Sleep(10)
    EndIf
WEnd

Func Hide()
    $hidden = "yes"
    If WinExists($title) Then
    WinSetState ($title, "", @SW_HIDE)
    EndIf
EndFunc

Func Show()
    $hidden = "no"
    If WinExists( $title) Then
    WinSetState ($title , "", @SW_SHOW)
    EndIf
    If WinExists($title2) Then
        WinSetState($title2, "", @SW_SHOW)
    EndIf
EndFunc

Func Hide2()
    $hidden2 = "yes"
    If WinExists($title2 ) Then
    WinSetState ($title2, "", @SW_HIDE)
    EndIf
EndFunc

Func Show2()
    $hidden2 = "no"
    If WinExists($title2) Then
    WinSetState ($title2 ,"", @SW_SHOW)
    EndIf
EndFunc

I edited the hotkeys, Hide 1 is CTRL-SHIFT-Z, Show 1 is CTRL-SHIFT-X, Hide 2 is CTRL-ALT-Z, Show 2 is CTRL-ALT-X. This should work out for you.

Share this post


Link to post
Share on other sites

MsgBox(48, "Window 1", "After clicking OK, please bring the first window you want to hide to the front of your screen within 2 seconds.")
Sleep(2000)
Dim $hWnd1 = WinGetTitle("")

MsgBox(48, "Window 2", "After clicking OK, please bring the second window you want to hide to the front of your screen within 2 seconds.")
Sleep(2000)
Dim $hWnd2 = WinGetTitle("")


;...


Func Show2()
    $hidden2 = "no"
    If WinExists($hWnd2) Then
    WinSetState ($hWnd2,"", @SW_SHOW)
    EndIf
EndFunc
;et cetera

Share this post


Link to post
Share on other sites

Firestorm -

I am using the one that marfdaman used:

THanks works great!


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

Cool script! :(

Did anyone notice that it can hide all the icons on your desktop? :)

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

Cool script! :(

Did anyone notice that it can hide all the icons on your desktop? :)

taurus905

Yeah. I've done that before on accident. It can also hide the start button and the bar.

Share this post


Link to post
Share on other sites

And the bottem bar and icons i saw that too, it's awesome!


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
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
Sign in to follow this  
Followers 0