Jump to content

Imagesearch stopped working without Console ERROR - (Moved)


Recommended Posts

Well well,

I have this problem for a long long time and I tried to fix it on my own well it did not work. I know the Image search library is buggy but I don't want to learn a new Programming language. Anyway, let me describe my Problem: Image search works fine or at least it does it at the beginning after some time without any reason the function can't find the picture anymore there is no reason why. The example file worked at the beginning as well but now even the example file cant find images anymore. That's the first File of my larger project, which also worked at the beginning as all other files.

 

#include "_ImageSearch.au3"
#include "_ImageSearch_Debug.au3"
#include <MsgBoxConstants.au3>
#include <FileConstants.au3> ;For txt
#include <WinAPIFiles.au3>

Call ("Login")
Call ("mobileview")

FunC Login ()
 $File = FileOpen(@ScriptDir & "\textdata\currentACC.txt")  ;Um welchen ACC es sich gerade handelt
 $current_line = FileReadLine($File) ;Welche Zeile gelesen werden soll
 ShellExecute("chrome.exe", "https://www.instagram.com/accounts/login/?source=auth_switcher --new-window --start-fullscreen")
  FileClose (@ScriptDir & "\currentACC.txt")
 Sleep(5000)

$picture= @ScriptDir & "\Pictures\email.bmp"
 $File = FileOpen(@ScriptDir & "\textdata\emails.txt") ;email von accc
 $FileRead = FileReadLine($File,$current_line)
   Local $return = _ImageSearch($picture, 40)
    if $return[0] = 1 Then
        MouseMove($return[1], $return[2])
        MouseClick($MOUSE_CLICK_LEFT)
        Send($FileRead)
    Else
        MsgBox(48, 'Error X001', 'Could not find the username button')
        Exit
     EndIf
     FileClose (@ScriptDir & "\textdata\emails.txt")

Sleep(1000)
$File = FileOpen(@ScriptDir & "\textdata\passwords.txt") ;email von accc
 $FileRead = FileReadLine($File,$current_line)
 $picture= "Pictures\password.bmp"
   Local $return = _ImageSearch($picture)
    if $return[0] = 1 Then
        MouseMove($return[1], $return[2])
        MouseClick($MOUSE_CLICK_LEFT)
        Send($FileRead)
    Else
        MsgBox(48, 'Error X002', 'Could not find the password button')
        Exit
     EndIf
     FileClose (@ScriptDir & "\textdata\passwords.txt")

     Sleep(3000)

 $picture= "Pictures\login.bmp"
   Local $return = _ImageSearch($picture)
    if $return[0] = 1 Then
        MouseMove($return[1], $return[2])
        MouseClick($MOUSE_CLICK_LEFT)
        Send($FileRead)
    Else
        MsgBox(48, 'Error X003', 'Could not find the Login button')
        Exit
     EndIf


EndFunc

Func mobileview ()

   Send("{CTRLDOWN} & {SHIFTDOWN} & {I}")
   Send("{CTRLUP} &{SHIFTUP} ")
   Sleep(2000);
   Send("{CTRLDOWN} & {SHIFTDOWN} & {M}")
   Send("{CTRLUP} &{SHIFTUP} ")
   Sleep(500)
   Send("{CTRLDOWN} & {R}")
   Send("{CTRLUP}")
   Sleep(5000)
EndFunc



HotKeySet("{Esc}", "_Exit")
Func _Exit()
    Exit 0
EndFunc   ;==>_Exit

Output:

>"D:\Programme\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "L:\Youtube\Automatic Instagram\Login.au3"    
--\\ ImageSearch //: DEBUG  --  OSArch : X64 // AutoIT ver: 3.3.14.5 x86
-- WorkingDir      : L:\Youtube\Automatic Instagram
-- ScriptFullPath  : L:\Youtube\Automatic Instagram\Login.au3
-- ImageSearchDLL  : C:\Users\DERTME~1\AppData\Local\Temp\_ImageSearch.dll (14.5kb)
! Search not found!
>Exit code: 0    Time: 25.09

 

I tried: 

- Run the script as x86 (I use Windows 7, 64 bit)

- Use a different functions -> imagesearcharea etc.

- Play with the Parameters (tolerance etc) 

- Use a different imagesearch version

- Use a different Autoit version

-  Put the DLL files inside of the script folder + delete the x64, run the script, and the same with x86

- Run the script as Admin

-  Replace the Image with different formats and sizes (.jpg, png....)

- Add time to the Function

 

 

email.bmp

Link to comment
Share on other sites

You should consider using WebDriver instead of using ImageSearch.  It would make your script way more efficient and far more robust.  Take a look at it :

 

ps. Since you are using Chrome, this is the tool you need.  But you can do everything with IE UDF also.  Just wanted to let you know that those are 2 extremely powerful solutions to fix your issues.

Edited by Nine
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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