TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Problem: Run Call Of Duty Warzone

    Windows
    4
    28
    2.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Arthur OscarA
      Arthur Oscar
      last edited by

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • Arthur OscarA
        Arthur Oscar
        last edited by

        i already did it... also i had a problem... when i click the au3 file by myself it works.. but when i put to triggercmd execute bat, au3 file, exe file or whatever... it doesnt works...
        just to explain:
        create a trigger to open battle.net launcher
        create a trigger to execute imagesearch to click the "button"

        looks autoit receive command as subscript...
        error says: subscript used on non-acessible variable.imagem_2023-05-12_210826472.png

        RussR 1 Reply Last reply Reply Quote 1
        • RussR
          Russ @Arthur Oscar
          last edited by

          @Arthur-Oscar, if you show me your ImageSearch.au3 script, I'll take a look. It seems that $result variable is null for some reason.

          Russell VanderMey

          Arthur OscarA 1 Reply Last reply Reply Quote 0
          • Arthur OscarA
            Arthur Oscar @Russ
            last edited by

            @Russ exacly... when we manualy click at file.. it works... but when we tell to triggercmd to do it... it comes null

            ===============================================

            #include-once
            ; ------------------------------------------------------------------------------
            ;
            ; AutoIt Version: 3.0
            ; Language: English
            ; Description: Functions that assist with Image Search
            ; Require that the ImageSearchDLL.dll be loadable
            ;
            ; ------------------------------------------------------------------------------

            ;===============================================================================
            ;
            ; 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)
            ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)
            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 $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

            ;===============================================================================
            ;
            ; Description: Wait for a specified number of seconds for an image to appear
            ;
            ; Syntax: _WaitForImageSearch, _WaitForImagesSearch
            ; Parameter(s):
            ; $waitSecs - seconds to try and find the image
            ; $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
            ;
            ;
            ;===============================================================================
            Func _WaitForImageSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance)
            $waitSecs = $waitSecs * 1000
            $startTime=TimerInit()
            While TimerDiff($startTime) < $waitSecs
            sleep(100)
            $result=_ImageSearch($findImage,$resultPosition,$x, $y,$tolerance)
            if $result > 0 Then
            return 1
            EndIf
            WEnd
            return 0
            EndFunc

            ;===============================================================================
            ;
            ; Description: Wait for a specified number of seconds for any of a set of
            ; images to appear
            ;
            ; Syntax: _WaitForImagesSearch
            ; Parameter(s):
            ; $waitSecs - seconds to try and find the image
            ; $findImage - the ARRAY of images to locate on the desktop
            ; - ARRAY[0] is set to the number of images to loop through
            ; ARRAY[1] is the first image
            ; $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 the index of the successful find
            ; On Failure - Returns 0
            ;
            ;
            ;===============================================================================
            Func _WaitForImagesSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance)
            $waitSecs = $waitSecs * 1000
            $startTime=TimerInit()
            While TimerDiff($startTime) < $waitSecs
            for $i = 1 to $findImage[0]
            sleep(100)
            $result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance)
            if $result > 0 Then
            return $i
            EndIf
            Next
            WEnd
            return 0
            EndFunc

            Arthur OscarA 1 Reply Last reply Reply Quote 0
            • Arthur OscarA
              Arthur Oscar @Arthur Oscar
              last edited by

              This post is deleted!
              Arthur OscarA 1 Reply Last reply Reply Quote 0
              • Arthur OscarA
                Arthur Oscar @Arthur Oscar
                last edited by Arthur Oscar

                ive been working on code...
                to not remove posts.. im just going to add again... but modified...
                my case now... error stop shows. but still not working when triggercmd start it. even by a .bat file

                i have 3 monitors... so i changed $x $y $right $bottom values on ImageSearch.au3 (this part still missing negative position. suposing center monitor is the main one with 0-1920px and 0-1080px

                well... the problem stills on triggercmd not runing the scripts as a normal person click.

                cod.au3

                #include <ImageSearch.au3>

                $x = FileReadLine("ImageSearch.au3")
                $y = FileReadLine("ImageSearch.au3")

                Sleep(500)
                Run ("E:\Battle.net\Battle.net Launcher.exe")
                WinActivate("Battle.net")
                WinActive("Battle.net")
                ;while(1)
                WinActivate("Battle.net")
                Run("ImageSearch.au3")
                $Search = _ImageSearch("botao.png", 0, $x, $y,0)
                if $Search = 1 Then
                startapp()
                Else
                WinActivate("Battle.net")
                EndIf
                ;WEnd

                Func startapp()
                WinActivate("Battle.net")
                Sleep(200)
                MouseMove($x,$y+0,0)
                Sleep(200)
                MouseClick("primary")
                endapp()
                EndFunc

                Func endapp()
                Exit
                EndFunc

                ImageSearch.au3

                #include-once
                ; ------------------------------------------------------------------------------
                ;
                ; AutoIt Version: 3.0
                ; Language: English
                ; Description: Functions that assist with Image Search
                ; Require that the ImageSearchDLL.dll be loadable
                ;
                ; ------------------------------------------------------------------------------

                ;===============================================================================
                ;
                ; 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)
                $x1=-1920
                $y1=-1080
                $right=3840
                $bottom=1080
                ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)
                if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
                $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","Int",$x1,"Int",$y1,"Int",$right,"Int",$bottom,"str",$findImage)
                ; Error checking goes here
                If (IsArray($result) = False) Then Return 0
                ; 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=Abs(Number($array[2]))
                $y=Abs(Number($array[3]))
                if $resultPosition=1 then
                $x=$x + Abs(Number($array[4])/2)
                $y=$y + Abs(Number($array[5])/2)
                endif
                return 1
                EndFunc

                ;===============================================================================
                ;
                ; Description: Wait for a specified number of seconds for an image to appear
                ;
                ; Syntax: _WaitForImageSearch, _WaitForImagesSearch
                ; Parameter(s):
                ; $waitSecs - seconds to try and find the image
                ; $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
                ;
                ;
                ;===============================================================================
                Func _WaitForImageSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance)
                $waitSecs = $waitSecs * 1000
                $startTime=TimerInit()
                While TimerDiff($startTime) < $waitSecs
                sleep(100)
                $result=_ImageSearch($findImage,$resultPosition,$x, $y,$tolerance)
                if $result > 0 Then
                return 1
                EndIf
                WEnd
                return 0
                EndFunc

                ;===============================================================================
                ;
                ; Description: Wait for a specified number of seconds for any of a set of
                ; images to appear
                ;
                ; Syntax: _WaitForImagesSearch
                ; Parameter(s):
                ; $waitSecs - seconds to try and find the image
                ; $findImage - the ARRAY of images to locate on the desktop
                ; - ARRAY[0] is set to the number of images to loop through
                ; ARRAY[1] is the first image
                ; $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 the index of the successful find
                ; On Failure - Returns 0
                ;
                ;
                ;===============================================================================
                Func _WaitForImagesSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance)
                $waitSecs = $waitSecs * 1000
                $startTime=TimerInit()
                While TimerDiff($startTime) < $waitSecs
                for $i = 1 to $findImage[0]
                sleep(100)
                $result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance)
                if $result > 0 Then
                return $i
                EndIf
                Next
                WEnd
                return 0
                EndFunc

                Arthur OscarA 1 Reply Last reply Reply Quote 0
                • Arthur OscarA
                  Arthur Oscar @Arthur Oscar
                  last edited by Arthur Oscar

                  reducing to 1 file...

                  still same problem...

                  #include-once
                  ; ------------------------------------------------------------------------------
                  ;
                  ; AutoIt Version: 3.0
                  ; Language: English
                  ; Description: Functions that assist with Image Search
                  ; Require that the ImageSearchDLL.dll be loadable
                  ;
                  ; ------------------------------------------------------------------------------

                  ;===============================================================================
                  ;
                  ; 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)
                  $x1=-1920
                  $y1=-1080
                  $right=3840
                  $bottom=1080
                  ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)
                  if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
                  $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","Int",$x1,"Int",$y1,"Int",$right,"Int",$bottom,"str",$findImage)
                  ; Error checking goes here
                  If (IsArray($result) = False) Then Return 0
                  ; 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=Abs(Number($array[2]))
                  $y=Abs(Number($array[3]))
                  if $resultPosition=1 then
                  $x=$x + Abs(Number($array[4])/2)
                  $y=$y + Abs(Number($array[5])/2)
                  endif
                  return 1
                  EndFunc

                  ;===============================================================================
                  ;
                  ; Description: Wait for a specified number of seconds for an image to appear
                  ;
                  ; Syntax: _WaitForImageSearch, _WaitForImagesSearch
                  ; Parameter(s):
                  ; $waitSecs - seconds to try and find the image
                  ; $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
                  ;
                  ;
                  ;===============================================================================
                  Func _WaitForImageSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance)
                  $waitSecs = $waitSecs * 1000
                  $startTime=TimerInit()
                  While TimerDiff($startTime) < $waitSecs
                  sleep(100)
                  $result=_ImageSearch($findImage,$resultPosition,$x, $y,$tolerance)
                  if $result > 0 Then
                  return 1
                  EndIf
                  WEnd
                  return 0
                  EndFunc

                  ;===============================================================================
                  ;
                  ; Description: Wait for a specified number of seconds for any of a set of
                  ; images to appear
                  ;
                  ; Syntax: _WaitForImagesSearch
                  ; Parameter(s):
                  ; $waitSecs - seconds to try and find the image
                  ; $findImage - the ARRAY of images to locate on the desktop
                  ; - ARRAY[0] is set to the number of images to loop through
                  ; ARRAY[1] is the first image
                  ; $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 the index of the successful find
                  ; On Failure - Returns 0
                  ;
                  ;
                  ;===============================================================================
                  Func _WaitForImagesSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance)
                  $waitSecs = $waitSecs * 1000
                  $startTime=TimerInit()
                  While TimerDiff($startTime) < $waitSecs
                  for $i = 1 to $findImage[0]
                  sleep(100)
                  $result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance)
                  if $result > 0 Then
                  return $i
                  EndIf
                  Next
                  WEnd
                  return 0
                  EndFunc

                  ;#include <ImageSearch.au3>

                  Run ("E:\Battle.net\Battle.net Launcher.exe")
                  Sleep(20000)
                  WinActivate("Battle.net")
                  WinActive("Battle.net")
                  ;while(1)
                  WinActivate("Battle.net")
                  ;Run("ImageSearch.au3")
                  $x = 1
                  $y = 1
                  $Search = _ImageSearch("botao.png", 0, $x, $y,0)
                  if $Search = 1 Then
                  startapp()
                  Else
                  WinActivate("Battle.net")
                  MsgBox("resultado", $Search, "A Busca pela Imagem esta retornando 0")
                  EndIf
                  ;WEnd
                  Func startapp()
                  WinActivate("Battle.net")
                  Sleep(200)
                  MouseMove($x,$y+0,0)
                  Sleep(200)
                  MouseClick("primary")
                  endapp()
                  EndFunc

                  Func endapp()
                  Exit
                  EndFunc

                  RussR 1 Reply Last reply Reply Quote 0
                  • RussR
                    Russ @Arthur Oscar
                    last edited by Russ

                    @Arthur-Oscar, I tried for a couple hours and I couldn't make it work.

                    That battle.net app not a normal Windows app, so the normal AutoIt tricks aren't working.

                    Russell VanderMey

                    Arthur OscarA 1 Reply Last reply Reply Quote 0
                    • Arthur OscarA
                      Arthur Oscar @Russ
                      last edited by Arthur Oscar

                      @Russ but works when i click manually.. just when triggercmd try it... it doesnt works... maybe some argument not passing maybe? idk like tell to triggercmd to execute script as operator
                      thats battle.net app

                      3b546995-0df9-4710-af01-4ab4134b5485-image.png

                      RussR 1 Reply Last reply Reply Quote 0
                      • RussR
                        Russ @Arthur Oscar
                        last edited by Russ

                        @Arthur-Oscar, I don’t know why, but I can’t get it to work at all – with or without TRIGGERcmd. If I could make it work without TRIGGERcmd I could try to troubleshoot it with TRIGGERcmd.

                        Russell VanderMey

                        Arthur OscarA 2 Replies Last reply Reply Quote 0
                        • Arthur OscarA
                          Arthur Oscar @Russ
                          last edited by Arthur Oscar

                          @Russ you can change the PNG file into a piece of your desktop printscreen to try.
                          This way you dont need battle.net app.
                          BTW, i forgot to ask.. you have imagesearchdll.dll file?
                          if you havent, here the link.
                          https://www.autoitscript.com/forum/topic/148005-imagesearch-usage-explanation/
                          its needed to work.. i tried to send to your email, but gmail doesnt allow me to send.
                          b08221f0-a161-4ebb-85b5-e3a7521f647a-image.png like this one of mine desktop

                          1 Reply Last reply Reply Quote 0
                          • Arthur OscarA
                            Arthur Oscar @Russ
                            last edited by

                            @Russ wich system triggercmd is runing? 32 or 64bit? i noticed if i compile script to 32bits script never works... maybe this influence? if trigger is runing as 32bits... idk

                            RussR 1 Reply Last reply Reply Quote 0
                            • Arthur OscarA Arthur Oscar referenced this topic on
                            • RussR
                              Russ @Arthur Oscar
                              last edited by Russ

                              @Arthur-Oscar, the TRIGGERcmd agent is 64bit.

                              Also yes, I have imagesearchdll.dll in the same folder with the cod.au3 script and the compiled cod.exe.

                              4649f284-2b12-4bdb-987e-0f0092b15682-image.png

                              I have seen it detect and move to the Play button, but it usually doesn't, and when it did move to the Play button it didn't click it.

                              Battle.net made it very difficult to automatically start a game.

                              Russell VanderMey

                              Arthur OscarA 2 Replies Last reply Reply Quote 0
                              • Arthur OscarA
                                Arthur Oscar @Russ
                                last edited by

                                @Russ sometimes you have to put a wait after movemouse... it click and move at same time

                                1 Reply Last reply Reply Quote 0
                                • Arthur OscarA
                                  Arthur Oscar @Russ
                                  last edited by

                                  @Russ as i told before, executing the script by myself, it works fine, but when i order to trigger result scan is 0.

                                  RussR 1 Reply Last reply Reply Quote 0
                                  • RussR
                                    Russ @Arthur Oscar
                                    last edited by

                                    @Arthur-Oscar, I understand, but I can't make it work with or without TRIGGERcmd. I've tried everything. It won't click Play.

                                    Russell VanderMey

                                    Arthur OscarA 1 Reply Last reply Reply Quote 0
                                    • Arthur OscarA
                                      Arthur Oscar @Russ
                                      last edited by

                                      @Russ i noticed when i tell to triggercmd to execute cod.bat file... it doesnt blink at the screen, it executes on background or something?

                                      RussR 1 Reply Last reply Reply Quote 0
                                      • RussR
                                        Russ @Arthur Oscar
                                        last edited by Russ

                                        @Arthur-Oscar, you should add a line to your cod.bat that shows something on the screen or writes something to a log like this, so you know it's running.

                                        echo it ran >> c:\scripts\cod.log
                                        

                                        Also, make sure Ground = foreground.

                                        Russell VanderMey

                                        Arthur OscarA 2 Replies Last reply Reply Quote 0
                                        • Arthur OscarA
                                          Arthur Oscar @Russ
                                          last edited by

                                          @Russ ill do it... btw i discovered why your result was returning 0 executing manually to you. try right click on au3 file and execute script as 64bits... after that... even .exe compiled 64bits runs okay.

                                          1 Reply Last reply Reply Quote 0
                                          • Arthur OscarA
                                            Arthur Oscar @Russ
                                            last edited by

                                            @Russ
                                            Important information!!!!
                                            allmost solved problem!!!

                                            just need to run cod.exe inside SysWOW64 cmd prompt

                                            but to do this... i need edit cod.bat file

                                            cod.bat says:

                                            echo program running >> D:\alexa\cod\cod.log

                                            start "" c:\Windows\SysWOW64\cmd.exe >> D:\alexa\cod\cod.exe

                                            exit

                                            but ofc its not working yet... path is incorrect... there is any way to type the path inside the new cmd window? or... execute cmd from 64bit path directly?

                                            RussR 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post