Coerce text in InDesign tell blocks in Mavericks 10.9

Mavericks 10.9.2 (don’t see that OS in drop-down menu for OS)

Lately many of my older InDesign scripts are broken in Mavericks.

I used to be able to just say:

tell application “Adobe InDesign CS6”
set theDocPath to (file path of document 1) as text
end tell

Now it fails.
Error seems to occur when I use a tell block for InDesign and want to do something that the Finder, System events or applescript itself can do, like coerce a file path into a string.

I did that partly for convenience and partly to avoid a lot of changing tell blocks, because changing the “tell” back and forth between InDesign and Applescript slows the script down (or used to)

Now it seems I must exit the tell block entirely before doing anything like coercing strings.
Why is that – something changed??

In the example below all of the commented-out syntax used to work , but not now.
I can’t even use “tell me” to jump out of the tell block anymore.

Even stranger, many scripts that I know have this structure do still run, but won’t compile anymore.


tell application "Adobe InDesign CS6"
--this worked in Mountain Lion, but not in Mavericks:
	--set theDocPath to (file path of document 1) as text

--now I have to do this and then can't coerce to text
	set theDocPath to (file path of document 1)
	--set theDocPath to theDocPath as text
	--set theDocPath to text items of theDocPath
	--tell me to set theDocPath to theDocPath as text
	--tell me to set theDocPath to text items of theDocPath
end tell
set theDocPath to theDocPath as text

What you might be able to do is get the name of the process first. Try running the Adobe app and get the process name. Then, get the name of the app. If I’m far off then disregard.

gl,
kel

Thanks to all and to Shane for the answer:

That’s not a Mavericks problem, but an InDesign problem. InDesign has its own “text” class, and it doesn’t work like AppleScript’s. I think this started in InDesign 6, although it ay have been earlier.

Fortunately the workaround is simple: when you want to coerce to text within an InDesign tell block, use “as string” rather than “as text”.