Applescript / Indesign: Place inline graphic with applied object style

hi All

I have a text frame with my text cursor flashing in it, I’m using this as my insertion point.

I’m then running.

tell application "Adobe InDesign CC 2014"
	activate
	set myIndd to "Macintosh HD:Users:hansolo:Desktop:Product Headers:file.indd"
	place myIndd as alias on my selection
end tell

I’m trying to add an object style to this but as I don’t make the frame I can’t figure a way to do this?

Any ideas welcome

Thanks

Shane

Hi Shane,
This gives you the text frame etc but as yet I’ve not been able to set the object style. :confused:


tell application "Adobe InDesign CC 2014"
	set x to selection
	set y to parent text frames of item 1 of x
	set z to applied object style of item 1 of y
end tell

After some playing around, this works. Thanks once again to Script Debugger!


tell application "Adobe InDesign CC 2014"
	
	set (applied object style of item 1 of (parent text frames of item 1 of selection)) to (first object style of front document whose name is "newStyle3")
	
end tell

I’ve tested it on text frames within text frames to 3 levels deep.

Still trying to apply a style to the placed indd doc.

HTH

This seems to work ok for a placed InDesign doc.


set thisInddDoc to ((path to desktop) & "placeThis.indd") as text

tell application "Adobe InDesign CC 2014"
	
	set thisPlacedItem to place thisInddDoc as alias on my selection
	
	set applied object style of parent of item 1 of thisPlacedItem to (get first object style of front document whose name is "NewStyle3")
	
end tell