Now that I’ve seen the light and realized I can run python scripts from within AppleScript, my DTPO2 will be getting a whole lot of new functionality.
Here’s a tip if you know your way around both scripting languages. Go to this path in your OSX installation and examine the package contents.
Those are Automator actions. They are based on python scripts. Dig into the resource folders for an action and you can view the python.
Now you can quickly call those actions from within an AppleScript.
Well, there goes all of my free time.
Sorry this isn’t complete, but I’m on a roll. I just wanted to post a quick example of using the automator python scripts in AppleScript.
This is an example that combines 2 PDF’s into one new one.
set myScript to "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -- Path to the python script
set sourceOne to "/Path/To/First/PDF/myFile.PDF" -- First PDF
set sourceTwo to "/Path/To/Second/PDF/myFile.PDF" -- Second PDF
set myDestination to "~/final.pdf" -- The new file
do shell script "python " & quoted form of myScript & " " & " -o " & quoted form of myDestination & " " & quoted form of sourceOne & " " & quoted form of sourceTwo
Keep in mind, this is not usable in DTPO yet, but I just wanted to get an example up. I’m working on the full AppleScript to accept two selected PDF’s in DTPO2 and join them into a new file in the same group.