Pasting to filename in Applescript

Discussion in 'Mac Programming' started by DaveGoff, Feb 19, 2008.

  1. macrumors newbie

    Joined:
    Feb 19, 2008
    #1
    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
     
  2. macrumors 6502a

    lancestraz

    Joined:
    Nov 27, 2005
    Location:
    RI
    #2
    Why not copy the fields content directly to a variable?
    Code:
    set fieldContent to the content of field thisOne
    Or whatever the syntax for FileMaker is.

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

    Joined:
    Feb 19, 2008
    #3
    Turns out my thinking was just all wrong. :eek: 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
     

Share This Page