Jump to content
Server Maintenance This Week. ×

Applescript problem


This topic is 5422 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

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?

Link to comment
Share on other sites

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 by Guest
Wrong (again) about the slashes
Link to comment
Share on other sites

  • 1 year later...

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 ???-]

Link to comment
Share on other sites

This topic is 5422 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.