The script is intended to pull the content of all text frames on a page that are tagged with a given script label, and compares the result to a variable for a string match. In this case the control variable is
{"","","",""}The content of the four text frames on the page is compared to this control in an if statement
if pageData is dataCheck thenso if all four frames are empty, the if statement should return true, and the contained actions will be executed, which it never does. The culprit appears to be a hidden character that is the remnant of a data merge, but I'm at a loss on how to deal with it.
Record Marker (:) and End Of Story (#) |
Most functions typically ignore these, but it seems that InDesign is picking it up in the get contents command, even though in the context of the application, it has no idea what it is or how to address it. It's taken me a couple days to figure this out.
Here is the native AppleScript Editor event log showing it's script command and the return (lines 1-3):
And here is the results of the same command (lines 1-2 above), and the returned list as seen in Script Debugger's event log on AEPrint view:
To translate that into a string view it would look like
{"?","?","?","?"}
AEPrint picks up a bit of data in that string, although it has no idea how to display something that exists only in the context of InDesign as a virtual glyph representing an insertion point. As far as I can tell the character is selectable only through a shift-arrow selection. It can be copy/pasted into into a find/change field but does not return as a result in a text or GREP search.
It is possible to manually remove the record markers from the frame, but this defeats the purpose of using a script as it involves a user touching every affected frame every time a data merge is run. I'd rather not re-write how the script evaluates the content of the frame as the current method is probably the most accurate, but I could attempt to count the characters in the frame and hope that all future merged content is longer than two characters. I need to figure out how to coax AppleScript to allow me to manipulate these hidden-but-existing characters, or otherwise ignore them entirely. Is there an elementary solution here that I'm passing over, making this harder than it should be?
It seems to me, since this script ran well with InDesign CS4, so something might have changed in CS5. Is it possible that hidden characters that were beneath the view of InDesigns other functions are now being included? Or is this an overall bug in the machine?
No comments:
Post a Comment