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 

Resize one window based on MinMax state of another

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



Joined: 23 Feb 2008
Posts: 27

PostPosted: Sun Mar 08, 2009 8:48 pm    Post subject: Resize one window based on MinMax state of another Reply with quote

I have a multimonitor setup for stock trading. On one of my monitors I like to view my charts (one window) and my order entry software (separate window).

When my order entry window is minimized, my charts can be maximized to take up the whole monitor. When I Restore my order entry window, I want the charts window to automatically resize to accommodate the second window.

I don't have much experience coding, but enough to know that what I have so far is not an elegant solution. I probably need to be looking at shell hooks or something.

My immediate question is, why does the first half of the If-else statement never get executed even though I can see from the MsgBox that the condition is true? Also, note that I am using a clumsy workaround because winrestore didn't seem to work on this window.

Code:

; see here for minmax info: http://www.autohotkey.com/forum/topic40430.html&highlight=test?sid=73233bc5250e6736b6374e8972ff0d70

Title = TradeStation 8.4 - Lower Left - UncleMikes

Loop
{
WinGet, mmState, MinMax, ES 03-09
MsgBox, MinMax is %mmState%
IFEqual, mmState,0,
{
WinWait, %Title%,
IfWinNotActive, %Title%, , WinActivate, %Title%,
WinWaitActive, %Title%,
SendInput, !{SPACE}
Sleep, 500
SendInput, R
;WinRestore, %Title%
}
else
{
WinWait, %Title%,
IfWinNotActive, %Title%, , WinActivate, %Title%,
WinWaitActive, %Title%,
WinMaximize, %Title%
}
   Sleep, 3000
}
Back to top
View user's profile Send private message
Montu



Joined: 11 Feb 2009
Posts: 142
Location: India

PostPosted: Mon Mar 09, 2009 1:01 pm    Post subject: Reply with quote

Code:
IFEqual, mmState,0,


remove the coma and see if it helps?

Code:
IFEqual, mmState,0


also use bracket here and see if that works?
Code:

IFEqual, mmState,0,
{
WinWait, %Title%,
IfWinNotActive, %Title%
{
WinActivate, %Title%,
SendInput, !{SPACE}
Sleep, 500
SendInput, R
;WinRestore, %Title%
}
}
Back to top
View user's profile Send private message
drmartell



Joined: 23 Feb 2008
Posts: 27

PostPosted: Mon Mar 09, 2009 1:47 pm    Post subject: Reply with quote

Thank you Montu, those suggestions worked. Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
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