Jump to content

Recommended Posts

Posted

HotKeySet("^!z", "Begin")
HotKeySet("^!x", "Pause")

Pause()

Func Begin()
    WinActivate ( "SwgClient" )
    Sleep ( "3000" )
      Start()
EndFunc

Func Start()
      MouseClick ( "right" , 281, 308 , 1 , 1 ) 
      Sleep ( "1000" )
      MouseClick ( "left" , 393, 245 , 1 , 1 ) 
      Sleep ( "1200" )
      MouseClick ( "right" , 281, 308 , 1 , 1 ) 
      Sleep ( "1000" )
      MouseClick ( "left" , 393, 245 , 1 , 1 ) 
      Sleep ( "1200" )
   Start()
EndFunc

Func Pause()
   Sleep ( "10000" )
    Pause()
EndFunc

Func MyExit()
    Exit
EndFunc

here is the error i recieve:

line 0 (file path here)

Sleep ( "1000" )

Error: Recursion level has been exceeded - AutoIt will quit to prevent stack overflow.

can anyone tell what the problem is? this macro is designed to run repeatedly for really long periods of time.

thanks,

Beemer

Posted (edited)

try this

HotKeySet("^!z", "Begin")
HotKeySet("^!x", "Pause")

Pause()

Func Begin()
   WinActivate ( "SwgClient" )
   Sleep ( "3000" )
   While 1
      MouseClick ( "right" , 281, 308 , 1 , 1 )
      Sleep ( "1000" )
      MouseClick ( "left" , 393, 245 , 1 , 1 )
      Sleep ( "1200" )
   Wend
EndFunc

Func Pause()
   While 1
      Sleep ( "10000" )
   Wend
EndFunc

Func MyExit()
    Exit
EndFunc
Edited by burrup

qq

Posted

ok i will try that immediately, can you give me any more details as to why that is the answer? just trying to understand the language :)

thanks,

Beemer

Posted

Hello

your problem is that your function Start() never ends :

Start() call Start() before ending but Start() call Start() again which call Start again ..... again

Posted

ok i can understand this... now with this new code how does it keep repeating itself?

If I understand (sorry , I don't speak english ... shame on me) your question is to know why the 2nd code is all right

The difference beetwen your code and Burrup's code is that your function call the same function again and again, so the system need memory for each call.

Burrup's code stays in the same function, and doesn't need more memory

Is it what you wonder ?

Posted (edited)

#define AUT_MAXEXECUTERECURSE   384             // Maximum number of times the Execute() function can recurse to itself

Hardcoded... This just gets more fun every day. :)

Edited by Smed

601DisengageEnd Program

Posted (edited)

hey, sry i coudlnt assist you, if you want ANY code to repeat to itself you use a While..Wend loop like this

While 1
;Insert Code Here
Wend

That will loop the code an infinite amount of times unless u tell it to exit or close or wateva

edit: actaullyt ill put comments in the first code

When you put something in a Function it doesnt perform the code until the function is called, in this case your functions are called until you press a designated hotkey, until then they lay dormant

HotKeySet("^!z", "Begin")
HotKeySet("^!x", "Pause")

Pause();This will "pause" your code, actaully it just repeats *nothing* over and over                   
           ;to give the imitation

Func Begin(); If u press Ctrl+Alt+Z this wil happen
   WinActivate ( "SwgClient" )
   Sleep ( "3000" )
;----------------------------------------------
   While 1; It will repeat the code  seperated an infinite amount of times
      MouseClick ( "right" , 281, 308 , 1 , 1 )
      Sleep ( "1000" )
      MouseClick ( "left" , 393, 245 , 1 , 1 )
      Sleep ( "1200" )
   Wend
;----------------------------------------------
EndFunc

Func Pause(); When you press Ctrl+Alt+X The script will be pu in an infinite loop   
                   ;again
   While 1
      Sleep ( "10000" )
   Wend
EndFunc

Func MyExit()
    Exit
EndFunc
Edited by burrup

qq

Posted

#define AUT_MAXEXECUTERECURSE   384             // Maximum number of times the Execute() function can recurse to itself

Hardcoded... This just gets more fun every day. :)

<{POST_SNAPBACK}>

Its hard-coded so AutoIt can give a soft error (Inform the user with a messagebox) instead of a hard error in which the infamous Application Crash dialog appears since if this goes unchecked, it literally crashes AutoIt.
Posted

ok off topic question... i need to make a seperate script that opens an exe file, how do i do that in v3? like an exmaple would be good.

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