1024 Views    -    2 Replies


Username Post: Embedding Images Using Applescript        (Topic#213744)
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! Tweet This Post!
   This is 99wolves's second post.
03-09-10 02:24 PM - Post#352110     - Post Rank:             


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
Fenton

Loc: San Diego, CA
Post Rank (AVG):
            


FMP: 10 Advanced
OS: Mac OS X Leopard

Member: TechNet, FBA
Skill: Advance

 FMPug

Tweet This! Tweet This Post!
03-10-10 07:52 AM - Post#352183     - Post Rank:             
    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.
http://fentonjones.com











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! Tweet This Post!
   This is 99wolves's third post.
03-12-10 04:32 PM - Post#352550     - Post Rank:             
    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.










Icon Legend Permissions Topic Options
Print Topic

Email Topic

1024 Views
Welcome Guest...
Enter your username and password to login. If you do not have a username you can register one here

Username

Password

Remember me. Help



Forgot Password...


Quick Links
Recent Posts
Active Topics
No Replies
Recent Files
Functions & Scripts
FileMaker Pro Help
FileMaker on Twitter
FileMaker Marketplace

Custom Search

Find FileMaker Developers

Don't have time to wait,
hire a developer now!

Recent Members
Welcome them to our community!
Find FileMaker Jobs

Want a new career?
Find your new job now!

Joy of Tech
Latest Joy of Tech!

Recent Topics
Recent Hot Topics
Contribute
With your generosity we can make some real magic happen!. Support your favorite online FileMaker community...
FM Forums.com


Click here...


Or a Donation of any amount.


Thanks for your support!

Active Blogs
0 Recent blogs:
People to Post Lately in this Topic
99wolves
Fenton
FM Forums Advertisers


FusionBB™ Version 3.0 FINAL | ©2003-2010 InteractivePHP, Inc.
Execution time: 0.37 seconds.   Total Queries: 50   Zlib Compression is on.
All times are . Current time is 09:04 AM
Content ©1996-2008 Ocean West Consulting, Inc. All Rights Reserved
Ocean West Consulting, Inc. can not and will not be held responsible for any of the contents in this site.
FM Forums™ is a trademark of Ocean West Consulting, Inc an independent entity, not affiliated with FileMaker Inc.
FileMaker® is a registered trademark of FileMaker Inc.
Top