AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

WinHide/WinShow commands.

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
andrei901



Joined: 20 Jan 2008
Posts: 27

PostPosted: Mon Sep 01, 2008 4:00 am    Post subject: WinHide/WinShow commands. Reply with quote

I'm trying to write a script that will hide the last open window at the press of a hotkey, and then open it at the press of a different hotkey.

Code:

^!a::
WinHide
^!b::
WinShow
Exit


this should work, shouldn't it?

but for some reason it doesn't.

could someone please help?
_________________
-andrei901, your local wannabe AHK expert
Back to top
View user's profile Send private message AIM Address
Serenity



Joined: 07 Nov 2004
Posts: 1276

PostPosted: Mon Sep 01, 2008 9:37 am    Post subject: Reply with quote

By last open window do you mean previous window, or active window?

This will hide the previous window:

Code:
![:: ; hide
hwnd := WinActive("A")
; comment out this loop if you want to hide/show the active window
Loop
{
   hwnd := DllCall( "GetWindow",uint,hwnd,int,3 ) ; 3 = GW_HWNDPREV
   SetFormat,integer,hex
   hwnd += 0
   SetFormat,integer,d
   if (DllCall("IsWindowVisible",uint,hwnd) = 1)
   break
}
WinHide, ahk_id %hwnd%
return

!]:: ; show
WinShow, ahk_id %hwnd%
return

_________________
"Anything worth doing is worth doing slowly." - Mae West
Back to top
View user's profile Send private message Visit poster's website
andrei901



Joined: 20 Jan 2008
Posts: 27

PostPosted: Thu Sep 11, 2008 2:11 am    Post subject: Reply with quote

sorry, wasn't able to go to the forums for a while, but yes, thank you very much.
_________________
-andrei901, your local wannabe AHK expert
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group