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 

[Solved] Moving and setting dimensions for windows

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



Joined: 18 May 2008
Posts: 2

PostPosted: Sun May 18, 2008 4:57 pm    Post subject: [Solved] Moving and setting dimensions for windows Reply with quote

Hey guys, this is such and easy problem, but I can't seem to get it to work by just looking at the help file.

My end goal is to have a script that when I open it, it will run two seperate programs, and position and size them so that both are visible on the screen.

To get started, I'm just toying around with paint and keeping it simple.

Code:
Run, mspaint.exe
Winwait, paint
winrestore, paint
WinMove, 10, 10


This does open and restore paint, but it doesn't move it 10/10 away from the top left corner of the screen. Why?

Thanks!
Jared


Last edited by Dolman on Sun May 18, 2008 9:41 pm; edited 1 time in total
Back to top
View user's profile Send private message
interiot



Joined: 06 Nov 2005
Posts: 64

PostPosted: Sun May 18, 2008 7:28 pm    Post subject: Reply with quote

This tells you what's happening. (or, more accurately, it doesn't tell you anything, which is most informative)
Code:
Run, mspaint.exe
Winwait, paint

; tell us which window it found
WinGetClass, class
MsgBox, found window %class%

Your script is stopping forever at the WinWait line, because it never matches a window. By default, when you search for windows by title, the string you use must match the beginning of the title. So, changing it to this makes it work most of the time:
Code:
WinWait, untitled - Paint

If you want to be super-meticulous though, this will always work:
Code:
Run, mspaint.exe, , pid
WinWait, ahk_pid %pid% ahk_class MSPaintApp
Back to top
View user's profile Send private message
Dolman



Joined: 18 May 2008
Posts: 2

PostPosted: Sun May 18, 2008 9:41 pm    Post subject: Reply with quote

Great! Your advice worked-- I had to tinker with some things to get my apps to work, but in the end everything is working perfect!



Code:
Run, C:\Music\Powertab\PTEditor.exe
WinWait, Untitled - Power Tab Editor 1.7
winrestore, Untitled - Power Tab Editor 1.7
Winactivate, Untitled - Power Tab Editor 1.7
WinMove, A,, -1, 190, 1285, 838

Run, C:\Program Files\Transcribe!\Transcribe.exe
WinWait, Transcribe!
winrestore, Transcribe!
Winactivate, Transcribe!
WinMove, A,, -2, 0, 1285, 190


Thanks for your help!
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