InDesign 2015 - Can't apply object style to a text frame

This script will make a text frame but it won’t apply the object style to the frame. I can’t figure out why it won’t work. Any help out there?


tell page 1 of mydoc
	set myframe to make text frame 
	tell myframe
		set the geometric bounds to {i, 0, j, "10p"}
		set the contents to mypara
		set properties of text frame preferences to {ignore wrap:true, inset spacing:{"0p2", "0p6", "0p4", "0p6"}, applied object style:object style "Figure Frame"}
	end tell
end tell

Hi

try this out

tell application "Adobe InDesign CC 2015"
	set myDoc to active document
	tell myDoc
		set myframe to make text frame with properties {geometric bounds:{i, 0, j, "10p"}, applied object style:object style "TEST"}
		tell myframe
			set the contents to mypara
			set properties of text frame preferences to {ignore wrap:true, inset spacing:{"0p2", "0p6", "0p4", "0p6"}}
		end tell
	end tell
end tell

Sadly, this gives me an error. =–> “Invalid parameter.”

did you change the object style name to your one?

this works here, using the style TEST, for testing I set the geometric bounds of the text frame as I don’t have your settings

tell application "Adobe InDesign CC 2015"
	set myDoc to active document
	tell myDoc
		set myframe to make text frame with properties {geometric bounds:{"7", "7", "15", "60"}, applied object style:object style "TEST"}
		tell myframe
			set properties of text frame preferences to {ignore wrap:true, inset spacing:{"0p2", "0p6", "0p4", "0p6"}}
		end tell
	end tell
end tell

I changed “tell page 1 of mydoc” to just “tell mydoc” and now it seems to work.

Seems like it was the “tell page 1” that was messing things up. I’ll test it out at work and see how it goes.