Support Portal

for ProcessRobot and WinAutomation

Start a new topic
Answered

Need help with offset of image found

ok, so I just started using the "automation tool" and I am having a little issue that I haven't been able to figure out in the few days I have been using WA. I have a script where it look for images and most of it is working as needed, however I have a function I can't get to work that I need. it looks for an image and finds the image, but the next part I have an issue with. I need it to scan for another image at %X%, %Y% offset of previous image found and if image is found it will go to another label, if not found it will continue actions until found at that offset. I have everything else working, but I can not for the life of me figure out how to get it to search for an image at an offset of another image. I tried putting the first image into an "output" variable when that image is found and using that variables X,Y location and adding the X,Y offset to that (+165on X and +15 on Y) but that doesn't work. it's possible I am just not doing it right considering I have only been using this a couple days and still learning it. if anyone can help me with this I would be extremely grateful. Thanks in Advance!


Best Answer

Hi Chris,


As per your explanation, I found that you are trying to find the image relative to another image.


For that follow below steps. 

  1. Use IF Image exists action and capture first image..
  2. Then if above condition is true then use Move mouse to image action and capture the coordinates of first image in output variables lets say %X%, %Y%. (Move mouse to left top corner).
  3. Now again use one more IF image exists action - search for new image with search mode Search on specified sub-region of screen and specify coordinates X1 as %X%, Y1 as %Y%, X2 as %X+200% and Y2 as %Y+15%. 
    • Here this action search for new image relative to first image in the sub region specified by offset (X2 and Y2 coordinates)
  4. Now if this condition is true then you can use Go to label action.


Please find the screenshot below for your reference.




I hope the above make sense and resolves your query.


Another thing I am trying to get working, but not extremely important is, I want the script to stop running if the time is equal to or greater than a set time. the last app I had that I was using was a simple process of just adding a command for "check time" and then a few menu options to select if time is" >=,<=, +, - or =" and then selecting the action if that is true (end script, or whatever). I'm no "programmer" by far, but I like to toy around with things like this and try new things to automate actions I do daily


ADMIN
Answer

Hi Chris,


As per your explanation, I found that you are trying to find the image relative to another image.


For that follow below steps. 

  1. Use IF Image exists action and capture first image..
  2. Then if above condition is true then use Move mouse to image action and capture the coordinates of first image in output variables lets say %X%, %Y%. (Move mouse to left top corner).
  3. Now again use one more IF image exists action - search for new image with search mode Search on specified sub-region of screen and specify coordinates X1 as %X%, Y1 as %Y%, X2 as %X+200% and Y2 as %Y+15%. 
    • Here this action search for new image relative to first image in the sub region specified by offset (X2 and Y2 coordinates)
  4. Now if this condition is true then you can use Go to label action.


Please find the screenshot below for your reference.




I hope the above make sense and resolves your query.

thanks, I will give this a shot.

Thank you so much! sorry it took me a few days to get back to this post, the above really helped me figure out how this works and I was able to use this example to get things going in the right direction.
would you happen to know how I would go about setting up a time variable that will stop the process between a given time, or allow it to run if that time frame is null?
basically I need it to stop running at 5AM and then it should be allowed to run any time after 7AM until that 5AM comes back around. what I have right now is

Get Current Date and Time and set to %CurrentTime%

If %CurrentTime% >= 7 then

Goto (Label Name)

Else

If %CurrentTime%  >= 5 then

Stop Process

End If

End If



Login or Signup to post a comment