Sunday, September 15, 2019

#1 2008-10-20 02:12:11 am

krish
Member
Registered: 2007-09-19
Posts: 101

JPG conversion using Acrobat professional and Applescript

Hi,

I have writen the applescript to convert all images into the JPEG format. I used "Batch processing" options in Adobe Acrobat Professional.

My script is below.
--------------------------

tell application "Finder"
    tell application "Adobe Acrobat Professional" to activate
    tell application "System Events"
        tell process "Acrobat"
            tell menu bar 1
                tell menu "Advanced" of menu bar item "Advanced"
                    click menu item "Batch Processing..."
                    tell application "System Events"
                        tell window "Batch Sequences" of process "Acrobat"
                           
                            tell button -5 to perform "JPEG"
                            click button -5
                           
                            tell window "Run Sequence Confirmation - JPEG"
                                click button "OK"
                            end tell
                           
                        end tell
                    end tell
                end tell
            end tell
        end tell
    end tell
end tell


When I run this script, It opens the Acrobat's "Batch Processing" window.  And the code "click button -5" in the above script will click the "Run Sequence" button in the window. Then the scripts ends in that place. It does not go into the next window "Run Sequence Confirmation - JPEG" for JPEG conversion.

The click options in the script will click the "Run Sequence" button but it does not act like mouse click. I need a applescript comand to perform mouse click the "Run Sequence" button.

Could anyone help me on this.
Thanks for your help.

Regards,
Gopal


Filed under: Finder, System, adobe

Offline

 

#2 2008-10-20 02:55:35 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11594
Website

Re: JPG conversion using Acrobat professional and Applescript

Hi,

There are too many nested references.
The Finder tell block is not needed, because the Finder is not involved at all.
Also the second System Events block, System Events is already targeted

I'm wondering that the window Batch Processing window opens, because the reference is wrong.
In Acrobat 8 and 9 Pro it's
[code]menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1[/code]
The command perform needs also the keyword action as parameter.
I don't have this JPEG action, so I can't test it

Applescript:


activate application "Adobe Acrobat Professional"
tell application "System Events"
tell process "Acrobat"

click menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1
repeat until exists window "Batch Sequences"
delay 0.5
end repeat
tell window "Batch Sequences"

tell button -5 to perform action "JPEG"
click button -5

tell window "Run Sequence Confirmation - JPEG"
click button "OK"
end tell

end tell
end tell
end tel


regards

Stefan


Filed under: System

Offline

 

#3 2008-10-20 04:35:57 am

krish
Member
Registered: 2007-09-19
Posts: 101

Re: JPG conversion using Acrobat professional and Applescript

Thanks Stefan.

When I use this codes:
           tell button -5 to perform action "JPEG"
           click button -5

It shows the error message:

   System Events got an error: NSReceiverEvaluationScriptError: 4


But When I delete the "action" from the code, It works fine.

Thanks,
Gopalakrishnan

Offline

 

#4 2008-10-20 07:49:18 am

Martin Michel
Administrator
From:: Berlin, Germany
Registered: 2008-03-03
Posts: 701
Website

Re: JPG conversion using Acrobat professional and Applescript

Hi krish,

Just in case you need to convert PDF pages to JPG images: There is also an AppleScript available in Code Exchange big_smile

Best regards from sunny Germany!


Plonum - Convert images to iWork Numbers documents

Offline

 

#5 2009-11-10 02:35:19 am

ecloud
Member
Registered: 2009-11-10
Posts: 1

Re: JPG conversion using Acrobat professional and Applescript

StefanK, thanks, it was a good start for me: I needed a way to have Acrobat automatically OCR PDFs which are dropped in a particular folder.  However I wish that selecting the Acrobat batch sequence to run could be done more deterministically rather than sending up or down arrow keystrokes.  In other words is there a way to select an item in a list in a dialog, by the text of the item?  Otherwise if I add any more batch sequences I'd probably have to change the number of arrow keystrokes to send this dialog.

Acrobat-batch-process-ocr.png

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)