HackUser Posted June 6, 2012 Share Posted June 6, 2012 (edited) hi,so i have this script that loopand i would like to add a script into the loop but that will only run once each hour or so then continue back to other scriptany idéa ? how does ContinueLoop, ExitLoop work? Edited June 6, 2012 by HackUser Link to comment Share on other sites More sharing options...
hannes08 Posted June 6, 2012 Share Posted June 6, 2012 $tTimer = TimerInit() While 1 If TimerDiff($t) / 1000 > 60 * 60 Then $tTimer = TimerInit() ;run other code or Program EndIf WEnd Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 6, 2012 Moderators Share Posted June 6, 2012 HackUser,Welcome to the AutoIt forum. I would also look at AdlibRegister - with that function you can break into the script every hour very easily. M23P.S. Nothing personal - but with a nick like that, can you please make sure you read the Forum Rules before too long. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
HackUser Posted June 6, 2012 Author Share Posted June 6, 2012 (edited) thanks hannes08 Would you mind put that code into my script ? expandcollapse popupGlobal $Paused, $Runner HotKeySet("q" , "loggin") HotKeySet("w", "Terminate") HotKeySet("{PAUSE}", "TogglePause") While 1 Sleep(10) WEnd Func Terminate() Exit 0 EndFunc ;==>Terminate Func TogglePause() $Paused = Not $Paused While $Paused Sleep(10) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func loggin () $Runner = Not $Runner While $Runner MouseClick("left", 300, 420, 1) Sleep(4000) MouseClick("left", 700, 450, 1) Sleep(1000) MouseMove(300, 450, 1) Sleep(100) MouseWheel("down",3) Sleep(100) MouseClick("left", 300, 820, 1) Sleep(1500) WEnd EndFunc This is the script i want to happen, once each hour Send("{ESC}") MouseClick ( "left", 970, 600, 1) Sleep(13000) EDIT HackUser, Welcome to the AutoIt forum. P.S. Nothing personal - but with a nick like that, can you please make sure you read the Forum Rules before too long. thank you! my nick doesnt reflect my scripts or attentions at all, just like the name i will make sure to read the forum rules Edited June 6, 2012 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 6, 2012 Moderators Share Posted June 6, 2012 HackUser,Have you even looked at the Help file concerning that function yet? You try and put in in yourself first. M23P.S. When you post code please use Code tags - put [autoit] before and [/autoit] after your posted code. I will change the post above for you. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
HackUser Posted June 6, 2012 Author Share Posted June 6, 2012 (edited) Thank you for letting me TRY first not that im lazy, i read and look old posts in google, just that i learn best when seeing other exampels havent found one.is this close? btw 1000 > 60 * 60, meens 1 sec multiply 60, =1 minut, multiply 60 = 1hour?expandcollapse popupGlobal $Paused, $Runner HotKeySet("q" , "loggin") HotKeySet("w", "Terminate") HotKeySet("{PAUSE}", "TogglePause") While 1 Sleep(10) WEnd While 1 If TimerDiff($t) / 1000 > 60 * 60 Then $tTimer = TimerInit() Send("{ESC}") MouseClick ( "left", 970, 600, 1) Sleep(13000) EndIf WEnd Func Terminate() Exit 0 EndFunc ;==>Terminate Func TogglePause() $Paused = Not $Paused While $Paused Sleep(10) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func loggin () $tTimer = TimerInit() $Runner = Not $Runner While $Runner MouseClick("left", 300, 420, 1) Sleep(4000) MouseClick("left", 700, 450, 1) Sleep(1000) MouseMove(300, 450, 1) Sleep(100) MouseWheel("down",3) Sleep(100) MouseClick("left", 300, 820, 1) Sleep(1500) WEnd EndFunc Edited June 6, 2012 by HackUser Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 6, 2012 Moderators Share Posted June 6, 2012 HackUser, Thank you for letting me TRY firstThat is how we work here - think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers. How do you think you will ever leave the first loop? You only need the one: Global $Paused, $Runner HotKeySet("q", "loggin") HotKeySet("w", "Terminate") HotKeySet("{PAUSE}", "TogglePause") ; Initialise the timestamp $tTimer = TimerInit() While 1 ; Wait for 60 mins If TimerDiff($t) / 1000 > 60 * 60 Then ; Reinitialise the timestamp $tTimer = TimerInit() ; Run the code Send("{ESC}") MouseClick("left", 970, 600, 1) Sleep(13000) EndIf ; Prevent the CPU overheating Sleep(10) WEnd ; Rest of code M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
HackUser Posted June 6, 2012 Author Share Posted June 6, 2012 (edited) That is how we work here - think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers. My teacher said that same quote to me aswell when i went economic school Thank you for helping, i get error. might showing me the problem? edit: something with WEnd or EndFunc is wrong expandcollapse popupGlobal $Paused, $Runner HotKeySet("q", "loggin") HotKeySet("w", "Terminate") HotKeySet("{PAUSE}", "TogglePause") Func Terminate() Exit 0 EndFunc ;==>Terminate Func TogglePause() $Paused = Not $Paused While $Paused Sleep(10) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause ; Initialise the timestamp $tTimer = TimerInit() While 1 ; Wait for 60 mins If TimerDiff($t) / 1000 > 60 * 60 Then ; Reinitialise the timestamp $tTimer = TimerInit() ; Run the code Send("{ESC}") MouseClick("left", 970, 600, 1) Sleep(13000) EndIf ; Prevent the CPU overheating Sleep(10) WEnd Func loggin () $Runner = Not $Runner While $Runner MouseClick("left", 300, 420, 1) Sleep(6000) MouseClick("left", 700, 450, 1) Sleep(1000) MouseMove(300, 450, 1) Sleep(100) MouseWheel("down",3) Sleep(100) MouseClick("left", 300, 820, 1) Sleep(1500) WEnd EndFunc Edited June 6, 2012 by HackUser Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 6, 2012 Moderators Share Posted June 6, 2012 HackUser, The only error I get from that script is that you need to change the variable here: TimerDiff($t) ; Should be TimerDiff($tTimer) M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
somdcomputerguy Posted June 6, 2012 Share Posted June 6, 2012 I don't know if this is the cause of whatever error you're getting, but TimerDiff($t) should probably be TimerDiff($tTimer). - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
HackUser Posted June 6, 2012 Author Share Posted June 6, 2012 (edited) I don't know if this is the cause of whatever error you're getting, but TimerDiff($t) should probably be TimerDiff($tTimer).yes worked now.thank you both!EDIT: i will try become a good fisher Edited June 6, 2012 by HackUser Link to comment Share on other sites More sharing options...
somdcomputerguy Posted June 6, 2012 Share Posted June 6, 2012 (edited) I'm glad that your script is working for you, and that I was apparently on the same page as the illustrious M23. A modified version of that quote that I use from time to time is this, "Give a man a fish and he eats a meal, teach him to fish and he learns how to sit in a boat and drink beer" Edited June 6, 2012 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
HackUser Posted June 6, 2012 Author Share Posted June 6, 2012 (edited) Edit: fixed it with For $i = 0 to 100 Edited June 6, 2012 by HackUser 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