Illustrator: Select all and Make Clipping Path


In Adobe Illustrator CS I’m trying (as part of a bigger script) to select everything in a document and make a clipping path.

I’m probably overlooking something very obvious, but
A: I can’t find how to select everything in a document (the direct way. There are ways to make a list of all items in a file and than selecting these items one at a time, but I’m looking for the “one command” (applekey-A) option).

Edit: I figured out the select all option: “set selection to every page item of every layer”. But still no joy on the clipping path (see below)

B: The dictionary doesn’t mention anything about making a clipping path (applekey-7), so I’m in the dark here about the possibility of doing this at all with Applescript.

Any help is welcome.

Thanks in advance,


Ton -
Take a look in the dictionary under Path Item - there is a “clipping” property that sets whether the specified path item is to be used as a clipping path. If that approach doesn’t come together, try setting up an action to create the clipping path and call the action from your script.


For the selection of items you can do this:

set selection to every page item of current document -- path item, text item, group item


Hi mleslie,

I tried fiddling with the clipping property, but it doesn’t work straightforward. It’s possible to ask for for the state, but setting it doesn’t seem to have any effect (after setting, checking for the state will still return false).

Using an action is also not really an option, because the script is used all over my department and this would mean installing actions on all individual computers.

The current working solution is to use the System Events to make a keystroke:

tell application "System Events" to keystroke "7" using {command down}

This seems to work so far.

Thanks for your input.



martovarot, this works for me by moving all the page items into a group item then setting the clipping of the group item to true. The clipping one is the uppermost item of the page items moved into the group item. Only performed a basic test but hope it helps.

tell application "Illustrator CS"
	tell document 1
		set MyStuff to every page item
		set MyGroup to make new group item at beginning
		move MyStuff to beginning of MyGroup
		set properties of MyGroup to {clipped:true}
	end tell
end tell

Hi Mark67,

This seems indeed to be the missing piece of info to get the clipped property to work; make the items into group…

It all seems so simple once you have the answer.

Thanks a lot,


When you think about the selection tools in the application once you have used “comm+7” to make your clipping mask the objects behave as a group. In script it appears that the group needs to be made first then activate its clipping to the top most object. Not sure if you would need to put some catches in first to find things that may not work with a little more playing I found that existing groups moved into the new group caused an error. This would all depend on the contents of you files I think but then I am fairly new to this. Glad to have been of some all be it limited assistance…