Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Applescript problem

Featured Replies

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

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

  • 1 year later...

Hi Fenton - this just really helped me out, thanks! btw I did have to insert slashes, not sure what the difference is.

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

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.