Lines 11-19 are, in a nutshell, why I hate AppleScript. That sandbox is inside the ~/Library/Containers/ folder. But when the imprint file is built into the script, it can only be within PDFpenPro’s sandbox. If the user chooses the imprint file, as she does in Smile’s Imprint All Pages With Image… script, the imprint file can be anywhere because the system knows that the user chose it. This is an unfortunate consequence of sandboxing. It’s in a bizarre location, deep inside the ~/Library/Containers/ folder. Lines 2-4 establish where draft.pdf is stored. The imprint graphic will be placed on a layer above the original page, so it needs a lot of transparency to allow the original page to show through. The most important thing is its opacity setting. I made it in OmniGraffle, but I’m sure it could be made in any number of programs. I used the same file as before, draft.pdf, which consists of the word DRAFT in 144-point Helvetica, rotated at a 60° angle and set to an opacity of 10%. The interesting part is the imprint function.įirst, of course, we need a PDF file to use as our imprint. The on run section in Lines 37-39 is the standard template for AppleScripts in Automator. What I ended up with was this Service, which is basically just one AppleScript that accepts as input a set of PDF files selected in the Finder.Ģ: set myLibrary to (path to library folder from user domain) as stringģ: set myFile to myLibrary & "Containers::Data:Documents:draft.pdf"ġ1: - The new file will have the same name but withġ3: set oldPath to (path of myDoc as string)ġ4: set newPath to (text 1 thru -5 of oldPath) & " draft.pdf"ġ8: set pageCount to count pages of myDocġ9: repeat with pageNumber from 1 to pageCountĢ0: make new imprint with properties at beginning of imprints of page pageNumber of myDocĢ3: close myDoc saving in POSIX file newPath The nice thing was that I knew this script would have most of what was needed to take me out of it. This process worked well, but you can see why I wanted to automate it: too much me in every step.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |