create layers in Indesign CS3

hi, I am looking for a script for Indesign CS3 (format: Applescript) which I could invoke for each new document to create a set of new layers.
the name need to be set; colour and stack order if possible (the order of creation could handle this probably: layer on top created at last).
more tricky would be to set some properties, specially setting a layer not to print (designerNotes).
if anyone could help, it would be much appreciated “ and I am sure useful for others…
cheers,

Hi,

something like this (for one layer)


tell application "Adobe InDesign CS3"
	set LayerName to "NewLayer"
	tell document 1
		try
			set myLayer to layer LayerName
		on error
			set myLayer to make layer with properties {name:LayerName, printable:false, layer color:blue}
		end try
	end tell
end tell

thanks Stefan
when running it I got an “string error”: Indesign “can’t get layer”
I tried from within ID having saved script as .applescript, as well as .scpt
does it make sens?
cheers,

the script works only with an existing (open) document

Hi Pascal,
does this do what you want?

tell application "Adobe InDesign CS3"
	activate
	make new document
	tell active document
		set Notes_layer to make new layer with properties {name:"Notes"}
		set Images_layer to make new layer with properties {name:"Images"}
		set Graphics_layer to make new layer with properties {name:"Graphics"}
		set Text_layer to make new layer with properties {name:"Text"}
		delete layer 5
		set printable of Notes_layer to false
	end tell
end tell

Thanks,
Nik

thanks guys
Stefan’s script works fine “ yes I needed to have a document open before!
I was just playing around with it, setting up my other layers, to check.
but thanks Nik for the effort!
a note: the last layer to enter in Script Editor is the Background layer (in other words: the last in the stack back in ID) “ make sense.
cheers,

hi, me again, just thinking…

would it be possible to create a folder inside Indesign layers?
name it
and add more layers inside it…

… still using this same script above?

it would be great to be able to group a set of layers “ let say, interactive elements for a pdf
what do you reckon?
cheers,

Is this even possible “manually” in InDesign?

There are no layer folders like in PhotoShop (I wish there was).

This is a script I made to set up a standard set of layers. It checks to see if they are there first and then adds them. It moves ones to the bottom that should be at the bottom of the list. It also checks to make sure a document is open.

To put it in the “Scripts” palette in InDesign, save it as a script (not an app), and put the script in your user’s folder/Library/Preferences/Adobe InDesign/Version 5.0/Scripts/Scripts Panel/

tell application "Adobe InDesign CS3"
	activate
	if not (exists document 1) then
		try
			with timeout of 9999 seconds
				display dialog "No document open!" buttons "Cancel" default button "Cancel" giving up after 4
			end timeout
		on error
			return
		end try
	end if
	tell active document
		if not (exists layer "Third from bottom") then make new layer with properties {name:"Third from bottom", layer color:red}
		try
			move layer "Third from bottom" to end of last layer
		end try
		if not (exists layer "Second from bottom") then make new layer with properties {name:"Second from bottom", layer color:red}
		try
			move layer "Second from bottom" to end of last layer
		end try
		if not (exists layer "The Bottom") then make new layer with properties {name:"The Bottom", layer color:orange}
		try
			move layer "The Bottom" to end of last layer
		end try
		if not (exists layer "Another Layer") then make new layer with properties {name:"Another Layer", layer color:dark green}
		if not (exists layer "One More") then make new layer with properties {name:"One More", layer color:dark green}
	end tell
end tell

Model: G5 OSX 10.4.8
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

thanks Matt, will look at your script later.
but as mentioned earlier on the post, Stefan’s one was working fine.

and yes Stefan, you can create it “ or it’s a hack… but DTP Tools propose a plugin doing just that, called Layer Comp (from memory):
http://www.dtptools.com/
cheers,

If the plugin is scriptable, it could be possible