DETETED QUESTION - REPOSTED WITH PROPER CODE. SORRY

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
crossedout
Newbie
Posts: 17
Joined: Sun Dec 21, 2008 6:58 am

DETETED QUESTION - REPOSTED WITH PROPER CODE. SORRY

Post by crossedout » Sun Dec 21, 2008 7:38 am

Hello all. I've been playing with the trial version of MS for a few days and love it. Will end up buying it if can fit it into my budget. I've done HTML but never coded anything like this. I love how easy it is to learn and use right out of the box.

The project I'm working on is one in which i have a folder of "background" bmps. The script then takes a capture of where that background was taken to see if there are numbers in that space now. if the compare comes back and says that those two bmps aren't the same, there must be a number in that little box.
IF there is a number there, i want to know what that number is, so getTextinRect looks and that box and returns the number.
Then, I want the mouse to move to another spot and click the returned number of times then move on to the next command (which just happens to be another exact same script for another rectangle and another set of bmps - which is my second question):

Before i move onto the second question, this is the first. I'm sure there is an easier way to end this repeat and move onto the next set of commands. Can someone look at this and tell me what i'm doing wrong. The way it is here, i will have to change the NEXT label for each one and a couple other things, where instead there should be an End repeat (or that's what UNTIL should do but isn't). Here is a small segment of my code.

ScreenCapture>320,761,340,771,C:\test1.BMP
CompareBitmaps>C:\test1.BMP,C:\constantbackground1.BMP,nPercent
If>NPercent320,761,340,771,strText
MouseMove>316,282
Let>ClickAmount=0
Repeat>ClickAmount
Let>ClickAmount=ClickAmount+1
If>ClickAmount
GoTo>next1
EndIf
Until>ClickAmount=%strText%
else
ENDIF

Label>next1
AND KEEP DUPLICATING ABOVE UNTIL ALL 50 AREAS OF THE SCREEN ARE ANALYZED.

My second question has to do with the first in that the above code needs to be repeated exactly the same except for the screen capture area, the bitmap compared to the capture area, the rect to get the number (same as captured rect) and where to move the mouse.

Rather than having a very long code that contains this script 50 times saying the same thing except for those 4 things that change, is there a shorter way of doing this?

I know these are two strange questions, but I've read how helpful the forum has been for others questions (while looking for the answer to this one) and thought you might be able to help me.

Thank you very much.
Brad
Last edited by crossedout on Tue Dec 23, 2008 12:09 am, edited 4 times in total.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Dec 21, 2008 1:43 pm

Your code hasn't pasted into the forum properly. Please try again disabling Smilies and HTML. But in any case it looks like your code jumps out of the repeat loop to the Next label. In which case your repeat loop may never end. You may want a GoSub here instead of a Goto. When a subroutine is called execution returns to the point it was called, where as a label changes the flow and continues after the label.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

crossedout
Newbie
Posts: 17
Joined: Sun Dec 21, 2008 6:58 am

Post by crossedout » Sun Dec 21, 2008 6:09 pm

Thank you for letting me know about the code not showing. It shows when i preview it, but you never know. I disabled html and smiles so hopefully it shows.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Dec 21, 2008 6:17 pm

It is still now showing correctly. This looks wrong:

If>ClickAmount

You need to re-paste it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

crossedout
Newbie
Posts: 17
Joined: Sun Dec 21, 2008 6:58 am

Post by crossedout » Sun Dec 21, 2008 8:24 pm

Thanks again. I took it out of the "code" box. it should show now.

Thanks
Brad

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