|
Your continued generosity and support of FMForums is greatly appreciated. |
99wolves
newbie
Posts: 3
Post Rank (AVG):
FMP: 8.5 Advanced OS: Mac OS X Tiger Skill: Entry Level
Tweet This Post!
|
This is 99wolves's second post.
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!!!
|
|
|
Fenton
Carpal Tunnel
Posts: 4971

Loc: San Diego, CA
Post Rank (AVG):
FMP: 10 Advanced OS: Mac OS X Leopard
Member: TechNet, FBA Skill: Advance
FMPug
Tweet This Post!
|
In response to 99wolves
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.
|
|
Your continued generosity and support of FMForums is greatly appreciated. |
99wolves
newbie
Posts: 3
Post Rank (AVG):
FMP: 8.5 Advanced OS: Mac OS X Tiger Skill: Entry Level
Tweet This Post!
|
This is 99wolves's third post.
In response to Fenton
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 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:
Set Variable [$thumbfilename; Value:"imagemac:/myvolume//mydirectory/mysubdirect ory"&mytable::myrecordID&".jpg"]
Goto Field[mytable::mythumbnailcontainerfield]
Insert Picture["$thumbfilename"]
Also, to be noted: when you use 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 99wolves on 03-12-10 04:34 PM. Reason for edit: No reason given.
|
|
|