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.

Embedding Images Using Applescript

Featured Replies

  • Newbies

Hello,

I am trying to create an applescript that will embed an image into a thumbnail field. I currently have a script that "links" an image to the thumbnail field, but I need it to be embedded.

(My script is run from within Filemaker Pro.)

tell application "FileMaker Pro"

set documentID to cell "Doc_ID_D" of current record

set documentIDfile to documentID & ".jpg"

end tell

tell application "Finder"

set thumb_file to "Macintosh HD:Users:moomoo:Desktop:_THUMBNAILS_MASTER:" & documentIDfile as alias

end tell

tell application "FileMaker Pro"

activate

set cell "Thumbnail" of current record to thumb_file

end tell

Thank you!!!

I don't think AppleScript can embed an image into a FileMaker container field. What you can do is pass the file's path to a global field in FileMaker, coerce the file path to a full FileMaker syntax file path ("imagemac:" & absolute path to file, look in Help or Insert Pictiure dialog to see the syntax), then call a dedicated FileMaker script (whose name must be hard-coded into the AppleScript).

The full AppleScript command to call a FileMaker script is:

do script FileMaker script "the script's name"

Its "scope" is the database level.

  • Author
  • Newbies

Thank you so much for your quick reply! You are completely correct in your thinking. After some research, I realized that I didn't need Applescript for the actual "embed photo" command. I ended up finding a way to use Filemaker script with [color:blue]Insert Picture and it's quite simple. In the future, I may use applescript to automate a batch of files and call the filemaker script from within an applescript. Thank you for your help!

For other newbies such as myself, here is the solution that I came up with, which will work on a mac. Basically I have a set of jpg thumbnail files in a directory that are all named with a record ID (example: 0003.jpg, 0004.jpg where 0003 and 0004 are record ID's). I have created a script that anticipates that these files exist in a particular directory. When run, the script automatically embeds a jpg within the currently viewed record.)

In filemaker create a new script:

[color:blue]Set Variable [$thumbfilename; Value:"imagemac:/myvolume//mydirectory/mysubdirectory"&mytable::myrecordID&".jpg"]

Goto Field[mytable::mythumbnailcontainerfield]

Insert Picture["$thumbfilename"]

Also, to be noted: when you use [color:blue]Insert Picture, there is a checkbox option where you can indicate if you want the picture to be embedded or linked. In my case, I checked it off to be embedded. I am somewhat new to filemaker scripting.. it just doesn't seem intuitive to me that there would be a check box option like this. I would expect a way to indicate that within the script text itself, thus my initial confusion.

Edited by Guest

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.