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

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

menu item "Batch Processing..." of menu 1 of menu item "Document Processing" of menu 1 of menu bar item "Advanced" of menu bar 1

The command perform needs also the keyword action as parameter.
I don’t have this JPEG action, so I can’t test it


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

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

Hi krish,

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

Best regards from sunny Germany!

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.