Acorn Acorn 5

Using Automator and AppleScript to replace text in an image

Acorn 5.4+ includes a scripting interface for replacing editable text in your image. 

For Applescript:

tell application "Acorn"

tell document 1

replace text "$foo$" with "This Is The New String"

end tell

end tell

For Javascript:

doc.replaceOccurrencesOfString_withString("$foo$", "This Is The New String");

Combine this feature with pre-made templates and you can automate the making of templates, guest tags, or anything else that combines lists of text with images. See below for an example that starts with a simple template. Applescript drives the text replacement along with saving the images as PDF.

Pasted Graphic.tiff

set priceList to ["$4.99", "$9.99", "$3.99"]

set itemList to ["Eggs", "Pizza", "Cheese"]

repeat with i from 1 to number of items in priceList

set price to item i of priceList

set title to item i of itemList

tell application "Acorn"

set doc to open "/Users/gus/Desktop/Coupon Template.acorn"

tell doc

replace text "$title$" with title

replace text "$price$" with price

set fileName to title & ".pdf"

web export in "/tmp/" & fileName as PDF

close without saving

end tell

end tell

end repeat