total noob needs help with loop and image search

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Frizze
Newbie
Posts: 5
Joined: Mon Sep 09, 2019 7:48 am

total noob needs help with loop and image search

Post by Frizze » Tue Sep 10, 2019 7:09 am

Hi together,
i am from germany so my english is not the best but i try.

i it possible to use different *.bmp files ? maybe 10 different in one line ?

Code: Select all

FindImagePos>%BMP_DIR%\image_5.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
Endif
second question ...
how do i loop things ?
I have to automate 8 times the same things. actually i do it like insert 8 times the code :?

Code: Select all

//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_5.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
Endif
wait>1
//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_2.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
Endif
Wait>1
//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_3.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
Endif
Wait>1
//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_4.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
Endif
i hope someone can explain it to me so that i understand. I´ll never codet something

greetings to all of you

nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Re: total noob needs help with loop and image search

Post by nodochau » Fri Sep 13, 2019 4:39 pm

save your images as image_1.bmp, image_2.bmp....image_8.bmp in your folder
Let>k=0
Repeat>k
Add>k,1
.......C:\your folder\image_%k%.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Endif
Until>k=8

Frizze
Newbie
Posts: 5
Joined: Mon Sep 09, 2019 7:48 am

Re: total noob needs help with loop and image search

Post by Frizze » Sat Sep 14, 2019 10:35 am

Thank U very much, that is working so far !

know i have to speed it up, but i try it myself first.

Thank U

Frizze
Newbie
Posts: 5
Joined: Mon Sep 09, 2019 7:48 am

Re: total noob needs help with loop and image search

Post by Frizze » Mon Sep 16, 2019 8:58 am

Renamed all Images from image_1 -> image_42
ok, another problem, after 29 Repeats, i have to scoll down. How can i make that work ?

something like

IF>k=29
then>FindImagewithArrowDown
LClickPosition
LClickPosition
LClickPosition
EndIf
// and than my script just continue ?!

Code: Select all

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1

//Find and Left Click Center - this is for starting 
FindImagePos>C:\Temp\stern.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
  wait>0.3
Endif


    
Let>k=1
Repeat>k
Add>k,1
wait>0.3
FindImagePos>C:\Temp\image_%k%.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
    MouseMove>XArr_0,YArr_0
    LClick
    wait>0.3
    FindImagePos>C:\Temp\Truhe.bmp,SCREEN,0,1,XArr,YArr,NumFound,CCOEFF
    MouseMove>XArr_0,YArr_0
    LClick
    wait>0.3
    LClick
    wait>0.3
    FindImagePos>C:\Temp\gruen.bmp,SCREEN,0,1,XArr,YArr,NumFound,CCOEFF
    MouseMove>XArr_0,YArr_0
    LClick
    FindImagePos>C:\Temp\stern.bmp,SCREEN,0,1,XArr,YArr,NumFound,CCOEFF
    MouseMove>XArr_0,YArr_0
    LClick    
    MouseMove>-900,-850 
    Wait>0.3
Endif
Until>k=43




nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Re: total noob needs help with loop and image search

Post by nodochau » Thu Sep 19, 2019 7:19 pm

If you know exactly that wen k=29 then you have to create two or three loops depending on how many pictures do you have.
loop 1. k=1 to 29
Click arrow1....4
loop 2 k=30 to k=....

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