ID CS2 Changing Class of Object: Empty text boxes

Folks-

Since ID CS2’s search function chokes on empty text frames, or frames whose contents are set to ‘text’ but are actually just color blocks (that’s how some of our designers make them) I’d like to be able to search for ‘empty’ text frames and change them into graphics frames.

I’ve figured out how to select empty text boxes:


tell application "Adobe InDesign CS2"
	tell document 1
		select (every text frame whose contents = "")
	end tell
end tell

But attempting to change class of a selected text box results in the following error:


tell application "Adobe InDesign CS2"
	tell document 1
		set class of selection to rectangle
	end tell
end tell

“Adobe InDesign CS2 got an error: ‘class’ is a read only property.”

Is there any slick way to change the type of object (In the ID menu it’s under Object>Content)…

thanks!

Ralph

Try this:

	set content type of page item 1 of page 1 of document 1 to graphic type

hmm… that didn’t work… i got an error that it couldn’t change the item.

However, I have figured out a way to not select the text-free boxes:


	tell application "Adobe InDesign CS2"
		select (every text frame whose contents ≠ "") of the page incrementpages of active document
		set searchResults to search selection for "1.^9^9^9^9^9^9.^9^9^9"
	end tell

-ralph

try this:

tell application "Adobe InDesign CS2"
	activate
	set emptyframes to every text frame of document 1 whose contents is ""
	repeat with anitem in emptyframes
		set content type of anitem to graphic type
	end repeat
end tell

It works for me, but if the content is not truly “”, say it has a space in it then it will not work on that tex frame. Though if these are just blank “color” boxes then you might want to use the unassigned content type rather than the graphic type.