SoyArcano Posted March 26, 2017 Share Posted March 26, 2017 (edited) Hello i was editing a little program for autoit, this is the autoit program: expandcollapse popup#include <ImageSearch.au3> #include <GDIPlus.au3> While 1 $fileA = @ScriptDir & "\imagenes\link.bmp" _GDIPlus_Startup() $hImageA =_GDIPlus_ImageLoadFromFile($fileA) $hBitmapA = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageA) $x = 0 $y = 0 $result = _ImageSearch($hBitmapA, 1, $x, $y, 20, 0) If $result > 0 Then MouseMove($x, $y) MouseClick("left") Send ("{DELETE}") Send("") Send("{ENTER}") ExitLoop EndIf sleep(300) WEnd Sleep(30000) $fileA = @ScriptDir & "\imagenes\BotonPubli.bmp" _GDIPlus_Startup() $hImageA =_GDIPlus_ImageLoadFromFile($fileA) $hBitmapA = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageA) $x = 0 $y = 0 $result = _ImageSearch($hBitmapA, 1, $x, $y, 20, 0) ; If $result > 0 Then MouseMove($x, $y) MouseClick("left") EndIf Sleep(15000) $fileA = @ScriptDir & "\imagenes\BotonAbajo.bmp" _GDIPlus_Startup() $hImageA =_GDIPlus_ImageLoadFromFile($fileA) $hBitmapA = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageA) $x = 0 $y = 0 $result = _ImageSearch($hBitmapA, 1, $x, $y, 20, 0) If $result > 0 Then MouseMove($x, $y) MouseClick("right") EndIf While 1 $fileA = @ScriptDir & "\imagenes\Cebolla.bmp" _GDIPlus_Startup() $hImageA =_GDIPlus_ImageLoadFromFile($fileA) $hBitmapA = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageA) $x = 0 $y = 0 $result = _ImageSearch($hBitmapA, 1, $x, $y, 20, 0) If $result > 0 Then MouseMove($x, $y) Sleep(30000) MouseClick("left") Send("{DOWN}") Send("{ENTER}") ExitLoop EndIf sleep(300) WEnd _GDIPlus_ImageDispose($hImageA) _GDIPlus_Shutdown() I try to change the last part to: $result = _ImageSearch($hBitmapA, 1, $x, $y, 20, 0) If $result > 0 Then MouseMove($x, $y) MouseClick("left") ;Clika con boton izquierdo EndIf WEnd _GDIPlus_ImageDispose($hImageA) _GDIPlus_Shutdown() But still i get all the time Error when i run the script..: Subscript used on non-accesible variable Line 11. What i'm doing wrong? Edited March 26, 2017 by SoyArcano Link to comment Share on other sites More sharing options...
JohnOne Posted March 29, 2017 Share Posted March 29, 2017 What is on line 11? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
InunoTaishou Posted March 29, 2017 Share Posted March 29, 2017 The error is in ImageSearch.au3. This topic has been created so many times, the question has been asked so many times, and it has been answered so many times. The ImageSearch.au3 UDF should have proper error checking throw into it and re-released or something. Throw in If (@Error) in the ImageSearch function after it does the DLLCall to the ImageSearchDLL.dll or check that $result is an array (IsArray($result)) JohnOne 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now