Repeat until

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
buckw1
Junior Coder
Posts: 20
Joined: Sun Sep 18, 2005 5:08 am

Repeat until

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

User avatar
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?

User avatar
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

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
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
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
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.... :D

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts