MummyX Posted December 15, 2012 Share Posted December 15, 2012 Im trying to run a loop and want a timer to keep track of how long its running on my GUI but can't update the gui every second the same time the loop isn't the same length each time i run it so i can't just keep adding the time and do the math. Any suggestions? Link to comment Share on other sites More sharing options...
JohnOne Posted December 15, 2012 Share Posted December 15, 2012 If you want a timer in your gui you simply have to update the guicontrol. Sorry, it's just a fact. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 15, 2012 Moderators Share Posted December 15, 2012 MummyX, Welcome to the AutoIt forum. Any suggestions?Explain clearly - and with some punctuation - what it is you are trying to do because at the moment no-one has any real idea. If you are looking to time a series random length loops takes to run then something liek this might help: ; Enable an exit HotKeySet("{ESC}", "On_Exit") Func On_Exit() Exit EndFunc ; Here is the total time $iTotal_Time = 0 ; Start a loop While 1 ; Now we run a random length loop of 2 to 5 secs $iRandom = Random(2, 5, 1) ; Get a timestamp as the loop starts $iBegin = TimerInit() ; Now run the loop _Loop($iRandom) ; And get the time as it ends - converted into seconds $iLoop_Time = Int(TimerDiff($iBegin) / 1000) ; Add this to the total $iTotal_Time += $iLoop_Time ; And announce the results MsgBox(0, "Timings", "Last loop: " & $iLoop_Time & @CRLF & @CRLF & "Total: " & $iTotal_Time) WEnd ; Simulate a loop with Sleeps Func _Loop($iDelay) For $i = 1 To $iDelay Sleep(1000) Next EndFunc 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...
czardas Posted December 15, 2012 Share Posted December 15, 2012 (edited) As M23 says, you don't provide enough informaion. Here's a method (demonstration) to see how many loop iterations occur within a 10 second interval: Edited December 15, 2012 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
guinness Posted December 15, 2012 Share Posted December 15, 2012 Also a descriptive title instead of help is always a good idea too. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
MummyX Posted December 17, 2012 Author Share Posted December 17, 2012 Well I didn't rly know what to put the title since I didn't know what I was looking for. But here it goes, I have a tooltip for my script to play a game as of right now all I have on the tooltip is if the script is paused or running. I would like to add a timer to this script to either countdown or show running time and have it update every second from what i understand so far I would have to call the tooltip everytime i want to update it and i can't periodically do that with my script unless there is a way to run 2 methods at the same time. So I would like to know how to put a timer on tooltip and have it update every second with out putting my main script out of sync. Ty for you help and sry about the first post was pretty late last time and idk what i was saying. Link to comment Share on other sites More sharing options...
Bert Posted December 17, 2012 Share Posted December 17, 2012 Sorry, but anything that has to do with a game has to pass the forum rules filter. See how your question is relating to a bot of sorts, then that runs afoul of the forum rules. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 17, 2012 Moderators Share Posted December 17, 2012 MummyX,script to play a gamescullion is quite right - please read the Forum Rules - particularly the bit about not discussing game automation or interaction - before you post again. Thread locked. 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...
Recommended Posts