Jump to content

Recommended Posts

Posted
  On 1/1/2019 at 11:54 AM, careca said:

Hi, can you try it like this?

;#requireadmin ;Disables the console output, if the code still doesn't work, comment it.
#include <MsgBoxConstants.au3>
Local $HBMP = 0
Local $x1 = 0, $y1 = 0
Local $right = @DesktopWidth
Local $bottom = @DesktopHeight
Local $findImage = @ScriptDir & '\Capture.PNG'
While 1
    $result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage, "ptr", $HBMP)
    If @error Then
        ConsoleWrite('There was an error: ' & @error & @CRLF)
    Else
        If IsArray($result) = 1 Then
            If $result[0] <> 0 Then
                $array = StringSplit($result[0], "|")
                ConsoleWrite('XPos - ' & $array[2] & ' - YPos - ' & $array[3] & ' - XSize - ' & $array[4] & ' - YSize - ' & $array[5] & @CRLF)
            Else
                ConsoleWrite('Not found' & @CRLF)
            EndIf
        EndIf
    EndIf
    Sleep(100)
WEnd

ps: "DLLCall: @error" this was just a hint for you to get the error number, not an actual line of code, my bad, i wasn't clear on that.

Expand  

Ran it and it says: "There was an error: 1"

Posted
  On 1/3/2019 at 12:12 AM, Stuvven said:

Ran it and it says: "There was an error: 1"

Expand  

For careca file is x64 DLL!

Unable to open x64 DLL in x86 Program, you need an x86 DLL version. Or run the program autoit with x64 mode.

In short. You need to download the Dll again accordingly!

 

Regards,
 

Posted

Well, in the second post i read this: @OSArch=X64

@Stuvven: Do you have a 32bit OS?

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted
  On 1/3/2019 at 9:23 AM, careca said:

Well, in the second post i read this: @OSArch=X64

@Stuvven: Do you have a 32bit OS?

Expand  

64.   I right click the .au3 and click edit script and then from there press f5 to run it. 

Posted

You're running the 32bit autoit exe.

As can be seen in the second post and one further down, in the console output you posted.

" @AutoItX64=0    therefore using x32 ImageSearch DLL "

here

"I run my script and this is all it says in the log: >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" Instead of autoit3_x64.exe

and

" OSArch : X64 // AutoIT ver: 3.3.14.5 x86 "

So i think that if you run it with the 64bit autoit, it'll work.

 

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted
  On 1/3/2019 at 8:13 PM, careca said:

You're running the 32bit autoit exe.

As can be seen in the second post and one further down, in the console output you posted.

" @AutoItX64=0    therefore using x32 ImageSearch DLL "

here

"I run my script and this is all it says in the log: >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" Instead of autoit3_x64.exe

and

" OSArch : X64 // AutoIT ver: 3.3.14.5 x86 "

So i think that if you run it with the 64bit autoit, it'll work.

 

Expand  

Ran your script, have the image provided opened on my 2nd monitor and this is what came up when the script was ran. Had to press ctrl + break to get it to stop spamming.

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\steph\Desktop\Scripts\AutoIt\Image Search\test\Example.au3" /UserParams    
+>19:28:27 Starting AutoIt3Wrapper v.19.102.1901.0 SciTE v.4.1.2.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\steph\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\steph\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\steph\Desktop\Scripts\AutoIt\Image Search\test\Example.au3
+>19:28:27 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\steph\Desktop\Scripts\AutoIt\Image Search\test\Example.au3"    
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
Not found
Not found
Not found
Not found
Not found

>Process failed to respond; forcing abrupt termination...
>Exit code: 1    Time: 1.909
 

I've also tried running the script on the same monitor that has the image opened up on, and then minimizing scite, but my mouse still didn't move to the picture.

Posted

As im not sure it works on secondary monitors, and to troubleshoot, can you try keeping it all in the primary monitor and test that way?

No need to minimize anything, just make sure the whole image is visible.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted (edited)

Ran it again with both image and script on 1 screen and it said the same thing. Also ran my first script and it also said image not found.

Edited by Stuvven
Posted

Im out of ideas, it should work.

 

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

Its function is to search for images exactly according to size and pixel. With the appearance anywhere on the display screen!

Watch the video for example, if you still can't make your script work then I give up.

 

Regards,
 

Posted
  On 1/5/2019 at 8:07 PM, VIP said:

Its function is to search for images exactly according to size and pixel. With the appearance anywhere on the display screen!

Watch the video for example, if you still can't make your script work then I give up.

 

Expand  

This actually worked! Is it possible to get it to where it won't require me to capture a spot on my screen through the script? So that I can just have the picture inside the folder and it'll search for the same image on my screen?

Posted
  On 1/5/2019 at 10:07 PM, Stuvven said:

Is it possible to get it to where it won't require me to capture a spot on my screen through the script? 

Expand  

You need to think more, and try it yourself.
You only need to run it once to help you create the image you are looking for. You can then delete it.

Regards,
 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...