Use Current Date to open a document with that file name

Hi, Galend.

AppleScript 1.1.3 predates even month-to-string coercions, which is why the above snippet’s erroring for you. If you use my shortDate() handler (messages 3, 8, or 16 in this thread) or my version of Kevin’s (message 12), you’ll have no problem with any AppleScript version that you may have.

Possibly not. AppleScript’s “Unicode text” was complete rubbish before OS 9. Use ‘as string’ in that case. It’s a good idea to use Unicode text for file paths with OS 9.2 or later, but ‘as string’ is is necessary with earlier systems.

Welcome back. I hope the return’s not too bruising. :wink:

:smiley:
It Works! Thanks a load. I thought this was going to be an easy short project - WRONG!

The script that finally worked is:

on ddmmyy(theDate)
	-- Get the day and year numbers.
	set {day:d, year:y} to theDate
	
	-- Get the month number using a "French Vanilla" variant.
	copy theDate to b
	set b's month to January
	set m to (b - 2500000 - theDate) div -2500000
	
	-- Combine the results into a yyyymmdd value, coerce
	-- that to string, extract and recombine the relevant bits.    
	tell (y * 10000 + m * 100 + d) as string -- (or as unicode text)
		return text 5 thru 6 & "/" & text 7 thru 8 & "/" & text 3 thru 4
	end tell
end ddmmyy

-- Set X to the shortdate string for today.
set X to ddmmyy(current date)
-- Get a path to file X in folder "2006" in folder "Calendar" on the desktop.
set Xpath to {} & "Calendar:2006:" & X

-- Open the file in AppleWorks.
set X to ddmmyy(current date)
tell application "AppleWorks"
	activate
	
	tell application "Finder"
		activate
		
		select file X of folder "2006 Calendar" of folder "Calendar" of folder "Documents" of startup disk
		open selection
	end tell
end tell



Again, thanks a bunch.
Galend