|
You last visited: Today at 14:55
Advertisement
[AutoIT] ImageSearch failing on me? Halp pls
Discussion on [AutoIT] ImageSearch failing on me? Halp pls within the AutoIt forum part of the Coders Den category.
08/19/2014, 19:02
|
#1
|
elite*gold: 0
Join Date: Jan 2014
Posts: 73
Received Thanks: 8
|
[AutoIT] ImageSearch failing on me? Halp pls
Hey guys
So i recently wanted to start playing around with autoit and ImageSearch,
Heres the code:
Code:
#include <ImageSearch.au3>
HotKeySet("{F8}", "checkForImage")
global $y = 0, $x = 0
Func checkForImage()
Local $search = _ImageSearch("checkImage.bmp", 0, $x, $y, 0)
If $search = 1 Then
MouseClick($x, $y, 10)
EndIf
EndFunc
while 1
sleep(200)
WEnd
When it fails i get this message: >"E:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Christian\Dropbox\My Autoclicker\AcceptScript\SearchSomething.au3"
"E:\Program Files (x86)\AutoIt3\Include\ImageSearch.au3" (40) : ==> Subscript used on non-accessible variable.:
if $result[0]="0" then return 0
if $result^ ERROR
>Exit code: 1 Time: 2.425
Either i did something wrong in the code, or my autoit and installing of imagesearch is fk'd
|
|
|
08/20/2014, 08:02
|
#2
|
elite*gold: 138
Join Date: Apr 2012
Posts: 3,494
Received Thanks: 1,769
|
Did you have the ImageSearch.dll in the same folder as your script?
|
|
|
08/20/2014, 12:16
|
#3
|
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
|
Actually its name is ImageSearchDLL.dll not ImageSearch.dll. Look it up in the UDF, normally it contains dll before dll.
|
|
|
08/20/2014, 13:04
|
#4
|
elite*gold: 0
Join Date: Jan 2014
Posts: 73
Received Thanks: 8
|
I do have the file ImagesearchDLL.dll in my folder, what else can it be?
|
|
|
08/20/2014, 23:21
|
#5
|
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,149
|
The ImageSearch.au3 contains an error.
Code:
;===============================================================================
;
; Description: Find the position of an image on the desktop
; Syntax: _ImageSearchArea, _ImageSearch
; Parameter(s):
; $findImage - the image to locate on the desktop
; $tolerance - 0 for no tolerance (0-255). Needed when colors of
; image differ from desktop. e.g GIF
; $resultPosition - Set where the returned x,y location of the image is.
; 1 for centre of image, 0 for top left of image
; $x $y - Return the x and y location of the image
;
; Return Value(s): On Success - Returns 1
; On Failure - Returns 0
;
; Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify
; a desktop region to search
;
;===============================================================================
Func _ImageSearch($findImage, $resultPosition, ByRef $x, ByRef $y, $tolerance)
Return _ImageSearchArea($findImage, $resultPosition, 0, 0, @DesktopWidth, @DesktopHeight, $x, $y, $tolerance)
EndFunc
Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance)
If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage
$result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
; If error exit
If @error Or $result[0] = "0" Then Return 0
; Otherwise get the x,y location of the match and the size of the image to
; compute the centre of search
$array = StringSplit($result[0], "|")
$x = Int(Number($array[2]))
$y = Int(Number($array[3]))
If $resultPosition == 1 Then
$x = $x + Int(Number($array[4]) / 2)
$y = $y + Int(Number($array[5]) / 2)
EndIf
Return 1
EndFunc
|
|
|
08/21/2014, 05:48
|
#6
|
elite*gold: 50
Join Date: Feb 2009
Posts: 765
Received Thanks: 927
|
Every week ... one person ... ask about this problem ... please use the search funktion. It is NOT funny, every week to type the same ****.
|
|
|
08/21/2014, 14:22
|
#7
|
elite*gold: 0
Join Date: May 2008
Posts: 167
Received Thanks: 41
|
There are 3 possible mistakes:
1) One of your files doesn´t exist (in the expected folder)
Check, that your files - ImageSearch.au3
- ImageSearchDLL.dll
- Your Script-File (SearchSomething.au3)
- Your Image-File (checkImage.bmp)
are in the same folder and for typing errors - additionally check line 42 in your ImageSearch.au3 - the ImageSearchDLL.dll could be changed to an other folder.
2) Access Denied
Possibly the Script-File have no read-access to your files.
3) Your Script runs in x64 mode
Try to run your script in x86-mode.
|
|
|
12/01/2018, 02:39
|
#8
|
elite*gold: 0
Join Date: Feb 2011
Posts: 8
Received Thanks: 0
|
#RequireAdmin ; <= Nicht vergessen
#include <ImageSearch.au3>
HotKeySet("{F1}", "Start")
HotKeySet("{F2}", "Pause")
HotKeySet("{F3}", "Stop")
$x1=0
$y1=0
Func Start()
While 1
;Täglicher Einloogbonus
$result = _ImageSearch("99.bmp", 1, $x1, $y1, 60)
If $result = 1 Then
$result = _ImageSearch("98.bmp", 1, $x1, $y1, 60) ;<=er klickt immer auf das Bild
If $result = 1 Then
MouseClick("left", $x1, $y1, 1)
Sleep(1000)
EndIf
EndIf ;suche nach 2 Bildern Gleichzeitig
$result = _ImageSearch("Questsabholen.bmp",0,$x1,$y1,60)
if $result=1 Then
MouseClick("left",$x1,$y1,1)
Sleep(1000)
EndIf
$AS = PixelSearch(807, 137,807, 137,0xFFF0C4,20);Quest ;suche nach farben
If not @error Then
$AS = PixelSearch(811, 162,811, 162,0xFFECC0,20);Quest
If not @error Then
$AS = PixelSearch(1187, 375,1187, 375,0xF8EF94,20);Abholen
If not @error Then
$AS = PixelSearch(1187, 375,1187, 375,0xF8EF94,20);Abholen
If not @error Then
MouseClick("left",1187, 375,1)
sleep(1000)
EndIf
EndIf
EndIf
EndIf
WEnd
While 1
Sleep(100)
WEnd
Func Pause()
sleep(36000000)
EndFunc
Func Stop()
Exit
EndFunc ;==>Stop
Viel Spaß damit! 
; ("99.bmp", 1, $x1, $y1, 60) 1 heist oben links vom Bild klickt er und 0 ist die klickt er in die Mitte
|
|
|
Similar Threads
|
AutoIT Imagesearch
05/01/2014 - AutoIt - 11 Replies
Guten Abend zusammen,
Ich bin grad dabei mein eignen klein FarmBot zu schreiben. Allerdings fehlt es mir an ein paar begriffen.
Ich möchte das der Bot Solang auf den Button "Suchen" klickt bis er dem
Button "Join" gefunden hat und dann da sofort drauf klickt.
Wie müsste ich diesen Satz formulieren?
Bitte um Hilfe! :D
|
AutoIt - ImageSearch
11/22/2013 - SRO Private Server - 0 Replies
#include <ImageSearch.au3>
$X = 0
$Y = 0
Func Start ()
$Search = _ImageSearch('Weapon.bmp', 0, $x, $y, 0)
if $Search = 1 Then
MouseMove($x, $y,10)
EndIf
|
Autoit ImageSearch
09/20/2009 - AutoIt - 10 Replies
moin Leuts,
hab ein problem mit einem Autoit ImageSearch Bot.Unzwar wenn ich den Bot starten erscheint er für ein bruchteil einer sec unten rechts iner taskleiste(da wo die uhr ist) dann schliest er sich wieder. Warum auch immer.
Hier mal der Script
HOTKEYSET("{F6}", "Start")
HotKeySet("{F5}", "Stop")
#include <ImageSearch.au3>
|
All times are GMT +1. The time now is 14:57.
|
|