Shinitenshi Posted September 15, 2014 Share Posted September 15, 2014 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 Link to comment Share on other sites More sharing options...
JohnOne Posted September 15, 2014 Share Posted September 15, 2014 Open all .au3 files in Scite4autoit and press ctrl + t to tidy, save and try again. 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...
Shinitenshi Posted September 15, 2014 Author Share Posted September 15, 2014 Open all .au3 files in Scite4autoit and press ctrl + t to tidy, save and try again. 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? Link to comment Share on other sites More sharing options...
JohnOne Posted September 15, 2014 Share Posted September 15, 2014 (edited) No idea, when I tried it, I just pressed print screen and and cut a search image from that in paint. Edited September 15, 2014 by JohnOne 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...
BrewManNH Posted September 15, 2014 Share Posted September 15, 2014 Run the script as a 32 bit process and not a 64 bit, I believe that DLL is a 32 bit DLL, unless there's a 64 bit one out there I missed. Also, put the DLL in the same folder as the script instead of the Windows folder. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Shinitenshi Posted September 15, 2014 Author Share Posted September 15, 2014 (edited) Run the script as a 32 bit process and not a 64 bit, I believe that DLL is a 32 bit DLL, unless there's a 64 bit one out there I missed. Also, put the DLL in the same folder as the script instead of the Windows folder. '?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. Edited September 15, 2014 by Shinitenshi Link to comment Share on other sites More sharing options...
BrewManNH Posted September 15, 2014 Share Posted September 15, 2014 What error do you get when you have the DLL in the script folder? Doesn't work at all doesn't really tell us much. n.b. Thanks for letting me know that there's a 64 bit DLL available, I wasn't aware of that. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Shinitenshi Posted September 15, 2014 Author Share Posted September 15, 2014 What error do you get when you have the DLL in the script folder? Doesn't work at all doesn't really tell us much. I get error: missing separator character before keyword. and the ctrl + t doesn't fix the issues either. Link to comment Share on other sites More sharing options...
BrewManNH Posted September 15, 2014 Share Posted September 15, 2014 That's not an error with the UDF it's an error in Au3Check, you might want to try it with the updated version of that program which you can download here. Or you can turn off checking with Au3Check before running the code. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Shinitenshi Posted September 15, 2014 Author Share Posted September 15, 2014 (edited) 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 Edited September 15, 2014 by Shinitenshi Link to comment Share on other sites More sharing options...
JohnOne Posted September 15, 2014 Share Posted September 15, 2014 Change if $result[0]="0" then return 0 to If Not IsArray($result) Or $result[0] = "0" 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...
BrewManNH Posted September 15, 2014 Share Posted September 15, 2014 Did you try running Tidy on the image search UDF? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Shinitenshi Posted September 15, 2014 Author Share Posted September 15, 2014 (edited) Change if $result[0]="0" then return 0 to If Not IsArray($result) Or $result[0] = "0" I get this error. ImageSearch.au3" (45) : ==> "If" statements must have a "Then" keyword.: Did you try running Tidy on the image search UDF? Yes i did. Edited September 15, 2014 by Shinitenshi Link to comment Share on other sites More sharing options...
BrewManNH Posted September 15, 2014 Share Posted September 15, 2014 If you change the line as JohnOne suggested and added the rest of the line, the "Then Return 0" that should fix that problem. If you run Tidy on the ImageSearch.au3 file inside the 32 bit version of the functions it will get rid of the "error: missing separator character before keyword." problem as well. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Shinitenshi Posted September 15, 2014 Author Share Posted September 15, 2014 ; 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? Link to comment Share on other sites More sharing options...
Shinitenshi Posted September 16, 2014 Author Share Posted September 16, 2014 (edited) ; 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? 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. Edited September 16, 2014 by Shinitenshi Link to comment Share on other sites More sharing options...
Webcreation Posted September 16, 2014 Share Posted September 16, 2014 Try pixelsearch or checksumcolor , instead of image search. Even though it should work properly , the slightest difference in the image would make it unable to recognise. (even tho this is a verry uncommon problem with most scripters, a very common one for me) Hope i could help im merely a beginner myself Link to comment Share on other sites More sharing options...
Shinitenshi Posted September 17, 2014 Author Share Posted September 17, 2014 Try pixelsearch or checksumcolor , instead of image search. Even though it should work properly , the slightest difference in the image would make it unable to recognise. (even tho this is a verry uncommon problem with most scripters, a very common one for me) Hope i could help im merely a beginner myself 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. Link to comment Share on other sites More sharing options...
BrewManNH Posted September 17, 2014 Share Posted September 17, 2014 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. What makes you say that? It appears you have to put the location to search in the function call, so what's preventing you from searching the 2nd monitor? All you need are the proper X and Y values for the location on the monitor you want to search. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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