I was looking for a way to batch print a directory of over 900 tiff files for work, and figured a basic AppleScript (very basic, as I don't know AppleScript) would do it. However, I couldnt' get it to work as you can't close window 1 or document 1 or whatever in Preview via AppleScript. So at best, my script would load all the documents, but not print more than one.
I looked around on the web quite a bit and finally found this tidbit that worked for me. Open the Preview.app package (control-click on it and choose Show Package Contents from the pop-up menu), then edit the info.plist file by adding a new boolean key set to Yes:
[robg adds: I tested this by duplicating Preview, and then using Property List Editor to add a New Child to the Root level, with the item name, class, and value as shown above. I then used Script Editor's File: Open Dictionary command to browse the various scriptable apps -- and my copy of Preview showed up with the basic AppleScript library. I would think this technique should work to add basic AppleScript support to other applications...]
I looked around on the web quite a bit and finally found this tidbit that worked for me. Open the Preview.app package (control-click on it and choose Show Package Contents from the pop-up menu), then edit the info.plist file by adding a new boolean key set to Yes:
NSAppleScriptEnabled -- Boolean -- Yes
Save the changes, then quit and restart both Preview and Script Editor, you can now have AppleScript go through a directory of tiffs (or presumably any documents that open in Preview), open and print them, and close them one by one with a basic AppleScript. My previous solution was to use GraphicConverter to batch convert the documents to a giant multipage tiff, and then print it using GraphicConverter, which is just not particularly quick. This solution is much better.
[robg adds: I tested this by duplicating Preview, and then using Property List Editor to add a New Child to the Root level, with the item name, class, and value as shown above. I then used Script Editor's File: Open Dictionary command to browse the various scriptable apps -- and my copy of Preview showed up with the basic AppleScript library. I would think this technique should work to add basic AppleScript support to other applications...]
•
[9,208 views]

