PDA

View Full Version : Pasting to filename in Applescript




DaveGoff
Feb 19, 2008, 01:28 PM
Hello,

I have a Filemaker app that I have been working on and I want my report script to export the report as a pdf with the name of the file determined by a field.

It seems that I had done this long ago by having Filemaker copy the field contents to the clipboard, then had Applescript paste the clipboard into the name of the appropriate file.

I can't seem to see how to "paste" anything in Applescript now. Is the an easier way to do this?

DaveGoff

My webcomic - Alienses - It's kind of like Cheers meets the X-Files!
www.alienses.smackjeeves.com



lancestraz
Feb 19, 2008, 05:01 PM
Why not copy the fields content directly to a variable?
set fieldContent to the content of field thisOne
Or whatever the syntax for FileMaker is.

Then rename it.
tell application "Finder"
set name of ("Macintosh HD:Report.pdf" as alias) to (fieldContent & ".pdf")
end tell

DaveGoff
Feb 20, 2008, 12:00 AM
Turns out my thinking was just all wrong. :o No need for Applescript at all Filemaker scripting can handle the whole thing.

These two steps took care of the problem

Set Variable [$path; Value:"file:" & Get ( DesktopPath ) & "Reports/" & FilenameField & ".pdf"
Save Records as PDF [Restore; No Dialog; "$path"; Records being browsed]

Thanks for the help though!


DaveGoff

My webcomic - Alienses - It's kind of like Cheers meets the X-Files!
www.alienses.smackjeeves.com