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 

Struggling with resizing windows ...

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



Joined: 21 Jan 2009
Posts: 45

PostPosted: Wed Jan 21, 2009 12:58 pm    Post subject: Struggling with resizing windows ... Reply with quote

Goal: to get a window to resize to 1/4 of whatever monitor the coordinates are set to.

Problem: it can calculate the window size just fine on monitor2, but on every other monitor it calculates smaller than what it should.

Ive got a vertical task bar on my primary monitor (Monitor2) that is 100 pixels wide. My resolution is 1680x1050 on each monitor for a total of 6720x1050.

Monitor1 ---- Monitor3 ---- Monitor2 ---- Monitor4

Example:
Code:
;;-----Variables-----
SetTitleMatchMode, 2

SysGet, Monitor, MonitorWorkArea

RealWidth := (MonitorRight-MonitorLeft)
RealHeight := (MonitorBottom-MonitorTop)

HalfWidth := (RealWidth/2)
HalfHeight := (RealHeight/2)

NotepadHori := -3360
NotepadVert := 0


;;-----Script-----
Run, %SystemRoot%\system32\notepad.exe
WinWait, Notepad
Sleep 500
WinMove, Notepad,, %NotepadHori%,%NotepadVert%, %HalfWidth%,%HalfHeight%


With this code I get a notepad window that is 790 pixels wide where I want it to be 840 pixels.

Any and all help will be very much appreciated! Very Happy
Back to top
View user's profile Send private message
ifckladyluck



Joined: 20 Jan 2009
Posts: 16

PostPosted: Wed Jan 21, 2009 2:25 pm    Post subject: Reply with quote

use Monitor instead of MonitorWorkArea

http://www.autohotkey.com/docs/commands/SysGet.htm
Back to top
View user's profile Send private message
strictlyfocused02



Joined: 21 Jan 2009
Posts: 45

PostPosted: Thu Jan 22, 2009 6:12 am    Post subject: Reply with quote

ifckladyluck wrote:
use Monitor instead of MonitorWorkArea

http://www.autohotkey.com/docs/commands/SysGet.htm


I had a chance to test your suggestion and it works for all the monitors except monitor2. When notepad is launched on monitor2 it is 50 pixels too wide.

I dont know where to go from here, Ive been trying to research how other scripts (WindowPad, etc) are able to properly calculate the size but Im not able to replicate what they are able to do.
Back to top
View user's profile Send private message
strictlyfocused02



Joined: 21 Jan 2009
Posts: 45

PostPosted: Fri Jan 23, 2009 11:33 am    Post subject: Reply with quote

bump Cool
Back to top
View user's profile Send private message
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