Send to a Friend

makemo's avatar

AppleScript: get and reformat current date, then insert it in any text field?

Asked by makemo (531points) September 5th, 2008

Hi,

I’m about to create an AppleScript that can reformat the current date into a YY-MM-DD string and then insert the result in any active text field.

Here’s exactly what I want:

1. Get the current date.
2. Reformat and convert that date to a YY-MM-DD string.
3. Insert that string into a text field via System Events keystrokes.

So far, I’ve only figured out step 3:

tell application “System Events” to keystroke current_date

Step 1 is also faitly obvious, but I’m stuck in step 2 – on how to reformat the date into something less verbose.

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.