Clicking a checkbox in Acrobat 7

This is my first post and I’m new to Scripting. Lots-o-fun.
I have come up with a small script to convert multipage pdf documents in to single page and then build a list of the file names to be later used for variable data printing, and signature layout.
The script below is a portion of the whole gig. The problem I’m having is checking one checkbox in the menu window “extract pages”.
As you will see by the comments in the script, I have tried various ways to either click or test for the state of the clickbox. None of them are working. I always get “System Events got an error: NSReceiverEvaluationScriptError: 4”
I have checked the box with UI Element Inspector and am able to togle it on and off with the AXPress Action. The Inpector window also tells me that the AXEnabled state is 1 ( I assume that this tells me that the checkbox should be accesable through System Events.

Any help or ideas would be greatly appreciated
Thanks again for all the great post. This community has been inspirational.

Here is a portion of the script

tell application “Adobe Acrobat 7.0 Prof#CC75”
activate
choose file with prompt “Select PDF to Covert to Single Page”
copy the result to Orgdoc
open Orgdoc
end tell

tell application “Finder”
activate
set Orgdocname to name of Orgdoc as string
end tell

tell application “Adobe Acrobat 7.0 Prof#CC75”
activate
set PageCount to “”
set Orgdoc to the front document
set PageCount to page count

tell application "System Events"
	tell process "Acrobat"
		click menu item "Extract Pages..." of menu "Document" of menu bar item "Document" of menu bar 1
		tell menu item "Extract Pages..."
			keystroke "1"
			keystroke tab
			keystroke PageCount as string
			
			
			perform action "AXPress" of checkbox "Extract Pages As Separate Files" of menu item "Extract Pages..." of menu "Document" of menu bar item "Document" of menu bar 1
			---select checkbox "Extract Pages As Separate Files" ---of menu item "Extract Pages..." of menu "Document" of menu bar item "Document" of menu bar 1
			----click checkbox "Extract Pages As Separate Files" ---of menu item "Extract Pages..." of menu "Document" of menu bar item "Document" of menu bar 1
			---get every attribute of menu item "Extract Pages..."
			---get every action of menu item "Extract Pages..." of menu "Document" of menu bar item "Document" of menu bar 1
			--- get value of checkbox "Extract Pages As Separate Files"
		end tell
	end tell
	---close document 1 saving no
end tell

end tell

Model: Dual 1.8 G5
AppleScript: 1.9.3
Browser: Safari 312.6
Operating System: Mac OS X (10.4)

Acrobat can be tricky with System Events. Try replacing the systems events section with this:

tell application "System Events"
tell process "Acrobat"
click menu item "Extract Pages..." of menu "Document" of menu bar item "Document" of menu bar 1
delay 1
keystroke "1"
keystroke tab
keystroke (PageCount as string)
delay 0.5
click checkbox "Extract Pages As Separate Files" of group 1 of window "Extract Pages"
click button "OK" of group 1 of window "Extract Pages"
end tell
--close document 1 saving no
end tell

Model: Mac G5 OS 10.3.9
Browser: Safari 312.3.1
Operating System: Mac OS X (10.3.9)

I have had no end of problems when attempting UI scripting with Adobe’s software other than the default return button.
I have javascript for doing this function as “extract” is not supported in Applescript or at least not in my Acrobat 6. Try this in the batch sequence. Create new sequence using Execute JavaScript. Click the edit button on the Java Action and paste in the following code. Hope this helps.

/* Extract Pages to Folder /
// regular expression acquire the base name of file
var re = /.
/|.pdf$/ig;
// filename is the base name of the file Acrobat is working on
var filename = this.path.replace(re,“”);
try {
for (var i = 0; i < this.numPages; i++) this.extractPages( { nStart: i, cPath: filename+“_0” + (i+1) +“.pdf” }); } catch (e) { console.println("Aborted: "+e) }

Matt,
Thank you very much,

I’m still learning about the hierarchy of menus and the terms used ie: children, group, etc. I can see that in UI Scripting, one needs to be very specific. Are there any recomended books that address UI Scripting, and or Acrobat Scripting in general?

Thanks again, I hope I can be of service in the future
michael

I also realized that by using “delay”, the menu item has time to react before the script goes on to the next line. This has fixed a lot of hangups