Hints, tips and tricks for newbies
Moderators: Dorian (MJT support), JRL
-
buckw1
- Junior Coder
- Posts: 20
- Joined: Sun Sep 18, 2005 5:08 am
Post
by buckw1 » Tue Jul 25, 2006 3:51 am
I'm getting errors with this code, is the syntax correct?
Code: Select all
Repeat>
GetActiveWindow>window_title,X,Y,X1,Y1
Wait>1
Until>%X%=0 and %Y%=0 and %X1%=1024 and %Y1%=768
My purpose is simply to wait till a window switches to 1024x768 full screen
-
pgriffin
- Automation Wizard
- Posts: 460
- Joined: Wed Apr 06, 2005 5:56 pm
- Location: US and Europe
Post
by pgriffin » Tue Jul 25, 2006 4:26 am
let>X=0
let>Limit=10
Repeat>X
do something here....
let>X=X+1
Until>X=10
You cannot, to my knowledge use compound expressions in the Until> area of a Repeat> Until>
the following can be used to find the screen resolution as well.
Let>imglibDLL=C:\Program Files\MSImageLibrary\imglib.dll
LibLoad>imglibDll,imglib
LibFunc>imglib,GetScreenRes,screen,ref:0,ref:0
the variables %screen_1% and %screen_2% will contain the resolution. I suppose you could loop through the code until the X and Y coordinates reach the values you want.
Maybe,
label>GetRes
Let>imglibDLL=C:\Program Files\MSImageLibrary\imglib.dll
LibLoad>imglibDll,imglib
LibFunc>imglib,GetScreenRes,screen,ref:0,ref:0
// check for the X coordinate....you could do the same for Y
if>%screen_1%1
goto>GetRes
endif>
clear enough?
-
pgriffin
- Automation Wizard
- Posts: 460
- Joined: Wed Apr 06, 2005 5:56 pm
- Location: US and Europe
Post
by pgriffin » Tue Jul 25, 2006 4:27 am
forgot to add that you'll need to download the Image Recognition Library from this site to use the previous DLL.
sorry...
-
buckw1
- Junior Coder
- Posts: 20
- Joined: Sun Sep 18, 2005 5:08 am
Post
by buckw1 » Tue Jul 25, 2006 9:11 pm
Had no idea imglib had that function, code looks ok, will give it a try tonite.
Thanks
Buck
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Tue Jul 25, 2006 9:25 pm
Assuming 1024x768 resolution, this should do it:
Code: Select all
Label>WaitStretch
GetActiveWindow>PR,X,Y,W,H
If>{(%X%<=0) AND (%Y%<=0) AND (%W%=1024) AND (%H%=768)}
Goto>WaitOver
Endif
Wait>0.5
Goto>WaitStretch
Label>WaitOver
-
pgriffin
- Automation Wizard
- Posts: 460
- Joined: Wed Apr 06, 2005 5:56 pm
- Location: US and Europe
Post
by pgriffin » Tue Jul 25, 2006 10:12 pm
...but if you don't want to make the assumption, use the dll in the ImageRecognitionLibrary....