Hallo!
I have changed my process of printing with PagePacker now in the following way:
* I have created a PDF printer with the cups-pdf package. This is used to print the "Drucken" perspective from OmniFocus into the folder ~/Desktop/cups-pdf.
To create a perspective which always prints to the PDF printer, I think, the only way is to change the default printer to the PDF printer OSX wide, then recreate the "Printing" perspective. After that you can change the printer back to your normal printer. The perspective will remember the PDF printer though.
* Then I attached the following script to that folder as an folder action:
Code:
on pagepack(f)
tell application "PagePacker"
activate
set page size to A4
make new document
set doc to document 1
tell doc
delay 1
set file source of page 1 to f
delay 1
end tell
set win to window 1 where its document is doc
set winname to name of win as Unicode text
tell application "System Events"
tell process "PagePacker"
activate
set frontmost to true
set evwin to window 1 where its name is winname
keystroke "p" using command down
repeat until (count of sheets of evwin) is not 0
end repeat
repeat while (count of sheets of evwin) is not 0
end repeat
end tell
end tell
close win without saving
delay 2
quit
end tell
end pagepack
on adding folder items to this_folder after receiving added_items
try
set f to (first item of added_items)
pagepack(f)
tell application "Finder"
delete f
end tell
end try
end adding folder items to
on run
tell application "OmniFocus"
print (perspective "Drucken") without print dialog
end tell
end run
This code takes the PDF from the cups-pdf printer, puts it into PagePacker, calls the print dialog of PagePacker and after printing it deletes the pdf file and closes PagePacker. Works fine for me (most of the times, once in a while PagePacker does not get the pdf, no idea why. But only once out of 10 or so).
The trouble with the PDF printer is really needed I fear, because OSX has no way to call the "Export to PDF" action in the print dialog via AppleScript. There are plenty of threads on the web with half working solutions. But nothing reliable and easy.
Schimmi