Starting

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
lukinhasvdp
Newbie
Posts: 6
Joined: Wed Apr 03, 2019 1:32 pm

Starting

Post by lukinhasvdp » Wed Apr 03, 2019 1:43 pm

Ok, so im just be honest, tried it yesterday, and want some ideas, im really just getting started and have a few questions..
My script:
1st part
It just a loop that will be clicking on some points.. easy to do, what i dont know is how can i make a hotkey that pauses de script, and when i unpause continues from where it stoped, im always having to start from begginig again...

2nd part
Havent even tested yet, but i use imagesearch, if that image shows on screen start playing a song, or any alert..

Can someone help me, or indicate where can i find this answers?
Create hotkeys to pause and unpause
Open files if imagefound
And also how can i run the two script in one, each one beeing independant. (While the 1st is running, the second never stop looking for the image simultaneosly)

Thanks in advance, and i ll keep looking, just want to get some directions, since i dont have much time right now, and need this asap

lukinhasvdp
Newbie
Posts: 6
Joined: Wed Apr 03, 2019 1:32 pm

Re: Starting

Post by lukinhasvdp » Wed Apr 03, 2019 10:43 pm

Just an update, made the alarm when image found... now all i need to know is how to run 2 scripts individualy on the same one...

lukinhasvdp
Newbie
Posts: 6
Joined: Wed Apr 03, 2019 1:32 pm

Re: Starting

Post by lukinhasvdp » Thu Apr 04, 2019 12:48 am

Actualy it doesnt work... here is what i got:
Label>Magcargo


ScreenCapture>1455,346,1481,648,%TEMP_DIR%\screenrect.bmp
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\image_8.bmp,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0,
ExecuteFile>C:\Users\Lucas\Desktop\Pokémon Theme Song.mp3
Wait>60
Endif

Goto>Magcargo

Endif


The problem is that it executes the file, even when the image is not found...

lukinhasvdp
Newbie
Posts: 6
Joined: Wed Apr 03, 2019 1:32 pm

Re: Starting

Post by lukinhasvdp » Thu Apr 04, 2019 2:08 am

Finally made the alarm work... still looking for how to use while... im mean... during all the time one loop is happening the other one should be running simultaniously

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

Re: Starting

Post by Dorian (MJT support) » Thu Apr 04, 2019 10:17 am

Image Recognition sometimes take a little experimentation to find the sweet spot.

If the ExecuteFile line is executing, then NumFound is > 0, which means FindImagePos is seeing a match.

Try a tolerance of larger than 0.7 (0.8, 0.9), or try using EXACT, and see if that improves reliability.
Yes, we have a Custom Scripting Service. Message me or go here

lukinhasvdp
Newbie
Posts: 6
Joined: Wed Apr 03, 2019 1:32 pm

Re: Starting

Post by lukinhasvdp » Thu Apr 04, 2019 1:52 pm

Thanks Dorian, it took me a while but i made it... now any idea how to make 2 sripts in one? Like the whole time the first one is running its going to keep waiting for that image to show.... when it does it pauses the 1st script, i can already can get what i wand by using another program together like autohotkey... but i guess there is an easy way to do it using only 1 program... i did a little search yesterday and didnt find much... if someone have something i can read on that specific it would be great..

Thanks a lot

User avatar
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Starting

Post by Grovkillen » Thu Apr 04, 2019 4:18 pm

Have the script that is gonna be paused to look for a file or something. If the second script want to pause the first script it creates this file. If the first script detects this file it should pause itself until the file is deleted. So you need to make a loop which at a point in this loop look for this file....
Let>ME=%Script%

Running: 15.0.24
version history

lukinhasvdp
Newbie
Posts: 6
Joined: Wed Apr 03, 2019 1:32 pm

Re: Starting

Post by lukinhasvdp » Thu Apr 04, 2019 4:42 pm

Thanks, but my first problem isnt pausing the script, for now what i cant do is running the 2 at same time... but when i got to the next step, that is pausing it, you already gave me a good idea, thanks again

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