Image search help

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
wqeras
Posts: 1
Joined: 25 Oct 2021, 18:56

Image search help

25 Oct 2021, 19:00

Super beginner here, but i try coping a script and i have it running but when i try to use the a clipping tool and copy the image and try to reload it on the program it comes with an error saying that line 47 is wrong and im not sure what i need to do to fix it

Thanks

Here the code that i tried copying




Code: Select all

#SingleInstance,Force
SetWorkingDir,%A_ScriptDir%
CoordMode,Mouse,screen
CoordMode,Pixel,screem
Gui,2:+AlwaysOnTop
Gui,2:Add,Button,x10 y10 w200 h20 gFind_Image,Find Image
Gui,2:Add,Button,x10  w200 h20 gGui_1,Load / Reload Image
Gui,2:Add,Text,x10 ,Press F13 to Stop
Gui,2:Show,x1000 y200
return
2GuiClose:
	ExitApp
	
Find_Image:
	;ImageSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, ImageFile
	ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_Screen Height ,example.PNG
	if(ErrorLevel=2)
	{
		Msgbox,ErrorLevel = 2'nSomething is Wrong
	}
	else if(ErrorLevel=1)
	{
		TrayTip,,Image Not Found,2
	}
	else if(ErrorLevel=0)
	{
		TrayTip,,*******************'nWe found the image'n**********************
	}
	return

GuiContextMenu:
	Gui,1:Destroy
	return

Move_Window:
	Random,New_X,0,A_ScreenWidth-posw
	Random,New_Y,0,A_ScreenHeight-posw
	Gui,1:Show,x%New_x% y%new_y%
	return

Gui_1()
	{
		global
		Gui,1:Destroy
		Gui,1:Margin,0,0
		Gui,1:+AlwaysOnTop - Caption +Owner2
		Gui,1:Add,Picture,x0 y0 vClip_Picture gMove_windown,example.PNG
		GuiControlGet,Pos,1:Pos,Clip_Picture
		Gui,1:Show, AutoSize
	}
		
Numpad1::
	stop=-1
	return




*ESC::ExitApp
User avatar
mikeyww
Posts: 27095
Joined: 09 Sep 2014, 18:38

Re: Image search help

25 Oct 2021, 20:21

Welcome to AHK. If your image file does not exist, you will get an error.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk, Rohwedder and 144 guests