Date & time stamp emails

I am brand new to the world of Apple Macs. Just now getting into my new Mac Pro.

One of the really neat applications that I used all the time on my PC was a calendar program that replaced the MS date/time application. I could mouse click the current date in the lower right screen of my PC & then paste the current date & time in ANY email, Word doc, spreadsheet that I wanted. The stamp was completely configurable.

I have not found anything like that on the Mac side of things so I thought an Applescript might do the job.

Can someone direct me to a script I could use or a site that I could search for that type of script?

Thank you.

Well this is sort of the same thing. Enable the Scripts Menu and place a script in the with this contents.

set d to (current date) as text
set the clipboard to d

So while your not clicking the Time/Date yourself your clicking very close to it to accomplish the same effect.

Welcome to bbs.applescript.net.

There’s an application called MenuCalendarClock that does that (approximately). It would be easy to put the current date and/or time into the clipboard from an AppleScript, but not so easy to make it user-configurable. If you’ll show us the format(s) [one or two] you’d like to have, I’m sure someone will whip something up or perhaps even has something.

James,

I copied your script into the editor & saved it in the Library/Script folder.

Do I run the script by setting up something in Automator?

Hi Adam,

Here is the format I usually use as my time stamp: Tuesday, May 15 at 02:50 PM

Here’s the one I use in YY/MM/DD hr:min:sec format which sorts correctly. [Nigel Garvey and/or Kai Edwards derived, can’t recall].


to makeStamp(Now, DelimD, DelimT) -- the first delim for date, the second for time.
	tell Now to tell 100000000 + day * 1000000 + (its month) * 10000 + year as string ¬
		to set dateStamp to text -2 thru -1 & DelimD & text 4 thru 5 & DelimD & text 2 thru 3
	tell Now to tell ((1000000 + (its hours) * 10000 + (its minutes) * 100 + (its seconds)) as string) ¬
		to set timeStamp to text 2 thru 3 & DelimT & text 4 thru 5 & DelimT & text 6 thru 7
	return dateStamp & " " & timeStamp
end makeStamp

set the clipboard to makeStamp((current date), "/", ":")
--> 07/05/17 20:09:27 will be in the clipboard

Thank you Adam. I will set up this script & save it.

How do I get the script to run?

Click the link at the top of the script box that says “Open this Script in your Script Editor” and with your permission it will automagically appear in your Script Editor. Then click compile, click run and paste somewhere. After you’ve compiled it the first time and tried it, you can save it as an Application (bottom of the save page) with none of the check boxes checked. Every time you run it (by double-clicking it or starting it from the dock), the time stamp will appear in the clipboard.

If you prefer not to have the time appended, this version just returns, eg: “2007/05/17”

-- From script by Kai Edwards
tell (current date) to tell 100000000 + day * 1000000 + (its month) * 10000 + year as string ¬
	to set D to (text -4 thru -1 & "/" & text 4 thru 5 & "/" & text 2 thru 3)
set the clipboard to D

If you want the whole enchilada, here’s Apple’s version:


set the date_stamp to ((the current date) as string)
display dialog the date_stamp buttons {"Clipboard", "OK"} default button 2
if the button returned of the result is "Clipboard" then
	set the clipboard to the date_stamp
	display dialog "The date stamp is on the clipboard." buttons {"¢"} giving up after 2 default button 1
end if

Rather than run a script application, if you poke around in /Library/Scripts or ~/Library/Scripts you’ll find a script to show the Scripts Menu in the Menu Bar (I can’t find mine), and after running this, any script you put in your user’s library/Scripts folder will appear there. By simply choosing a script, it will run for you. Probably the best way to go.

Adam,

I dragged the script into the Finder sidebar & can get it to work that way. I will look for the other script when I get a moment.

May I ask one more favor: Could you change the format to read mm/dd/yy since all my clients wouldn’t understand the yy/mm/dd.

Thanks for all your help.

I can do it In one simple line

set the clipboard to (do shell script "date -n +'%Y-%m-%d %H:%M:%S'")

want to know about the date UNIX command

set the clipboard to (do shell script "info date")

I timestamp file with

set TimeStamp to do shell script "date -n +%Y-%m-%d-%H-%M-%S"

No : thats used for folder breaks

have fun

Here’s the mm/dd/yy version:

-- From script by Kai Edwards
tell (current date) to tell 100000000 + day * 1000000 + (its month) * 10000 + year as string ¬
	to set D to (text 4 thru 5 & "/" & text 2 thru 3 & "/" & text -2 thru -1) 
	set the clipboard to D

If you want the whole year (2007) then change text -2 thru -1 to text -4 thru -1 in the second line at the end.

Adam,

Thank You! for all yur help.
I got it tweaked & saved as an application. WORKS GREAT.

Thank you I have used a variety of these posts in my mail application.
Could anyone help me modify it to my standard font: helvitica 18.
I know it is simple but then so am I.