newman001 Posted June 5, 2006 Share Posted June 5, 2006 ok.. ive only quite recently learned about AutoIT.. so im still quite new... im trying to write a script that will repetedly click the left mouse button, as well as every half hour, press the "1" number key. i have the program working fine except for the pause function.. it keeps giving me error saying that: line 0 (file "c:\test.exe"): hotkeyset("{end}","") Error: Unknown Function name. i cant figure out why it says that though.. can anyone help me through it.. heres my code below: expandcollapse popupGlobal $Paused hotkeyset("{end}", "_run") hotkeyset("{home}", "_stop") HotKeySet("{del}", "_pause") while 1 sleep(1) wend func _mouseclick() while 1 MouseClick("left") sleep(10) wend EndFunc Func _keypress() while 1 send("1") sleep(30000) WEnd EndFunc Func _run() _mouseclick() _keypress() EndFunc Func _pause() $Paused = NOT $Paused While $Paused hotkeyset("{end}", "") hotkeyset("{home}", "") sleep(100) ToolTip('Script is "Paused"',0,0) WEnd hotkeyset("{end}", "_run") hotkeyset("{home}", "_stop") ToolTip("") EndFunc Func _stop() Exit ;need pause EndFunc any help will be appreciated Link to comment Share on other sites More sharing options...
newman001 Posted June 6, 2006 Author Share Posted June 6, 2006 then instead.. what should i do.. define it a variable, and while its =to 1, make it run set it to 0 would pause it...? sorry.. im still new at this, so please bare w/ me. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 6, 2006 Moderators Share Posted June 6, 2006 You set a blank as a function name in the hotkey parameter hotkeyset("{end}", "") Try removing the , '' like this:hotkeyset("{end}") Also I wouldn't put that in the loop like that because you only need to tell it once:Func _pause() $Paused = Not $Paused If $Paused Then HotKeySet("{end}") HotKeySet("{home}") While $Paused Sleep(10) ToolTip('Script is "Paused"',0,0) WEnd EndIf HotKeySet("{end}", "_run") HotKeySet("{home}", "_stop") ToolTip("") 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...
gamerman2360 Posted June 6, 2006 Share Posted June 6, 2006 (edited) HotKeySet("Key") disables a function You are specifying a null function with this: HotKeySet("Key", "") Larry just means dont unset it ten times a second in the pause Edited June 6, 2006 by gamerman2360 Link to comment Share on other sites More sharing options...
gamerman2360 Posted June 6, 2006 Share Posted June 6, 2006 You also might not want to show the tooltip that many times either. And since the loop in _mouseclick() never ends you never get to the _keypress() Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 6, 2006 Moderators Share Posted June 6, 2006 You also might not want to show the tooltip that many times either.And since the loop in _mouseclick() never ends you never get to the _keypress()Ha, I never looked at anything but the function in question, nice catch 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...
gamerman2360 Posted June 6, 2006 Share Posted June 6, 2006 (edited) You might want to look at Opt() to set the speed at which you type(wouldnt recommend making it as fast as you can), try AdlibEnable("_keypress", 30000) Another thing, a sleep time of 1ms is 1/1000 of a second. So to get 30 mins you need to take 1000ms times 60 seconds times 30 minutes. 1000*60*30... 1800000 You may find another problem with the _mouseclick() loop and the way the function is called. Edited June 6, 2006 by gamerman2360 Link to comment Share on other sites More sharing options...
newman001 Posted June 6, 2006 Author Share Posted June 6, 2006 ahh thanks so much for ur help! the script works perfectly now 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