Sethnel99 Posted March 3, 2010 Share Posted March 3, 2010 I'm trying to write a very simple program and it just won't work! I just upgraded my laptop to Windows 7 and reinstalled autoit. My program simply runs a loop until a button is pressed. The hotkeyset function is not being called when i hit the button. It doesn't matter what button i choose or what the function does or is called, it never does anything. My program currently looks like this: dim $x = true; Func hi2u() $x = false; endFunc HotKeySet("{Esc}", "hi2u"); while($x = true); send("{RIGHT}"); send("{RIGHT}"); send("{LEFT}"); send("{LEFT}"); send("z"); sleep(100); send("z"); sleep(1000); send("z"); sleep(1000); send("z"); sleep(1000) EndIf WEnd Can anyone tell me what i'm doing wrong? I've viewed the documentation of hotkeyset and even tried copying in some code from examples. None of them work! Link to comment Share on other sites More sharing options...
Fulano Posted March 3, 2010 Share Posted March 3, 2010 Please wrap that in code tags, it'll make life that much easier for everyone. Also: It looks like your flag variable is local, and so cannot be accessed by your function. Try changing it to 'Global $x'. <rant>On a separate note, debugging will be easier if you use meaningful variable names.</rant> #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
sniper120 Posted March 4, 2010 Share Posted March 4, 2010 (edited) @ Above <rant>On a separate note, debugging will be easier if you use meaningful variable names.</rant> Yes! Another person who believes in giving meaningful names to variables! =) @Question Read the comments in your code below, I'm not going to write it for you. Judging from your code, your not very experienced... (*whisper* Yes I tabbed and cleaned the code a bit so I could read it... *whisper*) dim $x = true; Func hi2u() $x = false; endFunc HotKeySet("{Esc}", "hi2u"); while($x = true); Wow! Your a C/ C++ nub! You don't need the ";" at the end of lines! It denote comments -.- ... send("{RIGHT}"); send("{RIGHT}"); send("{LEFT}"); send("{LEFT}"); send("z"); sleep(100); send("z"); sleep(1000); send("z"); sleep(1000); send("z"); sleep(1000) EndIf ; <-- Wth? What's this? Remove it... WEnd Edited March 4, 2010 by sniper120 Link to comment Share on other sites More sharing options...
Fulano Posted March 4, 2010 Share Posted March 4, 2010 Yes! Another person who believes in giving meaningful names to variables! =)Thanks My 'side project' at work just hit 3 files and 1,444 lines. If I'd been lazy at the start I'd be hosed #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now