Sign in to follow this  
Followers 0
Diana (Cda)

_NowTime()

4 posts in this topic

I found _NowTime() in the help file but it gives the exact format seen in regional settings. Unfortunately, filenames won't take colons ":" so was hoping to change the script to give me results that will work in filenames.

;
; AutoIt v3.0
;

SoundPlay (@ScriptDir & "\WAVS\Robotz Menu Popup.wav")

#include <date.au3>
$thisday = StringMid("Sn,Mn,Tu,Wd,Th,Fr,Sa", StringInStr("SunMonTueWedThuFriSat", _DateDayOfWeek(@WDAY,1) ), 2)

ClipPut(@YEAR & '.'  & @MON & '.'  & @MDAY & '.' & $thisday & ", " & _NowTime())

Sleep(500)

Exit
; finished

This gives me this type of format in the time part: 16:47

Is there a way to get it instead to show up as 16h47, in 24-hour format with an "h" as separator instead of ":" (as per the French system)?

Thanks. :)

Share this post


Link to post
Share on other sites



I found _NowTime() in the help file but it gives the exact format seen in regional settings. Unfortunately, filenames won't take colons ":" so was hoping to change the script to give me results that will work in filenames.

;
; AutoIt v3.0
;

SoundPlay (@ScriptDir & "\WAVS\Robotz Menu Popup.wav")

#include <date.au3>
$thisday = StringMid("Sn,Mn,Tu,Wd,Th,Fr,Sa", StringInStr("SunMonTueWedThuFriSat", _DateDayOfWeek(@WDAY,1) ), 2)

ClipPut(@YEAR & '.'  & @MON & '.'  & @MDAY & '.' & $thisday & ", " & _NowTime())

Sleep(500)

Exit
; finished

This gives me this type of format in the time part: 16:47

Is there a way to get it instead to show up as 16h47, in 24-hour format with an "h" as separator instead of ":" (as per the French system)?

Thanks. :)

StringReplace("16:47",":","h")?

That's the easy way... ;)


"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

- or simply use @Hour & "h" & @Min

Oh, man, that's embarrassing. How simple. And yet I looked and looked in the help file <lol>.

Well, it's a great script now. Here is what it looks like:

;
; AutoIt v3.0
;

SoundPlay (@ScriptDir & "\WAVS\Robotz Menu Popup.wav")

#include <date.au3>
$thisday = StringMid("Sn,Mn,Tu,Wd,Th,Fr,Sa", StringInStr("SunMonTueWedThuFriSat", _DateDayOfWeek(@WDAY,1) ), 2)

ClipPut(@YEAR & '.'  & @MON & '.'  & @MDAY & '.' & $thisday & ", " & @Hour & "h" & @Min)

Exit
; finished

So whenever I need to append the date/time to any backup files I have, I used a compiled version of this script and I name files/folders with the resulting text string and this date/time format keeps them all properly sorted.

Thanks! :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0