script for scaning an image

Get help with using AutoHotkey and its commands and hotkeys
gerub
Posts: 6
Joined: 12 Jun 2018, 08:08

script for scaning an image

14 Jun 2018, 07:22

Hi All,

I have no experience in making script and would like your help on it.
I am playing a flash game in a webpage and I want to scan for a image that will pop up any place in the flash game and click that image.
Can someone help on creating such a script?
Can the script be auto running while i am browsing other webpage?
appreciate everyone advice and help.
Thank you.

Best Regards,
Gerub
Hellbent
Posts: 143
Joined: 23 Sep 2017, 13:34

Re: script for scaning an image

14 Jun 2018, 08:06

Here is a video tut on image search
https://www.youtube.com/watch?v=12aahQCJdUs
gerub
Posts: 6
Joined: 12 Jun 2018, 08:08

Re: script for scaning an image

17 Jun 2018, 08:57

I try and write below script but it keep saying image not found...
Can someone help me where is my mistake?
Thank you.

Find_Image:
Stop:=0
while=(Stop=0)
{
ImageSearch,Loc_X, Loc_Y,0,0, A_ScreenWidth, A_ScreenHeight, C:\Users\Peter\Desktop\Tools\Loots1.PNG
if(ErrorLevel=2)

{
msgbox,ErrorLevel = 2`nSomething is wrong
}
else if(ErrorLevel=1)
{
TrayTip,,Image Not Found so funny,2
}
else if(ErrorLevel=0)
{
tx:=Loc_X+(posw//2)
ty:=Loc_Y+(posh//2)
;=MouseMove,Loc_x+(posw//2),Loc_Y+(posh//2)
click,%tx% %ty%
}
}
return



Numpad1::
Stop:=1
return

*ESC::ExitApp
Hellbent
Posts: 143
Joined: 23 Sep 2017, 13:34

Re: script for scaning an image

17 Jun 2018, 14:29

At a glance it looks fine to me.
Have you tried using different images?
Perhaps a simple coloured shaped on a simple background.

Also, use the code tags, reading code like that is a pain and brings back bad memories of coding in plain notepad.
swagfag
Posts: 959
Joined: 11 Jan 2017, 17:59

Re: script for scaning an image

17 Jun 2018, 14:36

understand the effect CoordMode has on the script and choose a mode accordingly.
on a side note if youre using imagesearch for a native fullscreen game it probably wont work, you have to switch to windowed or windowed borderless
gerub
Posts: 6
Joined: 12 Jun 2018, 08:08

Re: script for scaning an image

19 Jun 2018, 10:38

I try it but somehow it does not detect that image on the adobe flash player game I am playing. It keep prompting can't find the image.
Anyone can advice why?
Thank you.
neomulemi6
Posts: 216
Joined: 30 Jun 2016, 06:01

Re: script for scaning an image

19 Jun 2018, 14:43

I almost always need to add a variation to the image search, so the image can be close, but not exactly identical, because some quality is lost when you take a screenshot.

Try changing this line

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

ImageSearch,Loc_X, Loc_Y,0,0, A_ScreenWidth, A_ScreenHeight, C:\Users\Peter\Desktop\Tools\Loots1.PNG


To this

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

ImageSearch,Loc_X, Loc_Y,0,0, A_ScreenWidth, A_ScreenHeight, *25 C:\Users\Peter\Desktop\Tools\Loots1.PNG


If it works, try to lower the number as much as possible. If it doesn't work, try raising it.
swagfag
Posts: 959
Joined: 11 Jan 2017, 17:59

Re: script for scaning an image

19 Jun 2018, 16:39

neomulemi6 wrote:... some quality is lost when you take a screenshot.

perhaps, if youre using some tool or the game's built-in function, which hopefully doesn't need to be spelled out, you shouldn't be doing in the first place

dont use the variation parameter to negate the shortcomings of a shoddily taken needle image.
but sure, provided you coordinates arent messed up, try out playing with the variation. Maybe the haystack image subtly changes hues or smth without u realizing it, but be aware of the fact that by doing so youll be taking a huge dump on imagesearch's performance

without seeing what youre doing, it will be hard for anyone to debug this
gerub
Posts: 6
Joined: 12 Jun 2018, 08:08

Re: script for scaning an image

15 Jul 2018, 11:01

can I ask is there a way to run the image search on a minimized windows?
Thank for your advice.
gerub
Posts: 6
Joined: 12 Jun 2018, 08:08

Re: script for scaning an image

17 Jul 2018, 09:29

any advice anyone?

Return to “Ask For Help”

Who is online

Users browsing this forum: nonvenomous, wideeyedguy and 48 guests