i have 3 questions if someone can help me or guide me to a topic, first one is that i have 1 image that leads to different locations what i want to do is when it finds the first location do something and then don't click on it again and so on until it click them all and exit.
second question if i want to click a button number of times but this button changes the number of clicks that i can do every time ex (first time the button needs to be clicked 25 times second time it only need to be clicked 10 times and so on)
third question how to assign image to a variable?
same image different locations
Moderators: Dorian (MJT support), JRL
- Dorian (MJT support)
- Automation Wizard
- Posts: 1385
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: same image different locations
Are you able to provide screenshots and more detailed explanations so that we might be able to understand more clearly?
Yes, we have a Custom Scripting Service. Message me or go here
Re: same image different locations
Ok i am trying to press a button number of times but the amount of clicks are not the same every time like you see in the image first time it needed 25 clicks second time it needed 22 clicksDorian (MJT support) wrote: ↑Tue Jun 23, 2020 8:53 amAre you able to provide screenshots and more detailed explanations so that we might be able to understand more clearly?
this is what i did :
//Find and Left Click Center of
Let>RecommendedFound=FALSE
While>RecommendedFound=FALSE
FindImagePos>C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\Recomended Donation.bmp,WINDOW:Screen One,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,{%YArr_0%+10}
LClick
Let>RecommendedFound=TRUE
Wait>2
Let>Donating=0
Repeat>Donating
Let>Donating=Donating+1
MouseMoveRel>286,773
LClick
Wait>0.5
Until>Donating=25
notice that this clicks 25 no matter what is their a way to make it click the exact number of times the button needs,
and i want to know how to assign image to variable so i can repeat the variable
i will try to show you what i mean
Let>KK=Pic
Repeat>Pic
mousemove>XArr_0,YArr_0
Lclick
wait>0.5
Until>Pic=0
what i mean here if the image is visible move mouse and lclick on it and repeat the command until you cant see the image exit
- Dorian (MJT support)
- Automation Wizard
- Posts: 1385
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: same image different locations
Maybe you don't have to count at all. I notice on the 22/25 image you have a timer (00:19:54) at the bottom - does that disappear when you've completed all 25? If so, and if the ":" is always in the exact same position, can you monitor that pixel colour so the script clicks the button if the : is there (those pixels are grey) and doesn't if there's no timer. You could also use Image Recognition to only click if the ":" or "0:" are visible.
If you do have to count, then it's actually quite tricky, because the 22/25 and 25/25 images don't differ in any other way - no different colours, nothing greyed out. No visual clues except for the 22/25 and the 25/25 (and the timer) - none of which will probably be "grabbable" text. Maybe try the OCR Wizard on that tiny 22/25 area to see if it can read the numbers. If they can, that might be a good starting point.
If you do have to count, then it's actually quite tricky, because the 22/25 and 25/25 images don't differ in any other way - no different colours, nothing greyed out. No visual clues except for the 22/25 and the 25/25 (and the timer) - none of which will probably be "grabbable" text. Maybe try the OCR Wizard on that tiny 22/25 area to see if it can read the numbers. If they can, that might be a good starting point.
Yes, we have a Custom Scripting Service. Message me or go here
Re: same image different locations
thank you for the reply my problem will be solved if i know how to assign pic to variable how to do that ?Dorian (MJT support) wrote: ↑Tue Jun 23, 2020 11:34 amMaybe you don't have to count at all. I notice on the 22/25 image you have a timer (00:19:54) at the bottom - does that disappear when you've completed all 25? If so, and if the ":" is always in the exact same position, can you monitor that pixel colour so the script clicks the button if the : is there (those pixels are grey) and doesn't if there's no timer. You could also use Image Recognition to only click if the ":" or "0:" are visible.
If you do have to count, then it's actually quite tricky, because the 22/25 and 25/25 images don't differ in any other way - no different colours, nothing greyed out. No visual clues except for the 22/25 and the 25/25 (and the timer) - none of which will probably be "grabbable" text. Maybe try the OCR Wizard on that tiny 22/25 area to see if it can read the numbers. If they can, that might be a good starting point.
when i write it like that it dosent work
Let>kk=C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\Recomended Donation.bmp
what is the proper way to do this ?
- Dorian (MJT support)
- Automation Wizard
- Posts: 1385
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: same image different locations
Code: Select all
Let>kk=C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\Recomended Donation.bmp
Code: Select all
Let>kk=C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\Recomended Donation.bmp
FindImagePos>%kk%,WINDOW:Screen One,0.7,1,XArr,YArr,NumFound,CCOEFF
If
I'm not entirely sure where you want your endwhile/endif to be, so below are the two most likely canditates.
Code: Select all
//Donating ISN'T included in if/endif
Let>RecommendedFound=FALSE
While>RecommendedFound=FALSE
FindImagePos>C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\Recomended Donation.bmp,WINDOW:Screen One,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,{%YArr_0%+10}
LClick
Let>RecommendedFound=TRUE
Wait>2
Let>Donating=0
Endif
Repeat>Donating
Let>Donating=Donating+1
MouseMoveRel>286,773
LClick
Wait>0.5
Until>Donating=25
Endwhile
Code: Select all
//Donating ISN'T included in if/endif
Let>RecommendedFound=FALSE
While>RecommendedFound=FALSE
FindImagePos>C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\Recomended Donation.bmp,WINDOW:Screen One,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,{%YArr_0%+10}
LClick
Let>RecommendedFound=TRUE
Wait>2
Let>Donating=0
Repeat>Donating
Let>Donating=Donating+1
MouseMoveRel>286,773
LClick
Wait>0.5
Until>Donating=25
Endif
Endwhile
Yes, we have a Custom Scripting Service. Message me or go here