noob99 Posted March 12, 2008 Share Posted March 12, 2008 This is a noob question. I basically have a script that when I turn it on it does what I want it to do. But I always have to close and alt tab out and double click the icon to start it. Is there some sort of function I can add to it so I can keep the script turned on, then just hit a hotkey to start the script again? Also, is their a way to start the script from the beginning? Since I am still trying to get it to only run once, so for now I just pause it as soon as it's done and then was wondering if their is a way to make a start button that will start from the beginning again instead of where it left off. Link to comment Share on other sites More sharing options...
Achilles Posted March 12, 2008 Share Posted March 12, 2008 It really depends on the complexity of your script. If it something simple you could just make it all in one code. Somewhat like this: HotKeySet("^a", "FuncA"); Ctrl + a While 1 Sleep(100) WEnd Func FuncA() Msgbox(0, 'FuncA', 'Put whatever code you want here.') EndFuncIf it's more complex just use this but replace the Msgbox function with one that runs your script. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
digibuddha Posted March 12, 2008 Share Posted March 12, 2008 Hey noob99 I'm kind of a noob too, but use AutoIT everyday now. One way I keep a script going or "paused" while a say program runs is to have it check for a process, if it finds the process, sleep for a given amount of time, then check again. Pretty simple, but effective for what I do. Here is the code, maybe it will help. Little twist on achilles script. $pid = ProcessExists("Process of program");set to process created by installing program While ProcessExists ($pid) Sleep(5000);While the Installing program process exists script sleeps or waits if NOT ProcessExists ($pid) Then ExitLoop;Obvious if process does not exist the program continues EndIf WEnd Link to comment Share on other sites More sharing options...
noob99 Posted March 13, 2008 Author Share Posted March 13, 2008 Well all my script does is have like 10-20 clicks in certain x/y positions to do what I want it to do. However, for now I am working on how to make it only do 1 loop and not keep going and going. But my main thing is whenever I want to run it I have to alt tab and double click the script icon to make it start. I was wondering if after I double click it and have it running. Once it stops I mainly want to make a hotkey so when it stops as soon as I am ready again I can just hit the hot key and it will run the script again. So basically I want to be able to activate the script from a hotkey inside the script if possible. Link to comment Share on other sites More sharing options...
Achilles Posted March 13, 2008 Share Posted March 13, 2008 You can do what you want fairly easily. Would it be possible to post your code so that we can add it in? That would be easier then writing a whole new example... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
noob99 Posted March 13, 2008 Author Share Posted March 13, 2008 (edited) Basically, when I start it it hits a few keys and does mouse clicks for where I want it to. Then all I basically want is a way to start the script again as soon as I hit a hotkey. There is a pause in it, however usually I pause it and it didn't finish all the way so it didn't help any. expandcollapse popupHotKeySet("{END}","_exitit") HotKeySet("{PAUSE}", "_TogglePause") Global $Paused Global $mousespeed = 4 Func _exitit() exit 0 EndFunc Func _TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("Script is running") If Not WinActivate("Guild Wars") Then WinActivate("Guild Wars") EndIf Sleep(2000) EndFunc Func _mk() Send("{PGUP}") $rndnumber = Random(100, 150) Sleep($rndnumber) MouseClick("left", Random(620, 624), Random(224, 226), 1, $mousespeed) $rndnumber = Random(100, 150) Sleep($rndnumber) Send("{INSERT}") $rndnumber = Random(100, 150) Sleep($rndnumber) MouseClick("left", Random(511, 515), Random(221, 225), 1, $mousespeed) $rndnumber = Random(100, 150) Sleep($rndnumber) Send("{HOME}") $rndnumber = Random(100, 150) Sleep($rndnumber) MouseClick("left", Random(785, 795), Random(305, 315), 1, $mousespeed) $rndnumber = Random(100, 150) Sleep($rndnumber) Send("{PGDN}") $rndnumber = Random(100, 150) Sleep($rndnumber) MouseClick("left", Random(741, 743), Random(656, 658), 1, $mousespeed) $rndnumber = Random(100, 150) Sleep($rndnumber) MouseClick("left", Random(984, 1004), Random(746, 767), 1, $mousespeed) $rndnumber = Random(100, 150) Sleep($rndnumber) MouseClick("left", Random(984, 1004), Random(862, 884), 1, $mousespeed) $rndnumber = Random(100, 150) Sleep($rndnumber) MouseClick("left", Random(984, 1004), Random(979, 1000), 1, $mousespeed) $rndnumber = Random(100, 150) Sleep($rndnumber) $rndnumber = Random(900, 1100) Sleep($rndnumber) MouseClick("left", Random(1057, 1080), Random(746, 767), 1, $mousespeed) $rndnumber = Random(100, 150) Sleep($rndnumber) MouseClick("left", Random(1057, 1080), Random(862, 884), 1, $mousespeed) $rndnumber = Random(100, 150) Sleep($rndnumber) MouseClick("left", Random(1057, 1080), Random(979, 1000), 1, $mousespeed) $rndnumber = Random(100, 150) Sleep($rndnumber) MouseClick("left", Random(1238, 1264), Random(982, 1005), 1, $mousespeed) $rndnumber = Random(8000, 8100) Sleep($rndnumber) MouseClick("left", Random(1238, 1264), Random(982, 1005), 1, $mousespeed) $rndnumber = Random(8000, 8100) Sleep($rndnumber) MouseClick("left", Random(1238, 1264), Random(982, 1005), 1, $mousespeed) $rndnumber = Random(100, 200) Sleep($rndnumber) MouseClick("left", Random(1057, 1080), Random(979, 1000), 1, $mousespeed) $rndnumber = Random(200, 250) Sleep($rndnumber) Send("{PGUP}") $rndnumber = Random(200, 250) Sleep($rndnumber) MouseClick("left", Random(678, 679), Random(120, 122), 1, $mousespeed) $rndnumber = Random(7000, 7100) Sleep($rndnumber) MouseClick("left", Random(1238, 1264), Random(982, 1005), 1, $mousespeed) $rndnumber = Random(8000, 8100) Sleep($rndnumber) MouseClick("left", Random(1238, 1264), Random(982, 1005), 1, $mousespeed) $rndnumber = Random(8000, 8100) Sleep($rndnumber) MouseClick("left", Random(1238, 1264), Random(982, 1005), 1, $mousespeed) $rndnumber = Random(500, 1000) Sleep($rndnumber) EndFunc Edited March 13, 2008 by noob99 Link to comment Share on other sites More sharing options...
noob99 Posted March 14, 2008 Author Share Posted March 14, 2008 Is there a such command as like start funct_mk? If so I could just make a hot key for that one function and then it'd be fine. Link to comment Share on other sites More sharing options...
Roofel Posted March 15, 2008 Share Posted March 15, 2008 What do you really want? Couldnt understand the last reply:) In your script you already have that:) Do a HotKeySet("{Your key here}","_k") and you will have it:) Hope it helps, Roofel Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D Link to comment Share on other sites More sharing options...
Oldwilly Posted March 15, 2008 Share Posted March 15, 2008 What do you really want? Couldnt understand the last reply:)In your script you already have that:)Do a HotKeySet("{Your key here}","_mk") and you will have it:)Hope it helps, Roofellittle typo 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