InDesign selection of active text frame

Hi,
I’m trying to change the vertical justification of a text box, while the text tool is active.
I cannot find the right way to make the active text frame the selection.

I tried something like this.

tell application “Adobe InDesign CS6”
set myVerticalJustification to justify align
set myFrame to active text frame
set vertical justification of text frame preferences of myFrame to myVerticalJustification
end tell

TIA
(InDesign CS6, Mavericks)

Mraj,

Try this:


tell application "Adobe InDesign CS6"
	set myDocument to active document
	set myFrame to selection
	set theProps to properties of item 1 of myFrame
	tell text frame preferences of theProps
		set vertical justification to justify align
	end tell
end tell

Regards,

Mike

Ok, thanks, but this only work with the selection tool (black arrow).

I already got this with

tell application “Adobe InDesign CS6”
set myVerticalJustification to justify align
set vertical justification of text frame preferences of selection to myVerticalJustification
end tell

Your code is more secure,

but I need a script to work with the text tool, in the text frame where the insertion cursor is.

Then you need to get the class of the first item of the selection (it’s a list of items), and if it’s a text class, deal with its parent.

Thanks for your reply Shane.
The class is insertion point
I tried to deal with it’s parent text frame but couldn’t get it to work.

Ok, I found some help on an old thread here.
http://macscripter.net/viewtopic.php?id=18228


tell application "Adobe InDesign CS6"
	set ParentFrame to parent text frames of item 1 of selection
	if (count of ParentFrame) is 1 then set ParentFrame to item 1 of ParentFrame
	set vertical justification of text frame preferences of ParentFrame to justify align
end tell

Thanks