InDesign: Select Front-Most Layer

Can anyone tell me how to select the front-most/top-most layer within an InDesign document? :confused:
Thanks - slimjim5811

slim:

I don’t have Indy here but if I recall correctly…


Tell document 1 of app "Indesign" -- This may need to be Indesign CS
set active layer to layer 1 -- I think the syntax is active, not current.
end tell

Layer 1 is the top level layer regardless of its name.

Good Luck,
Jim Neumann
BLUEFROG

This did not work for me. It gave me an error. Using this as a starting point, I tried some other options:
tell layer 1 to activate
set visible of layer 1 to true

I tested these by creating a document with 3 layers, from top to bottom in the Layer palette: Layer 3, Layer 2, Layer 1. I activated Layer 2 before running the script and it each time, the text frame was created on layer 2. I can’t get to go onto the Front-most Layer. All I want is to ensure that the Text Frame is located on the Front-most layer, no matter what its name is or how many layers exist.

tell application "InDesign"
	tell document 1
		if horizontal measurement units of view preferences is not inches or vertical measurement units of view preferences of document 1 is not inches then
			set OldHorizUnit to horizontal measurement units of view preferences
			set OldVertUnit to vertical measurement units of view preferences
			set horizontal measurement units of view preferences to inches
			set vertical measurement units of view preferences to inches
			set ResetUnits to true
		else
			set ResetUnits to false
		end if
		
		set DocName to name as string
		set the PageHeight to the page height of document preferences
		
		--tell layer 1 of document 1 to activate (WHAT IS THE CORRECT SYNTAX FOR THIS AND WHERE SHOULD IT GO?)
		
		set AdNumberBox to make new text frame with properties {geometric bounds:{(PageHeight - 1), (0.025), (PageHeight - 0.025), 0.5}, rotation angle:90}
		set properties of text of AdNumberBox to {applied font:"Helvetica Neue LT Std", font style:"75 Bold", point size:3.5, color:swatch "Black", fill tint:99, contents:DocName}
		fit AdNumberBox given frame to content
		select AdNumberBox
		
		if ResetUnits is true then
			set horizontal measurement units of view preferences of document 1 to OldHorizUnit
			set vertical measurement units of view preferences of document 1 to OldVertUnit
		end if
	end tell
end tell

Pulling my hair out,
slimjim5811

p.s. By the way, I’m using InDesign 2

Hello from Dayton, you need to get the first layer of the document and use that in the properties list of the make command:

set PageHeight to 792

tell application "InDesign CS"
	set DocName to name of document 1
	tell document 1
		set TopLayer to first layer
		--set y to properties of page item 1
		set AdNumberBox to make new text frame with properties {geometric bounds:{100, 100, 200, 200}, rotation angle:90, item layer:TopLayer}
		set properties of text of AdNumberBox to {applied font:"Helvetica Neue LT Std", font style:"75 Bold", point size:3.5, color:swatch "Black", fill tint:99, contents:DocName}
		
	end tell
end tell

Jerome-
I’ll be darned! I knew it had to be something simple! Works like a charm!
You really know your stuff when it comes to scripting InDesign. I’ve seen that you’re from Ohio in other posts, but didn’t know you’re in Dayton too. Small world, huh?

Thank you so much,
slimjim5811