 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Smikkel
Joined: 10 Jul 2007 Posts: 23
|
Posted: Sat Aug 18, 2007 5:12 pm Post subject: FormatTime, can't get it correctly. |
|
|
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 |
|
 |
Ian
Joined: 15 Jul 2007 Posts: 1157 Location: Enterprise, Alabama
|
Posted: Sat Aug 18, 2007 5:27 pm Post subject: |
|
|
| 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 |
|
 |
Smikkel
Joined: 10 Jul 2007 Posts: 23
|
Posted: Sat Aug 18, 2007 5:40 pm Post subject: |
|
|
Thanks a lot dieom, that worked perfectly !
So actually the line FormatTime, Writtendate,, yyyy-MM-dd(HH`hmm`mss`sec)
ain't needed anymore, great ! |
|
| Back to top |
|
 |
Smikkel
Joined: 10 Jul 2007 Posts: 23
|
Posted: Sat Aug 18, 2007 5:50 pm Post subject: |
|
|
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.  |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5880
|
Posted: Sat Aug 18, 2007 6:17 pm Post subject: |
|
|
| 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.  |
Have you deleted UPX.EXE ?  |
|
| Back to top |
|
 |
Smikkel
Joined: 10 Jul 2007 Posts: 23
|
Posted: Sat Aug 18, 2007 6:25 pm Post subject: |
|
|
| Skan wrote: |
Have you deleted UPX.EXE ?  |
No, I didn't, it's in the "C:\Program Files\AutoHotkey\Compiler" folder.  |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5880
|
Posted: Sat Aug 18, 2007 6:27 pm Post subject: |
|
|
You should not be getting file size over 200K for that kind of code unless UPX.EXE is not working  |
|
| Back to top |
|
 |
Smikkel
Joined: 10 Jul 2007 Posts: 23
|
Posted: Wed Aug 22, 2007 1:03 am Post subject: |
|
|
a 4-line script becomming 200kb, what a shame  |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2558 Location: Australia, Qld
|
Posted: Wed Aug 22, 2007 5:03 am Post subject: |
|
|
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. 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 |
|
 |
BoBoĻ Guest
|
Posted: Wed Aug 22, 2007 8:11 am Post subject: |
|
|
| 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)
FormatTime, Writtendate,, yyyy-MM-dd '(' HH 'h' mm 'm' ss 'sec)' |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|