DateBang 1.0
by RabidCow (rabidcow@juno.com)

Allows you to get time and date info in scripts.

Bang Commands:

!BangExec <command>
    Executes <command> with atvars replaced.


AtVars: (case sensitive!)
    ^@ta^ 0 if am, 1 if pm
    ^@th^ hour, 0-23
    ^@tH^ hour, 00-23
    ^@ti^ hour, 1-12
    ^@tI^ hour, 01-12
    ^@tl^ milliseconds, 0-999
    ^@tL^ milliseconds, 000-999
    ^@tm^ minute, 0-59
    ^@tM^ minute, 00-59
    ^@ts^ second, 0-59
    ^@tS^ second, 00-59
    ^@tt^ milliseconds since boot

    ^@Ta^ \
     ...   > same as above for UTC instead of local time
    ^@TS  /

    ^@da^ day of week, 0-6 (0=sunday)
    ^@dd^ day of month, 1-31
    ^@dD^ day of month, 01-31
    ^@de^ day of year, 1-366
    ^@dE^ day of year, 001-366
    ^@dl^ 1 if leap year, 0 if not
    ^@dm^ month, 1-12
    ^@dM^ month, 01-12
    ^@dw^ week of year, 1-53 (jan 1-7 is first week)
    ^@dW^ week of year, 01-53
    ^@dy^ 2-digit year
    ^@dY^ 4-digit year

    ^@Da^ \
     ...   > same as above for UTC instead of local time
    ^@DY^ /

    ^@#a^ apostrophe '
    ^@#c^ caret ^
    ^@#d^ dollar sign $
    ^@#n^ newline
    ^@#q^ quote "



Examples:


!DateExec !alert "^@dY^^@dM^^@dD^"
    Today this displays an alert with: 20030408



; in step.rc:
AMPM0 AM
AMPM1 PM
; bang command:
!dateexec !alert "^@ti^:^@tM^:^@tS^.^@tL^ ^@#d^AMPM^@ta^^@#d^"
    Displays a time of the form: 10:22:01.719 PM



!DateExec !Day^@da^
    Will execute !Day0 on Sunday, !Day1 on Monday, !Day2 on Tuesday, etc.

; just to confuse and infuriate you all
!DateExec ^@#d^Day^@da^^@#d^
    Will execute $Day0$ on Sunday, $Day1$ on Monday, etc.

The difference between those two is that you'll define the !DayX bangs
with a scripting module like mzscript, and with the second you define
them as single-line commands in quotes:

*script bang !Day5
*script exec !alert "Today is Friday!"
*script ~bang

Day5 "!alert 'Today is Friday!'"




If the atvars get confusing, define regular $vars$ to rename them:
year ^@dY^
month ^@dM^
day ^@dD^
!DateExec !alert "$year$$month$$day$"
but remember that those will only be valid inside !DateExec.