IF CONDITION

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
izarwp
Newbie
Posts: 3
Joined: Thu Dec 30, 2021 7:30 am

IF CONDITION

Post by izarwp » Thu Jan 06, 2022 2:29 am

how can i using if condition with WaitPixelColor?
im new with this app... :|

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: IF CONDITION

Post by Dorian (MJT support) » Thu Jan 06, 2022 8:51 am

Here you go.

Code: Select all

WaitPixelColor>16777215,652,355,10

IF>WPC_RESULT=TRUE
Messagemodal>Pixel was found
Endif

IF>WPC_RESULT=FALSE
Messagemodal>Pixel was not found
Endif
Yes, we have a Custom Scripting Service. Message me or go here

izarwp
Newbie
Posts: 3
Joined: Thu Dec 30, 2021 7:30 am

Re: IF CONDITION

Post by izarwp » Fri Jan 07, 2022 1:26 am

Hi, Thankyou Dorian
but why i must add symbol {}
in the false or true?

if i not using that symbol, still not working, can u explain why?
Thankyou :D :D :D :D

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: IF CONDITION

Post by Dorian (MJT support) » Fri Jan 07, 2022 9:13 am

I just tested it and it works perfectly without those. Can you share your code please? Could you possibly have added spaces to the end of the "If" line and turned off the trailing spaces warning? That's the only way I seem able to make it work with curly braces and fail without them.

That sample will wait for 10 seconds until the pixel at 652,355 changes to 16777215. So you won't see it "do anything" for 10 seconds. Either way, after 10 seconds if you haven't changed any of the values in line 1 you should see "Pixel was not found".

If you look to the right of the button bar in your editor you'll see your mouse coordinates there. Click on the dropdown there and enable "Pixel Color" and "Follow Cursor". Now you'll see X,Y, and the Pixel Color as you move your mouse. If you move your mouse, you'll see those values change accordingly. Now pressing your left and right mouse buttons together, but you should see "Copied" for a fraction of a second. This will copy the values to your clipboard and will help ensure you have the correct values.

This video demonstrates my explanation.
Yes, we have a Custom Scripting Service. Message me or go here

izarwp
Newbie
Posts: 3
Joined: Thu Dec 30, 2021 7:30 am

Re: IF CONDITION

Post by izarwp » Thu Jan 20, 2022 2:49 am

Hi Dorian, thanks for the answer
i was tested, the code cant work normaly cause i not using capital on wpc_result
:D :D :D

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