
Shinitenshi
Members-
Posts
12 -
Joined
-
Last visited
Everything posted by Shinitenshi
-
ControlClick / MouseClick Issue.
Shinitenshi replied to Shinitenshi's topic in AutoIt General Help and Support
I would like to use the computer while the script is running. -
Here is the image search function i use. Func mySearch($location, $text) $fileA = @ScriptDir & $location _GDIPlus_Startup() $hImageA =_GDIPlus_ImageLoadFromFile($fileA) ;this is the firefox icon use something else if you don't have it. $hBitmapA = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageA) $x = 0 $y = 0 ;Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance,$HBMP=0 $result = _ImageSearch($hBitmapA, 1, $x, $y, 100, 0) ;Zero will search against your active screen If $result > 0 Then ;MouseMove($x, $y) ;MsgBox(0,"",$x & " " & $y) ;TrayTip ( $trayTipTitle, $text, $trayTipTimeout) ControlClick($myHWnd,"","","left",1, $x, $y) ;MouseClick("left", $x, $y, 1) ElseIf $result == 0 Then TrayTip ( $trayTipTitle, "NOT FOUND!", $trayTipTimeout) EndIf _GDIPlus_ImageDispose($hImageA) _GDIPlus_Shutdown() EndFunc if i do a function call mySearch($fireFoxIcon, $text) and un-comment mouseMove($x, $y) it finds the image and moves to it to the correct location. Now if i use the ControlClick($myHWnd,"","","left",1, $x, $y) it finds the image but clicks near the coordinates but not exactly where i want them to click. Any idea why this is happening? Things ive tried. 1. getting a new image 2. mouseclick instead of controlclick and that works but not what i want. 3. mousecoormod 1 no difference. I know there are other ways to activate a browser but im just using Firefox icon to test the imagesearch and controlclick.
-
Yes, if the image is being covered your script will return the value of "0" aka not found. If you have multiple monitors then it will only search your main / primary.
-
ImageSearch.au3 Questions
Shinitenshi replied to Shinitenshi's topic in AutoIt General Help and Support
Unfortunately pixelsearch isn't sufficient enough for what i need but I got ImageSearch working. The only issue now is that it doesn't scan multiple monitors, It just does the primary. -
ImageSearch.au3 Questions
Shinitenshi replied to Shinitenshi's topic in AutoIt General Help and Support
Sorry but i couldn't edit my post. I just wanted to let you know this imagesearch worked perfectly out of the box '?do=embed' frameborder='0' data-embedContent>> The only problem that i see with this one is it wont search other monitors but your primary. Any help with that would be awsome. -
ImageSearch.au3 Questions
Shinitenshi replied to Shinitenshi's topic in AutoIt General Help and Support
; If error exit if IsArray($result) Then;heres the workaround.. if $result[0]="0" then return 0 Else if $result="0" then return 0 EndIf That seemed to work but image is never found I always get 0 return value. _ImageSearch and _ImageSearchArea. I have triple monitor setup would that affect it in any way? -
ImageSearch.au3 Questions
Shinitenshi replied to Shinitenshi's topic in AutoIt General Help and Support
I get this error. ImageSearch.au3" (45) : ==> "If" statements must have a "Then" keyword.: Yes i did. -
ImageSearch.au3 Questions
Shinitenshi replied to Shinitenshi's topic in AutoIt General Help and Support
I downloaded the new ver of Au3Check still getting same issue: Func _ImageSearch($findImage,$resultPosition,ByRef ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Users\Shinitenshi\Dropbox\Learning to Script with AutoIt V3 (Last Updated 17 Feb 2010)\test\ImageSearch.au3"(34,73) : error: missing separator character before keyword. Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Users\Shinitenshi\Dropbox\Learning to Script with AutoIt V3 (Last Updated 17 Feb 2010)\test\ImageSearch.au3"(78,63) : error: missing separator character before keyword. Func _WaitForImageSearch($findImage,$waitSecs,$resultPosition,ByRef ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Users\Shinitenshi\Dropbox\Learning to Script with AutoIt V3 (Last Updated 17 Feb 2010)\test\ImageSearch.au3"(113,64) : error: missing separator character before keyword. Func _WaitForImagesSearch($findImage,$waitSecs,$resultPosition,ByRef ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Shinitenshi\Dropbox\Learning to Script with AutoIt V3 (Last Updated 17 Feb 2010)\test\index.au3 - 4 error(s), 0 warning(s) !>14:05:11 AU3Check ended. Press F4 to jump to next error.rc:2 +>14:05:11 AutoIt3Wrapper Finished. >Exit code: 2 Time: 0.4791 I disabled the check #AutoIt3Wrapper_Run_AU3Check=n now i get this error xD and thats inside ImageSearch.au3 if $result[0]="0" then return 0 if $result^ ERROR -
ImageSearch.au3 Questions
Shinitenshi replied to Shinitenshi's topic in AutoIt General Help and Support
I get error: missing separator character before keyword. and the ctrl + t doesn't fix the issues either. -
ImageSearch.au3 Questions
Shinitenshi replied to Shinitenshi's topic in AutoIt General Help and Support
'?do=embed' frameborder='0' data-embedContent>> That thread has a 64bit and 32bit dll. If i delete the files and dump them on the same folder as the script it doesn't work at all and even the tidy command doesn't fix it. I keep this data structure: C:Windows <--- DLL D:Program Files (x86)AutoIt3Include <--- ImageSearch.au3 and do the tidy command i get another error message using the 64bit dll i get... If $result[0] = "0" Then Return 0 If $result^ ERROR "D:Program Files (x86)AutoIt3IncludeImageSearch.au3" (44) : ==> Subscript used on non-accessible variable.: Complete function: Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance, $HBMP = 0) ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom) If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage If IsString($findImage) Then $result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage, "ptr", $HBMP) Else $result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "ptr", $findImage, "ptr", $HBMP) EndIf ; If error exit If $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 ;==>_ImageSearchArea If i use the 32bit dll i get this after i press the hotkey: --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop !>13:16:53 AutoIt3.exe ended.rc:-1073741819 +>13:16:53 AutoIt3Wrapper Finished. -
ImageSearch.au3 Questions
Shinitenshi replied to Shinitenshi's topic in AutoIt General Help and Support
Thank you John, ImageSearch.au3 didn't give me anymore errors. It didn't find the image though. Im using Photoshop to crop the images and save them as bmp. Does it matter what type of dept i use? 16 / 24 / 32 bit? -
First of all hi! I been reading this forum for a while and I haven't found the need to register until now. I am completely stuck! I have been reading this thread: '?do=embed' frameborder='0' data-embedContent>> I downloaded those files and dumped them in the following dir C:Windows <--- DLL D:Program Files (x86)AutoIt3Include <--- ImageSearch.au3 Image: <--- icon on my desktop My code: #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('find.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc while 1 sleep(200) WEnd The test.au3 and find.bmp are in the same directory. Now after running the script I get this error from every function in ImageSearch.au3 error: missing separator character before keyword. I'm currently running the latest version of auto-it. Windows 7 Ultimate x64bit. I'm sorry if this has been answered millions of times in the forums. I been using the SEARCH feature success