I have a script to manipulate a story of text listings in InDesign, but it wipes out the text case in every place where it should be All caps and turns it into Title case.
How can I set things to preserve the case of the text as it stands in the InDesign story?
tell application "Adobe InDesign CS5"
set enable redraw of script preferences to false
set find text preferences to nothing
set case sensitive of find change text options to false
set include footnotes of find change text options to false
set include hidden layers of find change text options to false
set include locked layers for find of find change text options to true
set include locked stories for find of find change text options to true
set include master pages of find change text options to false
set whole word of find change text options to false
set myTextObjects to {text style range, paragraph, text column, text, story}
if (count documents) > 0 then
set mySelection to parent story of selection
set SelectProps to properties of selection
return SelectProps
return mySelection
if (count mySelection) > 0 then
if class of item 1 of mySelection is in myTextObjects then
tell document 1
set targetFrame to text frame 1 of the page 3
--return targetFrame
set myText to contents of item 1 of mySelection
--return (count paragraphs of myText)
--return myText
set myNewText to ""
repeat with i from (count paragraphs of myText) to 1 by -1
set workPara to paragraph i of myText
--return workPara
try
set work2Para to paragraph (i - 1) of myText
--return work2Para
on error
set work2Para to ""
end try
if workPara = work2Para then
set workPara to ""
end if
set myNewText to workPara & return & myNewText
end repeat
tell parent story of targetFrame
--delete paragraphs
set contents of targetFrame to myNewText
end tell
end tell
else
display dialog "Text is not selected, or too little text is selected. Please select several paragraphs and try again."
end if
else
display dialog "Nothing is selected. Please select some text and try again."
end if
else
display dialog "No documents are open. Please open a document and try again."
end if