up and down arrow loop until image is found

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
a.lahson
Newbie
Posts: 3
Joined: Sat Jun 09, 2018 4:52 pm

up and down arrow loop until image is found

Post by a.lahson » Sat Jun 09, 2018 4:55 pm

Hi

I want a script to press and hold the up arrow for 5 sec and then hold the down arrow for another 5 secs.

and it keeps repeating until an image is found.

is that possible.

Thank you

a.lahson
Newbie
Posts: 3
Joined: Sat Jun 09, 2018 4:52 pm

Re: up and down arrow loop until image is found

Post by a.lahson » Sat Jun 09, 2018 5:24 pm

this is the code i got till now, I just want the up and down button to be held for 5 secs (looping) until the image is found.

Code: Select all

label>start
//Wait for 
WaitScreenImage>C:\Users\Asus\Desktop\test.PNG,0.7,CCOEFF

ScreenCapture>573,699,757,762,%TEMP_DIR%\screenrect.bmp
//Find and Left Click Center of 
FindImagePos>C:\Users\Asus\Desktop\test.PNG,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>{%XArr_0%+573},{%YArr_0%+699}
  LClick
  wait>1
    MouseMove>{%XArr_0%+573},{%YArr_0%+699}
  LClick
Endif



goto>start

a.lahson
Newbie
Posts: 3
Joined: Sat Jun 09, 2018 4:52 pm

Re: up and down arrow loop until image is found

Post by a.lahson » Sat Jun 16, 2018 4:11 pm

anyone

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

Re: up and down arrow loop until image is found

Post by Marcus Tettmar » Mon Jun 18, 2018 3:48 pm

You need to use the HoldKey function:

https://www.mjtnet.com/manual/holdkey.htm

You can specify a virtual key code. Mouse buttons have virtual key codes.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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