Change text case in indesign

Hello everyone :slight_smile:

im currently learing applescript and am finding your site VERY usefull - thanks!

but im getting stuck on what i think is a really easy thing… im trying to write a script to change the case on text in indesign. I want to use the titlecase function to force text to titlecase. here is my script

tell application “Adobe InDesign CS3”
activate
tell the active document

	set page1 to page 1
	set myTargetFrame to make new text frame with properties {geometric bounds:{72, 72, 300, 300}, contents:"CAPITAL TEXT"}
	set frameproperties to properties of myTargetFrame
	set mycontents to contents of frameproperties
	--set my contents to changecase using titlecase
	
end tell

end tell

I found ‘changecase using titlecase’ in the dictionary but cant get it to work…any help please??
-thanks!

Hello,

The variable, mycontents, is being treated as a reference, but it’s really just a string. Additionally, changecase is a command, and should be followed by a reference.

tell application "InDesign CS"
	tell the active document
		set myTargetFrame to make new text frame with properties {geometric bounds:{5, 5, 10, 10}, contents:"CAPITAL TEXT"}
		changecase myTargetFrame's text using titlecase
	end tell
end tell

Hi

thanks very much!! - I just changed the geometric bounds as follows then it worked fine for me… possibly something to do with using CS3 instead of CS.

tell application “Adobe InDesign CS3”
tell the active document
set myTargetFrame to make new text frame with properties {geometric bounds:{50, 50, 100, 100}, contents:“CAPITAL TEXT”}
changecase myTargetFrame’s text using titlecase
end tell
end tell

Thanks very much!!!