magace Posted September 25, 2012 Posted September 25, 2012 (edited) So back when I use to mess with Javascript I use to use a tickcount to determine how much time is passed I cant seem to figure out a way to do this in autoit. What I am needing to do is start a tickcount and after x amount of seconds the script does what I want. Ex code with what I would like to happen: expandcollapse popupHotKeySet("{END}", "Terminate") Global $answer = InputBox("Question", "¿WHAT DRIVE LETTER?", "D", "", _ - 1, -1, 0, 0) While 1 ToolTip("RUNNING PRESS END TO QUIT",0,0) Local $sType = DriveGetType($answer & ":" & "") If $sType <> "" then ToolTip("FOUND DRIVE " & $answer,0,0) ;;;EX>>>>>StartTime = GetTickCount(); ;;start tickcount here ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;I NEED HELP HERE!!!!!!!!!!!!!!!!!!!!!!!!!! Local $sStatus = DriveStatus($answer & ":") If $sStatus = "ready" Then ToolTip("GOOD DRIVE",0,0) MsgBox(4096, "GOOD", "DRIVE IS GOOD",2) ToolTip("OPENING",0,0) CDTray($answer & ":","open") Else ToolTip("WAITING FOR DRIVE " & $answer &" TO READ",0,0) sleep(1000) EndIf Else ToolTip("NOT DETECTING A DRIVE IN " & $answer,0,0) SLEEP(1000) EndIf ;;;;ex> Endtime = 120000 // JS USED MILISECONDS OFC SECONDS WOULD BE FINE TOO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;I NEED HELP HERE!!!!!!!!!!!!!!!!!!!!!!!!!! ;;;;ex> If StartTime >= Endtime then ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;I NEED HELP HERE!!!!!!!!!!!!!!!!!!!!!!!!!! ToolTip("DRIVE MAY BE BAD TAKING TOO LONG TO READ/DETECT",0,0) EndIf WEnd Func Terminate() Exit 0 EndFunc Hopefully that wasn't too confusing and someone can help me out! Edited September 25, 2012 by magace
BrewManNH Posted September 25, 2012 Posted September 25, 2012 TimerInit and TimerDiff If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
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