Jump to content

Search the Community

Showing results for tags 'time'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • Forum
  • AutoIt


  • Community Calendar

Found 34 results

  1. I've been looking through some different functions(not sure if that's the right word) to get the Date and time and I can't find one that doesn't include "/ " or ":" in what is returned. I'm trying to create a file name with this format "QuickConfig_MMDDYYYY_HHMM" (doesn't matter if 24 or 12hr format) #include <Date.au3> Func _SaveConfig MouseClick('primary',155, 46, 1, 0) ;clicks save as WinWait('Save bluePRINT Configuration As...','', 4) MouseClick('primary',632, 47, 1, 0) ;clicks the file path bar $Documents = @MyDocumentsDir $FilePath = $Documents & '\BP3 Configs' Send($FilePath) Send('{ENTER}') MouseClick('primary',166, 580, 1, 0) ;clicks file name bar $FileName = 'QuickConfig_' & _NowDate & '_' & _NowTime Send($FileName) Send('{ENTER}') EndFunc I'm wondering if there is a function somewhere to do this?
  2. hello please i need to link a progress bar with a time can you help me? e.g i want to set a progress bar for 10 sec am waiting for your answers thank you.
  3. Hello all! I use Autoit for a while, already made some automation for a TV station's master control room with it. I made a UDF to easily work with PAL timecode and time with milliseconds, convert, add or subtract them. Feel free to use it if you want something like this #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Description=PAL Timecode Calculator UDF #AutoIt3Wrapper_Res_LegalCopyright=horvath.imre@gmail.com #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; ; #FUNCTION# ; Name...........: _tcAdd ; Description....: Returns addition of two timecodes ; Syntax.........: _tcAdd($fTc1, fTc2 [, $fFormat = "P"]) ; ; Parameters.....: $fTc1 - First timecode in hh:mm:ss.ff format ; $fTc2 - Second timecode in hh:mm:ss.ff format ; $fFormat - Time base - "P" (default): PAL (25 fps) ; "M" : millisecond ; ; Return value...: Sum of the two timecode in the selected format Func _tcAdd($fTc1, $fTc2, $fFormat = "P", $fHourFormat = 1) Local $fMs1 = _tcToMs($fTc1) Local $fMs2 = _tcToMs($fTc2) Local $fSumMs = $fMs1 + $fMs2 Return _msToTc($fSumMs, $fFormat, $fHourFormat) EndFunc ; #FUNCTION# ; Name...........: _tcsSub ; Description....: Returns addition of two timecodes ; Syntax.........: _tcSub($fTc1, fTc2 [, $fFormat = "P"]) ; ; Parameters.....: $fTc1 - First timecode in hh:mm:ss.ff format ; $fTc2 - Second timecode in hh:mm:ss.ff format ; $fFormat - Time base - "P" (default): PAL (25 fps) ; "M" : millisecond ; ; Return value...: Subtract $fTc2 from $fTc1 in the source format Func _tcSub($fTc1, $fTc2, $fFormat = "P") Local $fMs1 = _tcToMs($fTc1) Local $fMs2 = _tcToMs($fTc2) Local $fSumMs = $fMs1 - $fMs2 If $fSumMs < 0 Then $fSumMs = _tcToMs("24:00:00.00") - ($fSumMs * -1) EndIf Return _msToTc($fSumMs, $fFormat) EndFunc ; #FUNCTION# ; Name...........: _tcToMs ; Description....: Returns timecode converted to total milliseconds ; Syntax.........: _tcToMs($fTc) ; ; Parameters.....: $fTc - Timecode in hh:mm:ss.ff or hh:mm:ss:xxx format, where xxx are milliseconds ; ; Return value...: Milliseconds as an integer value Func _tcToMs($fTc) Local $fTemp = StringSplit($fTc, ":.") Local $fChr = StringLen($fTemp[4]) Switch $fChr Case 2 Return ($fTemp[4] * 40) + ($fTemp[3] * 1000) + ($fTemp[2] * 60000) + ($fTemp[1] * 3600000) Case 3 Return ($fTemp[4]) + ($fTemp[3] * 1000) + ($fTemp[2] * 60000) + ($fTemp[1] * 3600000) EndSwitch EndFunc ; #FUNCTION# ; Name...........: _msToTc ; Description....: Converts total milliseconds to timecode ; Syntax.........: _msToTc($fIn, $fFormat = "P", $fHourFormat = 1) ; ; Parameters.....: $fIn - Time in milliseconds ; $fFormat - Output format "P": PAL TC (default) ; "M": hh:mm:ss.xxx where xxx are milliseconds ; $fHourFormat - Hour format "1": max. value is 23, then starts from 0 (default) ; "0": hours can be more then 23 ; ; Return value...: Timecode as string in the selected format Func _msToTc($fIn, $fFormat = "P", $fHourFormat = 1) Switch $fFormat Case "P" Local $fFr = StringFormat("%02i", (StringRight($fIn, 3) - Mod(StringRight($fIn, 3), 40)) / 40) Case "M" Local $fFr = StringFormat("%03i", StringRight($fIn, 3)) EndSwitch $fIn = StringTrimRight($fIn, 3) Local $fSec = StringFormat("%02i", Mod($fIn, 60)) $fIn -= $fSec Local $fMinTot = $fIn / 60 Local $fMin = StringFormat("%02i", Mod($fMinTot, 60)) $fIn -= $fMin*60 Local $fHourTot = $fIn / 60 / 60 Switch $fHourFormat Case 1 $fHour = StringFormat("%02i", Mod($fHourTot, 24)) Case 0 $fHour = StringFormat("%02i", $fHourTot) EndSwitch Return($fHour & ":" & $fMin & ":" & $fSec & "." & $fFr) EndFunc ; #FUNCTION# ; Name...........: _tcFormatChange ; Description....: Toggle TC format ; Syntax.........: _tcFormatChange($fTc) ; ; Parameters.....: $fTc - Timecode in hh:mm:ss.ff or hh:mm:ss:xxx format, where xxx are milliseconds ; ; Return value...: PAL timecode or time with milliseconds as string, depends on input Func _tcFormatChange($fTc) Local $fTemp = StringSplit($fTc, ":.") Local $fChr = StringLen($fTemp[4]) Switch $fChr Case 2 Return $fTemp[1]&":"&$fTemp[2]&":"&$fTemp[3]&"."&StringFormat("%03i", $fTemp[4]*40) Case 3 Return $fTemp[1]&":"&$fTemp[2]&":"&$fTemp[3]&"."&StringFormat("%02i", ($fTemp[4]-Mod($fTemp[4], 40))/40) EndSwitch EndFunc And the example script: #include<_PAL_TC_Calc.au3> $palTC1 = "00:01:12.20" $palTC2 = "23:59:50.02" $msTC1 = "00:01:12.800" $msTC2 = "23:59:50.120" MsgBox(0, "1", _tcAdd($palTC1, $palTC2)); Adds $palTC1 to $palTC2, turns hour back to 0 after 23, returns PAL TC format MsgBox(0, "2", _tcAdd($palTC1, $palTC2, "M")); Adds $palTC1 to $palTC2, turns hour back to 0 after 23, returns time with milliseconds format MsgBox(0, "3", _tcAdd($palTC1, $palTC2, "M", 0)); Adds $palTC1 to $palTC2, hours can be infinite, returns time with milliseconds format MsgBox(0, "4", _tcAdd($msTC1, $msTC2)); Adds $palTC1 to $palTC2, turns hour back to 0 after 23, returns PAL TC format MsgBox(0, "5", _tcAdd($msTC1, $msTC2, "M")); Adds $palTC1 to $palTC2, turns hour back to 0 after 23, returns time with milliseconds format MsgBox(0, "6", _tcAdd($msTC1, $msTC2, "M", 0)); Adds $palTC1 to $palTC2, hours can be infinite, returns time with milliseconds format MsgBox(0, "7", _tcSub($palTC2, $palTC1)); Subtract $palTC1 from $palTC2, returns PAL TC format MsgBox(0, "8", _tcSub($palTC2, $palTC1, "M")); Subtract $palTC1 from $palTC2, time with milliseconds format MsgBox(0, "9", _tcSub($msTC1, $msTC2)); Subtract $palTC1 from $palTC2, returns PAL TC format - when hits zero, counts back from 24:00:00.00 MsgBox(0, "10", _tcSub($msTC1, $msTC2, "M")); Subtract $palTC1 from $palTC2, time with milliseconds format - when hits zero, counts back from 24:00:00.000 MsgBox(0, "11", _tcFormatChange($palTC2)); Convert PAL TC to time with milliseconds and back MsgBox(0, "12", _tcFormatChange($msTC2)); Convert PAL TC to time with milliseconds and back TC_CALC_example.au3 _PAL_TC_Calc.au3
  4. Hi, I created a gui with date field but formatted as time in HH:mm. It always shows "now-time". Even if I try to set it with GUICtrlSetData. #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("My GUI get date", 200, 200, 800, 200) Local $idDate = GUICtrlCreateDate("", 20, 20, 100, 20, $DTS_TIMEFORMAT) ; to select a specific default format Local $sStyle = "HH:mm" ; Just display hours and minutes <<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle) ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUICtrlSetData($idDate, "00:00") ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUISetState(@SW_SHOW) ; Loop until the user exits. While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd MsgBox($MB_SYSTEMMODAL, "Time", GUICtrlRead($idDate)) EndFunc ;==>Example How can I set the time field with another time and how can this field be set blank? Regards, Conrad
  5. Hi guys I need to get time of different city, London, Jerusalem, Mosca and many others. My starting script: #include <Date.au3> Local $iUTC, $iHour, $iMinute, $iSecond $iUTC = _Date_Time_GetSystemTime() $iHour = DllStructGetData($iUTC, "Hour") $iMinute = DllStructGetData($iUTC, "Minute") $iSecond = DllStructGetData($iUTC, "Second") ConsoleWrite("+UTC: " & $iHour & ":" & $iMinute & ":" & $iSecond & @CRLF) My idea was start from UTC time and then add-remove hours. But what about the DST, Daylight Savings Time? How i can know if in a country is active or not? There is an API? Example with _Date_Time_GetTimeZoneInformation it will give the current time zone settings and not for other time zone. I don't have understand if is possible or not On the help i have found SystemTimeToTzSpecificLocalTime but i don't have understand how to use for other time zone... Thanks
  6. To get the current time stamp, I got the below code. #include <Date.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #RequireAdmin ; Under Vista the Windows API "SetSystemTime" may be rejected due to system security $td = _Date_Time_GetSystemTime() $td = _Date_Time_SystemTimeToDateTimeStr($td) $td = StringReplace($td, " ", "_") $td = StringReplace($td, ":", "_") MsgBox(0,"",$td) But it is not giving the date or time of the timezone where the system is there. Please suggestt
  7. Hi, I wanted to use _GetLogonTime() by guinness (https://www.autoitscript.com/forum/topic/19370-autoit-wrappers/?do=findComment&comment=942069). #include <Date.au3> #include <Array.au3> ConsoleWrite(_GetLogonTime() & @LF) Func _GetLogonTime($sUserName = @UserName, $sComputerName = @ComputerName) ; Idea by trancexx: http://www.autoitscript.com/forum/topic/113611-if-isadmin-not-detected-as-admin/ Local $aRet = DllCall("netapi32.dll", "long", "NetUserGetInfo", "wstr", $sComputerName, "wstr", $sUserName, "dword", 11, "ptr*", 0) _ArrayDisplay($aRet) If @error Or $aRet[0] Then Return SetError(1, 0, False) Local $sHours = DllStructGetData(DllStructCreate("ptr;ptr;ptr;ptr;dword;dword;dword;ptr;ptr;dword;dword;dword;dword;ptr;dword;ptr;dword;dword;byte;dword", $aRet[4]), 18) DllCall("netapi32.dll", "long", "NetApiBufferFree", "ptr", $aRet[4]) Return _DateAdd("h", "-" & $sHours, _NowCalc()) EndFunc ;==>_GetLogonTime It always returns false. I displayed $aRet: [0]|2221 [1]|mycomputer [2]|myuser [3]|11 [4]|0x0000000000000000 $aRet[4] shouldn't be 0x0000000000000000 right? Any help? Regards, Conrad
  8. Hello. I have 5 DCs, and I need to create a scheduled task to run a script that will test the authentication time for each one of them, once every minute. (Then I'll use it within a log analyser to create graphics). I came up with a script using the great AD UDF (by water). First I tried using "for" and an array, but something was messing up the results, then I went for the dumb old fashioned way: #Include <ad.au3> #include <MsgBoxConstants.au3> Global $AdTestTime = "" Global $Timer1, $Timer2, $Timer3, $Timer4, $Timer5 = "" Global $sAD1 = "MYSERVER109" Global $sAD2 = "MYSERVER110" Global $sAD3 = "MYSERVER111" Global $sAD4 = "MYSERVER112" Global $sAD5 = "MYSERVER113" $Timer1 = Timerinit() _AD_Open("", "", $sAD1) _AD_Close() Local $fDiff1 = TimerDiff($Timer1) $Timer2 = Timerinit() _AD_Open("", "", $sAD2) _AD_Close() Local $fDiff2 = TimerDiff($Timer2) $Timer3 = Timerinit() _AD_Open("", "", $sAD3) _AD_Close() Local $fDiff3 = TimerDiff($Timer3) $Timer4 = Timerinit() _AD_Open("", "", $sAD4) _AD_Close() Local $fDiff4 = TimerDiff($Timer4) $Timer5 = Timerinit() _AD_Open("", "", $sAD5) _AD_Close() Local $fDiff5 = TimerDiff($Timer5) MsgBox(0,"", "MYSERVER109=" & $fDiff1) MsgBox(0,"", "MYSERVER110=" & $fDiff2) MsgBox(0,"", "MYSERVER111=" & $fDiff3) MsgBox(0,"", "MYSERVER112=" & $fDiff4) MsgBox(0,"", "MYSERVER113=" & $fDiff5) Still, something is off here. The first AD to be tested is always the slowest one, by far, like 20 times slower. Then I started to suspect that the first one starts the "negotiation", and the following ones ride the gravy train. If I repeat the first code twice, All servers seem to have a similar result. $Timer1 = Timerinit() _AD_Open("", "", $sAD1) _AD_Close() Local $fDiff1 = TimerDiff($Timer1) $Timer1 = Timerinit() _AD_Open("", "", $sAD1) _AD_Close() Local $fDiff1 = TimerDiff($Timer1) $Timer2.... Am I right? Also, is there a better way to test the authentication time? Thanks for the help. - Dave
  9. I have another AutoIT script making a Log file Sample of Log file: 2016/08/22 12:44:18 > Process: [RUNNING] [ACTIVE] 2016/08/22 12:48:35 > Process: [WAS NOT RUNNING] 2016/08/22 13:40:00 > Process: [FAILED] 2016/08/22 14:01:10 > Process: [WAS NOT RUNNING] I am looping through the Log file for the word "FAILED" I then want to get all lines that have "FAILED" and get their TIME My Current code to get this far: If FileExists($fileLog) Then $contents = FileRead($fileLog) If @error Then MsgBox(0, 'File Error', $fileLog & ' could not be read.') Else For $i = 1 To _FileCountLines($fileLog) $result = StringInStr($contents,$search) If $result >= 1 Then $filteredLine = FileReadLine($fileLog,$i) If StringInStr($filteredLine,$search) Then ConsoleWrite($filteredLine & @CRLF) ; this gets me the results I want sans the time parse EndIf Else ConsoleWrite( $search & " not found!" & @CRLF) EndIf Next EndIf EndIf For this part: If StringInStr($filteredLine,$search) Then ConsoleWrite($filteredLine & @CRLF) ; this gets me the results I want sans the time parse EndIf OUTPUT: 2016/08/22 13:40:00 > Process: [FAILED] I dont understand how I read the time in that output? I have tried _DateTimeFormat - Dont think this applies Tried _DateDiff - I dont have a the date yet so this doesnt work Would love if someone could tell me if I am thinking is the wrong direction and possibly lead me down the correct path to light side of the force
  10. I've created a simple script that opens the Snipping Tool; Selects the "Full Screen Snip" option; then closes the program, prompting a save. What I can't figure is how to name the file using the system date and time. Can anyone help? Run(@WindowsDir & '\system32\SnippingTool.exe') AutoItSetOption('MouseCoordMode', 0) Sleep(1) $hWnd= WinWait("Snipping Tool", "ToolBarWindow32", 1) WinActive($hWnd) MouseClick('primary', 84, 48, 1, 0) MouseClick('primary', 84, 140, 1, 0) WinClose("[Class:Microsoft-Windows-Tablet-SnipperEditor]") ControlClick("Snipping Tool", "", "Button1")
  11. Hi there all - how can I find out if $now is between 2pm to 2am and if so run a function - any help will be most welcomed!
  12. Hey I've these two functions to do a base64 conversation , Is there any way to compare the exact speed of both of them ? Func _Base64Encode($input) $input = Binary($input) Local $struct = DllStructCreate("byte[" & BinaryLen($input) & "]") DllStructSetData($struct, 1, $input) Local $strc = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", 0, _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") ; error calculating the length of the buffer needed EndIf Local $a = DllStructCreate("char[" & DllStructGetData($strc, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(2, 0, ""); error encoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>_Base64Encode Func _Base64Encode($sData) Local $oXml = ObjCreate("Msxml2.DOMDocument") If Not IsObj($oXml) Then SetError(1, 1, 0) EndIf Local $oElement = $oXml.createElement("b64") If Not IsObj($oElement) Then SetError(2, 2, 0) EndIf $oElement.dataType = "bin.base64" $oElement.nodeTypedValue = Binary($sData) Local $sReturn = $oElement.Text If StringLen($sReturn) = 0 Then SetError(3, 3, 0) EndIf Return $sReturn EndFunc ;==>_Base64Encode
  13. All I'm after is a script that will continuously check the time, and if a process starts before 5:00, then it will be killed straight away, if its after 5:00, then it is allowed to run. But on weekends the process is allowed to run at any time. A script that I could just modify to my needs would be nice, but if someone could point me to the Help File section that will do what I need, that would be better.
  14. I got a while loop, if something happens the while loop shall stop, but shall continue after a specific time like lets say 10 minutes, how would you manage this.
  15. I'm using ftp functions but the modification time always have 0 seconds. Is it how it should work? I checked in FileZilla and it returns seconds.
  16. Hi all, I am try to find a way of getting the time in any other country. I have been searching the autoit forum for a solution, searching 'Date' UDF & looking at scripts using NTP servers however have hit a wall on where to start scripting, anyone point me in the right direction here? Thanks Chris
  17. #include <IE.au3> Local $oIE Sleep Local $oFrame Local $oDiv For If EndIf NextThis is my code and i'd like to repeat the action of clicking a button by its classname every 3 seconds.... i get this done only once and after the first time it doesn't repeat itself. Should i insert a continue loop, and if so how can i relate it to my code because i haven't found nothing in help file or example scripts....
  18. Hello all.. I am trying to convert Active Directory computer account last used date to a readable format. I have some functions that will do this, but they use the following command to perform the command: w32tm /ntte <NT time epoch> Convert a NT system time, in (10^-7)s intervals from 0h 1-Jan 1601, into a readable format. This is super slow when dealing with thousands of records. Here is what I have so far... #include <array.au3> #include <DateTimeConvert.au3> #include <Date.au3> $exampleADTimeStamp = "130793861794571914" Msgbox(0,"MyResult", "Timestamp: " & $exampleADTimeStamp & @crlf & "Days since last Login: " & DateStringToDaysSinceLastLogin($exampleADTimeStamp)) Func DateStringToDaysSinceLastLogin($Timestamp) $ParseOutput = ParseLL($Timestamp) $ParseOutput = StringSplit($ParseOutput, " ", 2) $newFinal = _DateStandardToCalcDate($ParseOutput[0]) Return Abs(CompareD($newFinal)) EndFunc ;==>DateStringToDaysSinceLastLogin Func ParseLL($oLastLogon) $sOutput = "" $iPID = Run(@ComSpec & " /c " & "w32tm.exe /ntte " & $oLastLogon, @TempDir, @SW_HIDE, 2) While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd $sOutput = StringSplit($sOutput, " - ", 2 + 1) Return $sOutput[1] EndFunc ;==>ParseLL Func CompareD($Datez) Return _DateDiff("D", @YEAR & "/" & @MON & "/" & @MDAY, $Datez) EndFunc ;==>CompareD I'm sure there has got to be a better way to calculate this date format without having to use a command line tool, but after searching the forums, I haven't found anything.. Does anyone have any thoughts? Thanks in advance!!!
  19. Hi all and thank you for your help. I have been working on a log-out for a gui and some times this code will not work. How do I get past AM and PM? Edit 1 Ok i think I have it. Thanks Valuater https://www.autoitscript.com/wiki/Snippets_(_Time_%26_Date_) Edit 2 Still not there... Please help. #include <ButtonConstants.au3> #include <DateTimeConstants.au3> #include <date.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Time Machine", 252, 117, 2421, 445) GUISetBkColor(0xA6CAF0) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Checkbox1 = GUICtrlCreateCheckbox("Exit GUI ", 24, 24, 105, 25) $Date1 = GUICtrlCreateDate(" ", 136, 24, 98, 24, $DTS_TIMEFORMAT) $Label1 = GUICtrlCreateLabel("00:00:00 ", 136, 72, 93, 20) GUIctrlSetData($Label1, _Time()) $Button1 = GUICtrlCreateButton("Start", 24, 72, 75, 25) GUICtrlSetOnEvent($Button1, "_Func_1") $Button2 = GUICtrlCreateButton("Stop", 24, 72, 75, 25) GUICtrlSetOnEvent($Button2, "_Func_2") GUICtrlSetState($Button2, $GUI_HIDE) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_COMMAND_STOP") Global $stop = 0; set exitloop flag While 1 Sleep(100) WEnd Func _Func_1() GUICtrlSetState($Button1, $GUI_HIDE); Hide and show start and stop GUICtrlSetState($Button2, $GUI_SHOW) While 1 Sleep(1000) If $stop <> 0 Then ; set exitloop Return EndIf If _IsChecked($Checkbox1) Then; check for checkbox to exit Local $set = GUICtrlRead($Date1) Local $tm = _Time() If $set < $tm Then Exit EndIf EndIf GUICtrlSetData($Label1, $tm ); set lable time WEnd EndFunc ;==>_Func_1 Func _Time() Local $hour = @HOUR, $AMPM = "AM" If $hour > 11 Then $AMPM = "PM" If $hour = 0 Then $hour = 12 If $hour > 12 Then $hour -= 12 Return $hour & ":" & @MIN & ":" & @SEC & " " & $AMPM EndFunc ;==>_Time Func _Func_2();====================================== Set button 1 to show and hide button 2 GUICtrlSetState($Button2, $GUI_HIDE) GUICtrlSetState($Button1, $GUI_SHOW) $stop = 0 EndFunc ;==>_Func_2 Func _IsChecked($idControlID);===================== Look for Checkbox ====================== Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func _COMMAND_STOP($hWnd, $Msg, $wParam, $lParam); Set $Interrupt to stop loop If BitAND($wParam, 0x0000FFFF) = $Button2 Then $stop = 1 Return $GUI_RUNDEFMSG EndFunc ;==> _COMMAND_STOP Func _Exit() Exit EndFunc ;==>_Exit  
  20. i can find how to do the opposite but i want to take 00:00:22.17 and put into milliseconds which would be 22017 ?? or no seems like it should be super simple but not finding it anywhere. i get a bunch of audio files with that time stamp and i and i want to to convert to milliseconds thanks!
  21. Hi All, I've run into an issue in one of my scripts using the GUICtrlCreateDate function with the $DTS_TIMEFORMAT flag. Basically, after the creation of the Date tool, I seem to be unable to set the data in the box; And after reading the function reference for GuiCtrlSetData, This does seem to be something that's supported... So i'm a little lost as to where exactly i'm going wrong. I've created a quick test script, and still can't get the two functions to work harmoniously: local $GUI = GuiCreate("",100,40) local $testDate = GUICtrlCreateDate("",15,10,70,20,9,-1) local $test = GUIctrlSetData(-1,"09:00:00") ConsoleWrite($test & @CR) GUIsetState(@SW_SHOW) While 1 switch GUIgetMsg() Case -3 Exit EndSwitch WEnd Theoretically, the date input should show 09:00:00, But the GUIctrlSetData seems to be failing (returning 0). I've checked the format of the Date input by using GUIctrlRead, and have adhered to that format in the test above, but it still seems to be failing. Any Ideas? Any help is greatly appreciated! Many Thanks Javi
  22. Hi all! I am perplexed by something that should be simple. I am trying to make a small timer which will become part of a larger script, but I'm stuck on comparing the 2 times.. When you run the script, you hit OK on a message box, that's when the current system time and day of the year is saved to a variable.. when you hit OK again, the timer is stopped and the date and time are compared. I'm not using Timerinit() because I want the exact system time the timer started, and the exact system time the timer stopped. Then the time is compared and you get the difference. This is easy as long as I am subtracting 10 seconds from 15 seconds, but what if the start timeer got second: 45 and the top timer got second: 12? I'm sure this is cakewalk for anyone that got higher than a C in math, but I didnt. Can anyone shed some light on this for a simpleton like myself? Msgbox(0,"START","Click to start timer") $a = timestamp() Msgbox(0,"START","Click to stop timer") $b = timestamp() compare($a,$b) Func timestamp() Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort') DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime)) $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8)) $stSystemTime = 0 return @YDay & ':' & @Hour & ':' & @Min & ':' & @Sec & ':' & $sMilliSeconds EndFunc Func compare($start,$stop) $Comp_a = StringSplit($start,":",2) $Comp_b = StringSplit($stop,":",2) $DayDif = $comp_b[0] - $comp_a[0] $HourDif = $comp_b[1] - $comp_a[1] $MinDif = $comp_b[2] - $comp_a[2] $SecDif = $comp_b[3] - $comp_a[3] If $comp_b[4] > $comp_a[4] then $MSecDif = $comp_b[4] - $comp_a[4] else $MSecDif = $comp_a[4] - $comp_b[4] endif Msgbox(0,"hey you, yeah you!", "Elapse Time:" & @CRLF & "Days: " & $DayDif & @CRLF & "Hours: " & $HourDif & @CRLF & "Minutes: " & $MinDif & @CRLF & "Seconds: " & $SecDif & @CRLF & "Miliseconds: " & $MSecDif ) endfunc Thanks in advance!! EDIT: Would this logic work? ;example $start = 45 $stop = 12 $val1 = $Start - 60 ; val1 becomes 15 $Mydiff = $stop + $val1
  23. I am currently working on a project in which I have to find timestamps in multiple formated patterns. The idea is to search time stamps in log files. If successful _GetDateInString() will returns a timestamp in YYYY/MM/DD hh:mm:ss Example: _GetDateInString("...Process Last Run 17 JUN at 05:15...", "DD Mon at hh:mm") will return 2014/06/17 05:15:00 Formats tested: - DDMonYY hh:mm:ss (matches dates like 30May14 03:59:59) - DD Mon YYYY hh:mm - Mon, DD YYYY hh:mm:ss - Mon, D YYYY hh:mm:ss - DD Mon at hh:mm - DMonYY hh:mm:ss - DMon hh:mm:ss - DD/MM/YYYY hh:mm - DD-MM-YYYY hh:mm - DDMMYYYY hh:mm - DD/MM hh:mm - MM.DD.YYYY hh:mm - YYYYDDMM hh:mm - YYYYMMDD - hh:mm - DD.MM hh:mm - D/M/YYYY hh:mm - D.M.YYYY hh:mm - M.D.YY h:mm:ss - M.D.YY hh:mm - M.D.YY hh:mm - M.D.YYYY h:mm:ss - M.D.YYYY h:mm:ss - M.D at h:mm:ss and many other formats... udf with examples: _GetDateInString GreenCan
  24. Date and time GUI bug?

    Hey guys... not a vital issue or anything, but I've setup the format of date and time in a user input field (code included below), but the output is off on the second field and I can't figure where it's getting it from.... the code displayed is the only place in the program that modifies these fields: $StartDate = GUICtrlCreateDate(@Year&"/"&@MON&"/"&@MDAY&" "&@HOUR&":00", 8, 112, 138, 21) ; to select a specific default format $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "yyyy/MM/dd HH:mm" GUICtrlSendMsg($StartDate, $DTM_SETFORMAT_, 0, $style) $EndDate = GUICtrlCreateDate(@Year&"/"&@MON&"/"&@MDAY+1&" "&@HOUR&":00", 8, 152, 138, 21) $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "yyyy/MM/dd HH:mm" GUICtrlSendMsg($EndDate, $DTM_SETFORMAT_, 0, $style) The outputs are: Startdate: 2014/04/04 17:00 (good so far) EndDate: 2014/04/05 07:25 (Where did 07:25 come from? FYI 25 is the current Minute time of the test, but the 07Hour is not. Current hour is 17:00) Both fields have almost exactly the same code and syntax with endDate being incrimented by 1. Nowhere else in my script am I making any modifications to either field, just read. Thanks for your help
  25. hello everybody, i need your help please it a simple script , i want to run a message box in the next day from this day. example: - i took the current day as refernce - add one day to it -make a condition to see if it is the new day - if it is true run a message box this is my code nee some help thank you in advance there is one small problem which is the CPU when i run my code it is 100/100 need to low it