Alvin1991 Posted October 12, 2007 Share Posted October 12, 2007 Well, I tried searching for it, but I don't seem to find what I need, or probably I just skipped it.. x.x; I'm just wondering, how do I add a Start/Stop Command to the scrip? Erm, I'm pretty new at using this. I'm using Autoit-v3 I.E. I run the scrip, it doesn't run yet, until I press "Home"(As if I was to set this as start) Then the scrip starts running, Then when I press "End"(As if I was to set it to stop/pause) Basically, I'm trying to make it press F1 and left click. With a start/stop button. x_x' Link to comment Share on other sites More sharing options...
Zedna Posted October 12, 2007 Share Posted October 12, 2007 Welcome to AutoIt.Look here Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Alvin1991 Posted October 12, 2007 Author Share Posted October 12, 2007 Welcome to AutoIt.Look hereAh, thanks, I'll take a good look at it. Link to comment Share on other sites More sharing options...
Nahuel Posted October 12, 2007 Share Posted October 12, 2007 (edited) You'll need to take a look at "HotKeySet()" Something like this: ;Set hotkeys: HotKeySet("{home}","start") HotKeySet("{end}","stop") ;Idle around.. While 1 Sleep(25) WEnd ;Functions: Func start() MsgBox(0,"","Now your script started working!") EndFunc Func stop() MsgBox(0,"","Now your script stopped working!") EndFunc Edited October 12, 2007 by Nahuel Link to comment Share on other sites More sharing options...
Alvin1991 Posted October 13, 2007 Author Share Posted October 13, 2007 (edited) You'll need to take a look at "HotKeySet()" Something like this: ;Set hotkeys: HotKeySet("{home}","start") HotKeySet("{end}","stop") ;Idle around.. While 1 Sleep(25) WEnd ;Functions: Func start() MsgBox(0,"","Now your script started working!") EndFunc Func stop() MsgBox(0,"","Now your script stopped working!") EndFuncI did something very similar like that, but I probably had the HotKeySet part setted wrong, thanks for your example. Ok, when I insert this: HotKeySet("{home}","start") HotKeySet("{end}","stop") It always erro me, and say it is a unknown command. Edited October 13, 2007 by Alvin1991 Link to comment Share on other sites More sharing options...
Nahuel Posted October 13, 2007 Share Posted October 13, 2007 I did something very similar like that, but I probably had the HotKeySet part setted wrong, thanks for your example. Ok, when I insert this: HotKeySet("{home}","start") HotKeySet("{end}","stop") It always erro me, and say it is a unknown command. well of course: HotKeySet(Key , Function) start and stop are functions that I defined: ;Functions: Func start() MsgBox(0,"","Now your script started working!") EndFunc Func stop() MsgBox(0,"","Now your script stopped working!") EndFunc The help file has more examples and detailed information Link to comment Share on other sites More sharing options...
Alvin1991 Posted October 13, 2007 Author Share Posted October 13, 2007 Ok, I did everything right so far I think? But when I press "End"(Stop) it doesn't stop? is it suppose to be pause instead? Link to comment Share on other sites More sharing options...
Nahuel Posted October 13, 2007 Share Posted October 13, 2007 You have to put inside the start function whatever you want to do, so when you press "Home" it will call 'start()' and your script will start working. Another example: HotKeySet("{pause}","TogglePause") HotKeySet("{home}","Start") HotKeySet("{end}","Stop") Global $Paused While 1 Sleep(25) WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) WEnd EndFunc Func Start() While NOT $Paused ToolTip(@HOUR&":"&@MIN&":"&@SEC,0,0,"Current time") Sleep(1000) WEnd EndFunc Func Stop() ToolTip("bye bye!",0,0,"Current time") Sleep(1000) Exit EndFunc 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