? about Date constant

Hello,

I have developed a simple project in Xcode in Tiger, but the app is being deployed onto Panther machines. And, I’m getting an Applescipt error <Can’t get hours of date “Friday, October 28, 2005 9:57:59 AM”. (-1728)> Here is the code that would seem to trigger the error:

set theDate to current date

set createTimeValue to (hours of theDate & “:” & minutes of theDate & “:” & seconds of theDate) as string

Oddly, this works fine on my Powerbook with Tiger (10.4.2 dev machine) but doesn’t work on a similar Powerbook running Panther (10.3.9). At first I thought that the Scripting Addition wasn’t installed on the Panther machine, but then added the Addition to the project contents, and also tried running on a G5 (Panther) with the Scripting Addition installed in the System / Library.

Any suggestions would be great.

Thanks,
Kurt

kurt fontmedia.com

Model: Powerbook
AppleScript: Xcode 2
Browser: Safari 312.3.1
Operating System: Mac OS X (10.4)

On Panther and earlier you will need to use:

set theDate to current date
set theTime to time of theDate
set createTimeValue to theTime div hours & ":" & theTime mod hours div minutes & ":" & theTime mod minutes as string

hours of, minutes of and seconds of are new to Tiger.

Or you could use:

get time string of (current date)
-- gives me "12:00:00 PM"

Without the PM part:

get text 1 thru -4 of time string of (current date)
-- gives me "12:00:00"

Works Great!

Thanks for the clarification.

Best,

Kurt