Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

ImageSearch and GUI

$
0
0
Im trying to use the ImageSearch.au3 from http://www.autoitscript.com/forum/topic/65748-image-search-library/
but I am having a hard time trying to get it to detect an image not on the desktop itself. Here is what I have

[ autoit ]         
#include <ImageSearch.au3> #include <GUIConstants.au3> #include <ScreenCapture.au3> #Include <Misc.au3> #include <WindowsConstants.au3> HotKeySet("{F9}", "Start") HotKeySet("{F10}","Stop") HotKeySet("{F11}","Terminate") HotKeySet("{F8}", "Pic") $Stop = 0 $Height = 20 $Width = $Height*1.5 $X = 0 $Y = 0 Func Pic() GUIDelete();Deletes any GUI present $pos = MouseGetPos();Gets mouse position _ScreenCapture_SetBMPFormat(0) _ScreenCapture_Capture("Shot.bmp", $pos[0], $pos[1], $pos[0] + $Width, $pos[1] + $Height, 1);Takes screenshot around the mouse GUICreate("", $Width, $Height, (@DesktopWidth/2)-100,@DesktopHeight-200,$WS_POPUP,$WS_EX_TOPMOST);Creates GUI for picure GUICtrlCreatePic("shot.bmp", 0, 0, $Width, $Height);Displays picture on the GUI GUISetState();Makes GUI visible EndFunc Func Start() $Stop = 0 while $Stop = 0 $Search = _ImageSearch('Shot.bmp', 0, $X, $Y, 10);Searches for Shot.bmp taken by ScreenCapture If $Search = 1 Then TrayTip("","Found", 1) Else TrayTip("","Not Found", 1) EndIf Wend EndFunc while 1 sleep(10) WEnd Func Terminate() Exit 0 EndFunc Func Stop() $Stop = 1 sleep(500) TrayTip("","Stopped", 3000) EndFunc


What it does is, if you press F8 it will take a small picture called 'Shot.bmp' around your mouse and display it in the lower middle of your screen by using a GUI. When you press F9 it will try to do an ImageSearch of 'Shot.bmp'. My problem is that it can not find the GUI I have displayed on the screen. It only finds the Icon of the 'Shot.bmp' on my desktop since Im running the script off my desktop and the picture is being saved there. If I open the 'Shot.bmp' from an image viewer, the ImageSearch does not find this picture either. Still it only detects the icon on the desktop. Am I using the ImageSearch wrong? Will it not find GUIs in this fashion?

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>