If this found, do this, but if this found do this

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
n0rm4l
Newbie
Posts: 8
Joined: Tue Nov 10, 2009 2:54 am

If this found, do this, but if this found do this

Post by n0rm4l » Tue Dec 08, 2009 12:44 am

Hi,

I'm trying to make a script that waits for a certain number from 1-9. I captured each one of the numbers but they appear at random. How do I make it wait for the number to appear and do something different for each number. So if a 2 pops up I want it to do one thing, but if a 7 pops up, i want it to do another thing

idiot
Macro Veteran
Posts: 152
Joined: Thu Mar 01, 2007 9:21 am

Post by idiot » Tue Dec 08, 2009 2:26 am

this is a little difficult first you need to be able to detect what numbers appear
im guessing its for some game so i would suggest imag recognition to detect what number appears then do something like this for loops
you get the idea 1 loop section for each number you wish to look for
depending on what you need to detect numbers from you may also be able to use text capture abilities of macro scheduler to
if you where more specific i could help more but here is a general idea hope it helps if i knew where numbers are coming from and what you wanted to do for each i could help more

label>start
if>number 0 appears this do this
else>
goto>1
label>1
if>number 1 this do this
else>
goto>2
label>2
if>number 2 this do this
else>
goto>start
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Dec 08, 2009 2:45 am

Does this work for you? A few lines of code with SRTs for each number choice.

Code: Select all

Label>Loop
Input>vNumber,Enter single number from 0 to 9,1
Let>vRoutine=Choice%vNumber%
GoSub>%vRoutine%
Goto>Loop

SRT>Choice0
    // Do Something
    MessageModal>This was Routine %vNumber%
END>Choice0

Srt>Choice1
  // Do Something else
  MessageModal>This was Routine %vNumber%
END>Choice1

// Insert SRTs for Choices 2 - 8
// ...
// ... 

Srt>Choice9
  // Do Some other stuff
  MessageModal>This was Routine %vNumber%
END>Choice9
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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