milkman Posted February 14, 2006 Share Posted February 14, 2006 (edited) Im trying to make a basic autolooter. It should when you hit PageUP start hitting Z rapidly, and when you hit PageDown, it should stop hitting Z.$1=2HotKeySet("{PGDN}", "end")Func end() $1=2EndFuncHotKeySet(" {PGUP} ", "begin") Func begin() $1=1EndFuncWhile $1=1 Send ( "Z" )WEndWhen I changed it to an .exe it doesnt even open =(. EDIT: It opens really fast than closes because the script .Is there someting that says.Like if $1=2 then wait until $1=1.So while $1=2 the script does nothing and is just waiting Edited February 14, 2006 by milkman Link to comment Share on other sites More sharing options...
cdkid Posted February 14, 2006 Share Posted February 14, 2006 (edited) umm just a guess here but inside of a function if you use $1=1 then i believe it will make a new local variable ($1) and it wont edit the one outside of the function so try like global $1=2 HotKeySet("{PGDN}", "end") Func end() global $1=2 EndFunc HotKeySet(" {PGUP} ", "begin") Func begin() global $1=1 EndFunc While $1=1 Send ( "Z" ) WEnd i may be wayoff base here but i think im close ~cdkid Edited February 14, 2006 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
milkman Posted February 14, 2006 Author Share Posted February 14, 2006 Figured out it closed because the scipt ended. Is there someting that says. Like if $1=2 then wait until $1=1. So while $1=2 the script does nothing and is just waiting Link to comment Share on other sites More sharing options...
cdkid Posted February 14, 2006 Share Posted February 14, 2006 (edited) just add a While 1 Sleep(100) WEnd to the top --i think that'll do it ~cdkid Edited February 14, 2006 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
milkman Posted February 14, 2006 Author Share Posted February 14, 2006 Now it doesnt close, but neither the activation or deactivation hotkey works =( Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 14, 2006 Moderators Share Posted February 14, 2006 Global $1 = 2 HotKeySet("{PGDN}", "end") HotKeySet("{PGUP}", "begin") While 1 Sleep(100000) WEnd Func begin() $1 = 1 While $1 = 1 Send ( "Z" ) WEnd EndFunc Func end() $1 = 2 EndFunc 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. Link to comment Share on other sites More sharing options...
Oxin8 Posted February 14, 2006 Share Posted February 14, 2006 Global $1 = 2 HotKeySet("{PGDN}", "end") HotKeySet("{PGUP}", "begin") While 1 Sleep(100000) WEnd Func begin() $1 = 1 While $1 = 1 Send ( "Z" ) WEnd EndFunc Func end() $1 = 2 EndFuncautoit reads hotkeys while sleeping? ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
milkman Posted February 14, 2006 Author Share Posted February 14, 2006 I think that was the initial problem, I dont think it reads hotkeys while it sleeps. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 14, 2006 Moderators Share Posted February 14, 2006 (edited) Did you bother to run it? It does work. Edit: Here's an example... try running the Exact code rather than trying to impliment what your trying to do, then you'll see it working and go from there.Global $1 = 2 HotKeySet("{PGDN}", "end") HotKeySet("{PGUP}", "begin") While 1 Sleep(100000) WEnd Func begin() $1 = 1 While $1 = 1 ConsoleWrite('Z' & @LF) ;Send ( "Z" ) WEnd EndFunc Func end() $1 = 2 ConsoleWrite('Z Has Been Stopped') EndFunc Edited February 14, 2006 by SmOke_N 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. Link to comment Share on other sites More sharing options...
milkman Posted February 14, 2006 Author Share Posted February 14, 2006 (edited) What is the differnce between these two scripts?This doesnt workGlobal $1=2HotKeySet(" {PGUP} ", "begin") HotKeySet("{PGDN}", "end")While 1 Sleep (1000000000000)WendFunc begin() $1=1 While $1=1 Send ( "Z" ) WEndEndFuncFunc end() $1=2EndFuncThis DOES workGlobal $1 = 2HotKeySet("{PGDN}", "end")HotKeySet("{PGUP}", "begin")While 1 Sleep(100000)WEndFunc begin() $1 = 1 While $1 = 1 ConsoleWrite('Z' & @LF) ;Send ( "Z" ) WEndEndFuncFunc end() $1 = 2 ConsoleWrite('Z Has Been Stopped')EndFuncThe only thing I can find different is that smoke used console write. How is that different than send, and when should I use this?Sorry, im trying to understand.EDIT: Awww sorry It was a problem when Compiling it, it works on beta test now =) Edited February 14, 2006 by milkman 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