Jump to content

Recommended Posts

  • Moderators
Posted

lol, thats right - i can't think of anyone using the release, everyone i know uses the beta (some can't even script a simple "hello world"-script :geek:)

Guilty, Everytime I try to type that word, it comes out 'Howdy'! :o

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

  • 2 weeks later...
Posted

Others have posted different code that may do what you want.

I think the error in your original code was sending a key with the Send() functions that triggers the translation function you defined for the sent letter, which sends a different letter, triggering another translation function, etc. ad infinitum.

:o

THIS IS IT !!!! This is the reason for the error !! I did exactly the same thing and got the same error landing me here in this forum to find out what 'recursion' meant and the fix.

I used HotKeySet and the Send command in the Function to repetitivly send the same letter I set up as a HotKey and welcome to crash error>---recursion---Buh-Bye Auto-It....

I fixed it by changing the assigned HotKey's to something else. ( I used numbers instead ..) and no recursion error. :geek: Here's my code:

; This code rapidly presses specific keys faster than I'd ever be able to for a stupid little java game on arcadegamesforum.com

HotKeySet( "1" , "XandZ" ) ; Originally I used 'X' as the key

HotKeySet( "2" , "Ghee" ) ; Originally I used 'G' as the key

HotKeySet( "3" , "Ell" ) ; and so on... The function starts that letter rapidly being Send() ed

HotKeySet( "4" , "Cee" ) ; which triggered it as HotKey Being pressed to infinity causing the

HotKeySet( "5" , "ZandX" ) ; recurance error and auto-it crash--- I changed the key assignment to

HotKeySet( "q" , "Endgame" ) ; numbers and problem solved.

Do

$Loop = $Loop + 1

Until $X = 1

Func XandZ()

$X = 1

$V = 2

Do

Send( "xzxzxzxzxzxzxzxz" )

Until $X = 2

EndFunc

Func Ghee()

$Y = 1

$X = 2

Do

Send( "g" )

Until $Y = 2

EndFunc

Func Ell()

$Z = 1

$Y = 2

Do

Send( "l" )

Until $Z = 2

EndFunc

Func Cee()

$W = 1

$Z = 2

Do

Send( "c" )

Until $W = 2

EndFunc

Func ZandX()

$V = 1

$W = 2

Do

Send( "xz" )

Until $V = 2

EndFunc

Func Endgame()

Exit

EndFunc

Posted

Well I just feel like answering the recursion question - when you have a hotkey function send another hotkey, that function is then called, and it continues until the recursion level is exceeded.

In other words, an example:

Say my hotkeys all send the next letter. When I press a, it sends b, which calls the hotkey function for b (because it captures the sent b as a key press), which calls c, d, e, f... forever (or at least until AutoIt catches it and scolds you).

So, a moral: don't set a hotkey to send the key of another hotkey function.

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
×
×
  • Create New...