April 4, 200421 yr I am trying to do something with a container field that goes beyond my expertise (meaning it requires AppleScript). I would be grateful for any assistance you experts out there might lend. Here's what I am trying to do. I have a container field that contains an embedded PDF file (not just a reference). Right now, I have a script to import the file and another script to export it back out. I would like to simplify the "export" process if possible. What I am hoping is that I can click a button to launch a FP script that will export the file and then automatically launch an Applescript to open the PDF in Preview. If anyone could walk me through this process, I would be most appreciative. Kindest regards, Mark FileMaker Version: 7 Platform: Mac OS X Panther
April 4, 200421 yr I would recommend Troi File Plugin. you might try the open url function and specify file://path/to/file.pdf
April 5, 200421 yr The Troi file plugin is basically a Windows plugin. There isn't much point in using it on the Mac, most of what it does can be done natively.
April 5, 200421 yr Just export the field contents to a file on the desktop with a predesignated name like "export.pdf" and then Perform AppleScript tell application "Finder" activate open file "export.pdf" end tell
April 5, 200421 yr If you want to use AppleScript it's not very difficult. It's pretty the same process no matter what tool you use. The embedded file is just a new twist on the same thing. Your basic problem is that FileMaker can only export as a pre-named file to a known location, without user interaction, whether it's records in 6 or field contents in 7. So the trick is to rename and/or move the file somewhere else, if you want to keep the file. If you don't mind overwriting the file each time, then you don't have to rename it, just open it. That would be a little weird, 'cause the window's title would always be the same. As Stephen says, the OpenURL step would do it. Or, using AppleScript, just tell the Finder to open the file. The Finder uses the default application for the file. Example: tell application "Finder"
April 5, 200421 yr Author YES, yes, yes! Thank you. I knew it was simple but I am an Applescript idiot so I did not know where to start. If I may impose, is there a way using Applescript to delete the file (move it to the trash) once it has opened? IOW, I am opening the file on the desktop in preview but then I want it immediately deleted. Thanks again, Mark
April 5, 200421 yr Author OK. I figured out how to delete it (just add a line to "delete file" in the AppleScript). So, now I have exactly what I was looking for (and have added a heretofore missing function to FP 7) As shown on the attached screenshot, my document container has three buttons beneath it. One inserts a file into the container, the second allows the user to view it (wothout saving anything) and the third allows the user to export the file (retaining its original name). Thanks to each of you for your assistance. Kindest regards, Mark FileMaker Version: 7 Platform: Mac OS X Panther
Create an account or sign in to comment