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 input image based on filename

Featured Replies

Hi,

I have a folder full of about 1000 cover images for films that is left over form a previous Access database. The images are all named according to a catalog number (that is how they were displayed in Access), which is the same in my new FMP database.

Being wholly inept when it comes to Applescript, how might I go about writing a script that would import the images to container fields in their respective records in FMP.

I dont think you would necessarily need applescript for this. If you have a field that identifies which file that it is associated with by catalog number, then you could set a dynamic path and loop through the records. For example, assuming that the images are in the same folder,

Set Variable [ $path; Value: "imagemac:/MacVolume/images/" & catalognumber_field ]

Set Field [ ImgContainer; $path ]

  • Author

That seems to be working pretty good, with the exception that not every record has a corresponding image. So what I need is a way to test that there is actually a file before it performs the import. Otherwise I'd have to sit there and keep pressing "ok, continue" for each error message when it doesn't find the image in the $path variable.

I know there is a script step to validate that a field is not empty, etc, but is there some way to validate that a file is there or not? Or can I just build in a step to ignore errors?

To get rid of those error popups, you can

Set Error Capture [On].

Another method would be to have a related table to store all the images in it and import all the images into a container field in it. You also need a field to parse out the catalognumber from the path of the imported image. Then you can create a relationship between the two tables keyed on the catalognumber fields.

Also, Fenton posted a applescript on how to check for a file existing here.

Applescript to Check File

  • Author

nevermind. I found it. set error capture "on". thanks for all your help!

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.