Knucklehead Posted December 20, 2009 Share Posted December 20, 2009 First of all, Hello for anyone reading this. I have been looking at the Help File and searching for a Pre-existing thread for a while now. I haven't found anything (doesn't mean it's not out there) I'm pretty tired and discouraged. I would like some help with this. I would like to cause a Function to repeat itself for... oh let's say 12 minutes before terminating and moving on to the next part of the script. AutoItSetOption("WinTitleMatchMode", 4) Global $handle = WinGetHandle("classname=SoM3cRa2Yc0De") WinWaitActive("Window Title") HotKeySet("{PGUP}", "Start") HotKeySet("{F3}","Quit") TogglePause() func Start() HotKeySet("{PGUP}") HotKeySet("{PGUP}", "TogglePause") ToolTip('Stuff is Happening',0,0) ControlSend($handle, "", "", "") ;This is what I would like to repeat for 12 minutes Sleep("somenumber") ControlSend($handle, "", "", "") Sleep("somenumber") ;This is the end EndFunc Func TogglePause() ToolTip('Stuff is Not Happening',0,0) HotKeySet("{PGUP}") HotKeySet("{PGUP}", "Start") While 1 sleep(100) WEnd EndFunc func Quit() HotKeySet("{F3}" Exit EndFunc This is a basic example script to maybe show you what I mean and give you something to tinker with, as well as making this easier for me to relate to and implement in the future. Cheers Link to comment Share on other sites More sharing options...
Authenticity Posted December 20, 2009 Share Posted December 20, 2009 (edited) Func Start() Local $iInit HotKeySet("{PGUP}") HotKeySet("{PGUP}", "TogglePause") ToolTip('Stuff is Happening',0,0) $iInit = TimerInit() Do ControlSend($handle, "", "", "") ;This is what I would like to repeat for 12 minutes Sleep(150) ; somenumber Until (TimerDiff($iInit)/60000) > 12 ; 12 minutes $iInit = TimerInit() Do ControlSend($handle, "", "", "") Sleep(150) ; This is the end Until (TimerDiff($iInit)/1000) > 30 ; 30 seconds EndFunc Edited December 20, 2009 by Authenticity Link to comment Share on other sites More sharing options...
Knucklehead Posted December 20, 2009 Author Share Posted December 20, 2009 Clever! I looked up the Timer functions AND the Do...Until Loop. I never thought to put them together... Thanks, I'll test it tomorrow. Sleep("tonight") lol Brilliant... Link to comment Share on other sites More sharing options...
Knucklehead Posted December 20, 2009 Author Share Posted December 20, 2009 Everything is ran smooth! Thank you. I really can't get over how clever that was o.0 So much to do with this Scripting Language... 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