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 to Open a File

Featured Replies

  • Newbies

I have recently switched from Windows to Mac, and from Access to Filemaker. In one of my databases I had a hyperlink field which stored filepaths to .jpg and .pdf files, and served to open them. Nevertheless, this field has been imported into FileMaker as a text field, so I would need an AppleScript to open the file indicated in the said field.

At the same time, I will be sharing my database with some Access users, so I would also like to have an AppleScript which helps me to easily store filepaths into a text field.

I am aware that this question may have been posted before, but I have been unable to find it.

Thank you for your help.

Well, AppleScript can do all this. But I think just plain FileMaker could also. A container field in FileMaker holds the file reference of a file/picture inserted into it [x] As a reference. You can see this by using a calculation GetAsText ( container field ). It is a FileMaker syntax path; which you can see in practically any dialog to do with external files (Insert, Import, Export, etc.).

What is not as widely known is that if you create a calculation, with its result the above path, and the result type of the calculation Container, then FileMaker will show the file/picture in the container field. When you think about it it makes sense; it's just the reverse of the normal "insert a file as reference." In this case you're telling FileMaker where the file is with a calculation; FileMaker is happy either way.

You need to add a prefix to the file if you want it to work on either platform. Say you have a picture, "Donuts.jpg" on your Desktop.

Let (

prefix = Case ( Abs ( Get (SystemPlatform)) = 1; "imagemac:"; "imagewin:");

prefix & Get (DesktopPath) & "Donuts.jpg"

)

Remember, the calculation result is Container.

The above will "show" the picture. If you want something that will open the picture (as a file), then you just need another calculation:

Let (

prefix = Case ( Abs ( Get (SystemPlatform)) = 1; "filemac:"; "filewin:");

prefix & Get (DesktopPath) & "Donuts.jpg"

)

It will show as an icon. You can either double-click it to open, or you can script a

Go To Field [ calculated container; select/perform ]

Something like that. I wrote the above on the fly; hopefully it is all correct; but it does work (if it is :-)

Edited by Guest
forgot the ) on the Case

  • Author
  • Newbies

Thank you for your quick reply. I haven't had time to try this solution yet. I'll do it this weekend. I'll let you know the results.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.