AnsweredAssumed Answered

Export Adobe Illustrator file and edit contents w/AppleScript

Question asked by jbryan on Jan 16, 2017
Latest reply on Jan 20, 2017 by jbryan

Hello all! (First post of a newbie here.)

 

BACKGROUND

Our FM solution is used by graphic designers to manage packaging graphics projects for hundreds of products. The primary deliverable for every project is an Adobe Illustrator art file. Each file has a "legend" at bottom of the art that designers manually type (or copy-paste) data about the project into; description, size, print method, etc. I automated the creation of the legend, to simplify workflow and reduce human error.

 

DETAILS

Start by exporting an Adobe Illustrator template file (.ait) from a container field to the TemporaryPath, looping through every child record of the current record; opening the template file and then populating data in the Illustrator document. Just got it to work today, so feeling pretty good but would love any tips & recommendations to make it leaner/faster/better.

 

FILEMAKER SCRIPT

# create a file path in the temp folder naming the document with its UUID

Set Variable [ $TemplatePath ; Value: Get (TemporaryPath) & “legend.ait” ]

 

# export the file to the path

Export Field Contents [ Job Settings::Legend Template ; “$TemplatePath” ]

 

# loop through every deliverable record and create legend for each in Illustrator with AppleScript

Go to Object [ Object Name: “Deliverable Portal” ]

Go to Portal Row [ Select ; First ]

Loop

  Set Variable [ $RowNumber ; Value: Get ( ActivePortalRowNumber ) ]

  Set Field [ Job::Deliverable Row ; $RowNumber ]

  Set Field [ Job::Deliverable Print Method ; Deliverable::Print Method ]

  Set Field [ Job::Deliverable Type ; Deliverable::Type ]

  Set Field [ Job::Deliverable Substrate ; Deliverable::Substrate ]

  Send Event [ “<unknown>” ; “aevt” ; “odoc” ; “$TemplatePath” ]

  Perform AppleScript [ My Applescript Here… ]

  Go to Portal Row [ Next ]

  Set Variable [ $RowNumber ; Value: Get ( ActivePortalRowNumber ) ]

  Exit Loop If [ $RowNumber > Job::Deliverable Count ]

End Loop

Go to Portal Row [ Select ; First ]

 

APPLESCRIPT

tell application "FileMaker Pro Advanced"

  if it is running then

  set delivNumber to cell "Deliverable Row" of current record

  set delivTotal to cell "Deliverable Count" of current record

  set theDescription to cell "Event::Description" of current record

  set theSize to cell "Event::Size" of current record

  set theUPC to cell "Item::UPC" of current record

  set theJob to cell "Job #" of current record

  set theVendor to cell "Vendor" of current record

  set thePrintMethod to cell "Deliverable Print Method" of current record

  set theType to cell "Deliverable Type" of current record

  set theSubstrate to cell "Deliverable Substrate" of current record

  set theRequester to cell "User requester::Sort Name" of current record

  set theDesigner to cell "User designer::Sort Name" of current record

  end if

end tell

 

tell application "Adobe Illustrator"

  set the contents of text frame "Number" of document 1 to delivNumber

  set the contents of text frame "Total" of document 1 to delivTotal

  set the contents of text frame "Type1" of document 1 to theType

  set the contents of text frame "Description" of document 1 to theDescription

  set the contents of text frame "Size" of document 1 to theSize

  set the contents of text frame "UPC" of document 1 to theUPC

  set the contents of text frame "Job" of document 1 to theJob

  set the contents of text frame "Vendor" of document 1 to theVendor

  set the contents of text frame "PrintMethod" of document 1 to thePrintMethod

  set the contents of text frame "Type2" of document 1 to theType

  set the contents of text frame "Substrate" of document 1 to theSubstrate

  set the contents of text frame "Requester" of document 1 to theRequester

  set the contents of text frame "Designer" of document 1 to theDesigner

end tell

Attachments

Outcomes