Jump to content

func count


Recommended Posts

hello

to begin with im new to autoit ..

i have managed to make a Count stop" single function, it doesnt proced when $i <= 10

now when i added few more functions and played with it for few hours without any results, its getting obvious for me that i have missed something.

……………………………………………………………………………………………………………………………………

for example.   first func oku initiates with a pixel search.. then goes to 3 next ones that are similar to eachother . each of them searches screen for a task in progress and executes a key in different area when its ready....then it calls first function to begin all over again

how do i make a separate Count or a Count on first  function that will allow to stopwhen count 10 is reached (stop when $i = 10 )or redirect to a new function, ("goto func" when$i = 10)

 

func oku()
while 1
      $zmienna = PixelSearch(1618, 1011,1656, 1021,$color,10)
      if not IsArray ($zmienna) Then
         Sleep(Random(1000, 2000, 1))
         call("oku")
      else
           sleep(900)
   send ("{c DOWN}")
sleep(1500)
      send ("{c UP}")

    Sleep(Random(1000, 2000, 1))

      endif
 

   sleep(222)

call("left")

      WEnd

   EndFunc

…………………………………………........

func left()
while 1
$zmienna1 = PixelSearch(1618, 1011,1656, 1021,0x5F5447,10)
      if not IsArray ($zmienna1) Then
         sleep(7000)
       
call("left")
else    
mousemove(159, 462,10)
      Sleep(Random(1000, 2000, 1))
      send("3")
     call("center")

endif

WEnd
EndFunc

…...……………...…………………………..

func center()
   while 1
       $zmienna2 = PixelSearch(1618, 1011,1656, 1021,10)    

  if  not IsArray ($zmienna2) Then

         sleep(7000)call("center")

Else

      mousemove(911, 474,10)

   send("3")
   call("right")

endif
WEnd
EndFunc

……………………………………………….

func right()
   while 1
       $zmienna3 = PixelSearch(1618, 1011,1656, 1021,$color,10)
      if  not IsArray ($zmienna3) Then
         sleep(7000)
call("right")
Else

      mousemove(1797, 477,10)
     Sleep(Random(1000, 2000, 1))
      send("3")

  call("oku")
  EndIf
   WEnd

EndFunc

 

 


 

Link to comment
Share on other sites

You can count the loops with something like this, but i didn't understand if the loop is supposed to count with a valid or invalid pixelsearch, so as it is, it only counts the loop if the pixelsearch is valid.

Global $color = 0xff00ff
Global $loop = 0

oku()

Func oku()
    While 1
        If $loop = 10 Then ExitLoop
        $zmienna = PixelSearch(1618, 1011, 1656, 1021, $color, 10)
        If Not IsArray($zmienna) Then
            Sleep(Random(1000, 2000, 1))
            oku()
        Else
            Sleep(900)
            Send("{c DOWN}")
            Sleep(1500)
            Send("{c UP}")
            Sleep(Random(1000, 2000, 1))
            $loop = $loop + 1
            ConsoleWrite($loop&@CRLF)
        EndIf
        Sleep(222)
        ;left()
    WEnd
EndFunc   ;==>oku

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

thanks a lot. i tried something very similar earlier on and it didnt work . i Think its a break @CRLF  i have been missing. 

oku() left() center() right()  exitloop in oku func() makes it jam on the last right() function.. it reapets it on and on.. i have changed exitloop to call exit command  and now it works like a charm..

happy happy  :) thank you thank you

 

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...