Newbies Kearney Adams Posted September 26, 2007 Newbies Posted September 26, 2007 I'm having trouble getting a date from iTunes into Filemaker using applescript. After running the script, the applescript says object or property is of the wrong type. Here's the line of applescript sent within the tell block to iTunes to extract the date: "set last_played to played date of track 1" Here's the line of applescript used to set the cell in Filemaker: "set cell "Last Played" of record 1 to last_played" I've even changed the field type to timestamp and that didn't work either. Does anybody know what I'm doing wrong?
Fenton Posted September 26, 2007 Posted September 26, 2007 (edited) An AppleScript date is a timestamp, but it's not a FileMaker syntax timestamp. So you have to convert it. To see an AppleScript date, run in Script Editor: current date -- date "Wednesday, September 26, 2007 3:20:41 PM" Yes, it's a timestamp, but kind of "verbose." A FileMaker timestamp does not use text words in the date, or lead with the day of the week. I wrote this subroutine to convert to a FileMaker TS. You would use it like this. This is an extract from an AppleScript to get emails from Mail, only the relevant steps, commented: set dateRcvd to date received -- an AppleScript date from Mail set FM_TS_dateRcvd to my make_FM_TS(dateRcvd) -- call subroutine, pass AppleScript date, return FileMaker timestamp -- subroutine to convert to FileMaker TS on make_FM_TS(dateStamp) set {year:y, month:m, day:d} to dateStamp set d_txt to ((m as integer) & "/" & d & "/" & y) as text set t to time string of (current date) set TS to d_txt & " " & t end make_FM_TS Edited June 26, 2009 by Guest Wrong (again) about the slashes
Jesse Barnum Posted June 26, 2009 Posted June 26, 2009 Hi Fenton - this just really helped me out, thanks! btw I did have to insert slashes, not sure what the difference is.
Fenton Posted June 26, 2009 Posted June 26, 2009 Yes, you're right. I don't know under what circumstances it was inserting them. I swear it was, but now it's not. I ran into some other funny business with this conversion also, but can't remember exactly. To make up for it, I edited my original to an even shorter version -]
Recommended Posts
This topic is 5628 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now