AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FormatTime, can't get it correctly.

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Smikkel



Joined: 10 Jul 2007
Posts: 23

PostPosted: Sat Aug 18, 2007 5:12 pm    Post subject: FormatTime, can't get it correctly. Reply with quote

Hi, I'm trying to get a variable to be like this :

YYYY-MM-dd(HHhMMmsssec)

... so it would show me : 2007-08-18(18h06m46sec)

I tried using the following :

Code:
FormatTime, Writtendate,, yyyy-MM-dd(HH`hmm`mss`sec)
MsgBox, %writtendate%


But that didn't work ? What did I wrong please ?

Can you please add a working example doing this in the helpfile, right now there's nothing clear about how & which escape characters to use.

For example in the helpfile, this part :
Code:
FormatTime, TimeString
MsgBox The current time and date (time first) is %TimeString%.
will show you this : tralalalala
FormatTime, TimeString, R
MsgBox The current time and date (date first) is %TimeString%.
will show you this : tralalalala
FormatTime, TimeString,, Time
MsgBox The current time is %TimeString%.
will show you this : tralalalala
FormatTime, TimeString, T12, Time
MsgBox The current 24-hour time is %TimeString%.
will show you this : tralalalala
FormatTime, TimeString,, LongDate
MsgBox The current date (long format) is %TimeString%.
will show you this : tralalalala
FormatTime, TimeString, 20050423220133, dddd MMMM d, yyyy hh:mm:ss tt
MsgBox The specified date and time, when formatted, is %TimeString%.
will show you this : tralalalala
FormatTime, TimeString, 200504, 'Month Name': MMMM`n'Day Name': dddd
MsgBox %TimeString%
will show you this : tralalalala
FormatTime, YearWeek, 20050101, YWeek
MsgBox January 1st of 2005 is in the following ISO year and week number: %YearWeek%
will show you this : tralalalala


Adding the green parts will greatly make things clearer for the novice user.
Back to top
View user's profile Send private message
Ian



Joined: 15 Jul 2007
Posts: 1157
Location: Enterprise, Alabama

PostPosted: Sat Aug 18, 2007 5:27 pm    Post subject: Reply with quote

Code:
MsgBox, %A_YYYY%-%A_MM%-%A_DD% (%A_Hour%h%A_Min%m%A_Sec%sec)

_________________
ScriptPad/~dieom/dieom/izwian2k7/Trikster/God

Back to top
View user's profile Send private message
Smikkel



Joined: 10 Jul 2007
Posts: 23

PostPosted: Sat Aug 18, 2007 5:40 pm    Post subject: Reply with quote

Thanks a lot dieom, that worked perfectly ! Razz
So actually the line FormatTime, Writtendate,, yyyy-MM-dd(HH`hmm`mss`sec)
ain't needed anymore, great !
Back to top
View user's profile Send private message
Smikkel



Joined: 10 Jul 2007
Posts: 23

PostPosted: Sat Aug 18, 2007 5:50 pm    Post subject: Reply with quote

Just to add, I compiled the following little script
Code:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.

Timeformat = %A_YYYY%-%A_MM%-%A_DD%(%A_Hour%h%A_Min%m%A_Sec%sec)
run, regedit.exe /E J:\Boggy\Becky-settings-registry-%Timeformat%.reg "HKEY_CURRENT_USER\Software\RimArts"


a 352 bytes script, but the executable is 412 KB (!!!) (422.734 bytes) big, this is really HUGE for only 4 lines of code. Confused
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 5880

PostPosted: Sat Aug 18, 2007 6:17 pm    Post subject: Reply with quote

Smikkel wrote:
a 352 bytes script, but the executable is 412 KB (!!!) (422.734 bytes) big, this is really HUGE for only 4 lines of code. Confused


Have you deleted UPX.EXE ? Rolling Eyes
Back to top
View user's profile Send private message
Smikkel



Joined: 10 Jul 2007
Posts: 23

PostPosted: Sat Aug 18, 2007 6:25 pm    Post subject: Reply with quote

Skan wrote:

Have you deleted UPX.EXE ? Rolling Eyes

No, I didn't, it's in the "C:\Program Files\AutoHotkey\Compiler" folder. Rolling Eyes
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 5880

PostPosted: Sat Aug 18, 2007 6:27 pm    Post subject: Reply with quote

You should not be getting file size over 200K for that kind of code unless UPX.EXE is not working Rolling Eyes
Back to top
View user's profile Send private message
Smikkel



Joined: 10 Jul 2007
Posts: 23

PostPosted: Wed Aug 22, 2007 1:03 am    Post subject: Reply with quote

a 4-line script becomming 200kb, what a shame Rolling Eyes
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Wed Aug 22, 2007 5:03 am    Post subject: Reply with quote

Consider this: scripts need AutoHotkey to run. The standard AutoHotkey.exe is 233KB (it's compressed.) AutoHotkeySC.bin, which is put inside every compiled script, is 399KB (before compression.)

With the template script (304 bytes), I get a 201KB exe on lowest compression. On highest compression I get an amazing 201KB exe. Razz If I rename upx.exe, I get 399KB. Clearly if your compiled (4-line) script is that large, upx is either missing or not working.

My question is: why are you even compiling a 4-line script? FYI, you don't need to install AutoHotkey to run uncompiled scripts - you just need AutoHotkey.exe.
Back to top
View user's profile Send private message
BoBoĻ
Guest





PostPosted: Wed Aug 22, 2007 8:11 am    Post subject: Reply with quote

Quote:
Can you please add a working example doing this in the helpfile, right now there's nothing clear about how & which escape characters to use.

From the helpfile:
Quote:
Letters and numbers that you want to be transcribed literally from Format into OutputVar should be enclosed in single quotes as in this example: 'Date:' MM/dd/yy 'Time:' hh:mm:ss tt

By contrast, non-alphanumeric characters such as spaces, tabs, linefeeds (`n), slashes, colons, commas, and other punctuation do not need to be enclosed in single quotes. The exception to this is the single quote character itself: to produce it literally, use four consecutive single quotes (''''), or just two if the quote is already inside an outer pair of quotes.

So, "Wer lesen kann ist klar im Vorteil!" (AKA RTFM) Wink

FormatTime, Writtendate,, yyyy-MM-dd '(' HH 'h' mm 'm' ss 'sec)'
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group