ImageSearchAndClick(V_LeftUp_X,V_LeftUp_Y,V_RightDown_X,V_RightDown_Y,V_variation,V_PicName,V_WinName)	{
;參數依序為:搜尋範圍左上到右下的X&Y座標, 漸變值, pic資料夾下相對路徑&檔名, 變數 V_WinName
	Loop 50	;找5次100毫秒=0.5秒
	{
	ImageSearch, V_FoundX, V_FoundY, %V_LeftUp_X%, %V_LeftUp_Y%, %V_RightDown_X%, %V_RightDown_Y%, *%V_variation% *TransBlack %A_ScriptDir%\\setting\\rok\\pic\\%V_PicName%	;搜尋指定檔名
	if ErrorLevel = 2	;過程中有錯誤
		{
		MsgBox Could not conduct the search.
		}
	else if ErrorLevel = 1	;找不到圖片
		{
		Sleep, 100	;每100毫秒找一次
		}
	else	;找到目標
		{
		ControlClick, x%V_FoundX% y%V_FoundY%, %V_WinName%,, left,, NA	;點擊
		Return
		}
	}
}