I’m trying to write a script to find text characters with a specific fill color so I can gather information about them and make them a different color. This is basically what I have so far. The “number of characters” will not work. I have tried “count of characters” and “length” to no avail. The line ‘display dialog “There are " & numOfChar & " characters in this text box.”’ comes up with a zero. Please help!!
tell application "Adobe InDesign CS6"
activate
set myDocument to active document
set countPages to count of pages of myDocument
tell myDocument
set startOver to "False"
set allPageItems to all page items as list
set countItems to count of items in allPageItems
display dialog "There are " & countItems & " items in the document"
repeat with i from 1 to countItems
try
select page item i
set theObject to page item i of myDocument
set theClass to class of theObject
if theClass is text frame then
display dialog "This is where I do some stuff."
set theColor to "C=0 M=100 Y=0 K=0"
set theText to text of theObject
set numOfChar to number of characters of theText
display dialog "There are " & numOfChar & " characters in this text box."
--repeat with i from 1 to numOfChar
-- if fill color of character i of theText is theColor then
-- display dialog "Found some magenta text."
-- end if
--end repeat
else if theClass is group then
ungroup theObject
set startOver to "True"
exit repeat
display dialog "This was a group."
end if
on error number n
display dialog "Got an error: #" & n
end try
end repeat
end tell
end tell