Sorry, Im not good in English.
UWSC以上に、賢いと思います。
Sample:Google Sheet sell backColor Change
Cell backColor chenge Yellow
#include "ImageSearch.au3" HotKeySet("s", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('color.png',1,$x, $y,0) If $search = 1 Then MouseClick("left",$x, $y, 1,50) EndIf Local $search = _ImageSearch('yellow.png',1,$x, $y,0) If $search = 1 Then MouseClick("left",$x, $y, 1,50) EndIf EndFunc while 1 sleep(200) WEnd
_ImageSearch(‘color.png’,1,$x, $y,0) ;// I don’t know last 0 how to use
sample:calculator auto click num button
Command:
_ImageSearch(‘2.bmp’,1,$x, $y,100) ; search 2.bmp from desktop all
#include "ImageSearch.au3" HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('2.bmp',1,$x, $y,100) If $search = 1 Then MouseClick("left",$x, $y) EndIf EndFunc while 1 sleep(200) WEnd
searching 2.bmp from desktop , so need little time
if you know img area , you better use _ImageSearchArea
_ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)
you use this Autoit Command , you need to get UDF file
● 画像クリックするためには、AutoitのMainファイル以外に有志の人が作ったユーザー関数ファイルが必要です。
where you can get this file
This site has
If Windows10, choice 64bit.
You can dowload
~.rar 圧縮ファイルの1種です
解凍するとこのようになります。
2つとも必要です。
Sample: move to windows icon
2 file need same folder
パスの設定とか面倒なので、最初は同じところに入れてください。
サンプルコード
#include "ImageSearch.au3"
HotKeySet("p", "checkForImage")
global $y = 0, $x = 0
Func checkForImage()
Local $search = _ImageSearch('win-start.png',1,$x, $y,100)
If $search = 1 Then
MouseMove($x, $y, 10)
EndIf
EndFunc
while 1
sleep(200)
WEnd
ホットキー(ショートカットキー)として「p」を指定しています。
Pキーを押すとWindowsーstartボタンにマウス動きます。
画像はPNGで、私は保存しています。
XYの座標を取得することできます
$result =_ImageSearch(‘画像ファイル名’,画像のどこ(左上または中心),X座標, Y座標,100)
$resultには画像があれば「1」
コメント