cjetalaD Posted June 6, 2007 Share Posted June 6, 2007 (edited) Hi, I just wrote my first script in AI (Suitable acronym? ) and it is currently triggered by NumLock, and stopped by / key next to it. I was wondering if thre is a way to toggle it with Spacebar, or use Mousewheel up/down, or Mouse4/5 to trigger it? Thanks in advance Edited June 6, 2007 by cjetalaD Link to comment Share on other sites More sharing options...
poisonkiller Posted June 6, 2007 Share Posted June 6, 2007 Could you post your script please? Link to comment Share on other sites More sharing options...
cjetalaD Posted June 6, 2007 Author Share Posted June 6, 2007 (edited) expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.4.9 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here dim $num $num = 10 HotKeySet("{NUMLOCK}", "Start") Hotkeyset("{NUMPADDIV}", "Stop") HotKeySet("{NUMPADMULT}", "Close") #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $mainwindow = GUICreate("Bunnyhopper", 200, 48) GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUISetState(@SW_SHOW) While 1 Sleep(1000); Idle around WEnd Func Close() Exit EndFunc Func Start() $num = 10 Do Sleep(25) Send("{SPACE}") Until $num = 5 EndFunc Func Stop() $num = 5 EndFunc Edited June 6, 2007 by cjetalaD Link to comment Share on other sites More sharing options...
evilertoaster Posted June 6, 2007 Share Posted June 6, 2007 Hotkeyset can use a spacebar just fine. For mouse events try using mousehook by larry - http://www.autoitscript.com/forum/index.php?showtopic=23173 Link to comment Share on other sites More sharing options...
cjetalaD Posted June 6, 2007 Author Share Posted June 6, 2007 Is there anyway to toggle using spacebar? Link to comment Share on other sites More sharing options...
poisonkiller Posted June 6, 2007 Share Posted June 6, 2007 (edited) For Start() function, don't start sending {SPACE} when it's still a hotkey. Func Start() $num = 10 HotKeySet("{SPACE}") Do Sleep(25) Send("{SPACE}") Until $num = 5 HotKeySet("{SPACE}", "Start") EndFunc EDIT: Yes, HotKeySet("{SPACE}", "Start") should be it. Edited June 6, 2007 by poisonkiller Link to comment Share on other sites More sharing options...
cjetalaD Posted June 6, 2007 Author Share Posted June 6, 2007 (edited) Another quick one, I'm trying to get the value from the input box to be assigned to the speed varaible, saving me having to recompile, I've read the online help, still having trouble getting it to work though EDIT: The code, of course: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.4.9 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here dim $num dim $time $num = 10 $time = 50 ;HotKeySet("{NUMLOCK}", "Start") HotKeySet("{SPACE}", "Start") Hotkeyset("{NUMPADDIV}", "Stop") HotKeySet("{NUMPADMULT}", "Stop2") HotKeySet("{NUMPADSUB}", "Close") #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $mainwindow = GUICreate("Bunnyhopper", 180, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUICtrlCreateLabel("SpaceBar to Enable.", 30, 10) GUICtrlCreateLabel("* then \ to Disable.", 30, 25) GUICtrlCreateLabel("- to Close.", 30, 40) $input = GUICtrlCreateInput("", 30, 60) $ok = GUICtrlCreateButton("OK", 100, 58, 60) GUICtrlRead($input, 1) GUICtrlSetOnEvent($ok, "Ok") GUISetState(@SW_SHOW) Func Ok() $time = $input EndFunc While 1 Sleep(1000) ; Idle around WEnd Func Close() Exit EndFunc Func Start() $num = 10 HotKeySet("{SPACE}") Do Sleep($time) Send("{SPACE}") Until $num = 5 EndFunc Func Stop() $num = 5 HotKeySet("{SPACE}", "Start") EndFunc Func Stop2() $num = 5 EndFunc Edited June 6, 2007 by cjetalaD Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 7, 2007 Share Posted June 7, 2007 If this is where you set it -- You have to read the control: Func Ok() $time = Number(GuiCtrlRead($input)) EndFunc Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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