InDesign suddenly stopped understanding the term "file"

I wonder if anyone can explain the following bizarre issue:

After I restarted my Mac yesterday, InDesign stopped understanding the term “file”.

For example, a script like this cannot be compiled anymore:

tell application "Adobe InDesign 2020"
	export document 1 format PDF type to file myHFSPath using PDF export preset 2
end tell

I get the alert “Syntax Error”, “Expected end of line, etc. but found identifier.”

If I remove “file”, the script compiles. The script also works, fortunately.

It affects all occurrences of “file” inside “tell InDesign” blocks.

Those scripts worked for years with no issues. Like I mentioned, the issue suddenly started after a reboot.

I had to remove all the occurrences of “file” to compile the script - which I had quite a few.

It doesn’t seem to affect the script functionality so hopefully it’s not a big deal.

I still wonder why this issue suddenly popped up out of the blue.

macOS 10.14.5
InDesign 2020, also CC 2018/19

You may have that sort of issue if you have a “use framework …” statement in a script. In the case of InDesign you can usually use just a path, otherwise it’s best to form the file reference outside the tell block, as «class furl»:

set theFile to myHFSPath as «class furl»
tell application "Adobe InDesign 2020"
   export document 1 format PDF type to theFile using PDF export preset 2
end tell

Thanks Shane,

There are no “use framework…” statements there…

The same error happens if just sending this command from Script Editor.

I also discovered that it affects only recent versions of InDesign - but not antique ones like CS6.

In any case, this issue is indeed easily resolved by removing the “file” term altogether.

I’m mostly curious why this problem suddenly struck out of the blue after a reboot - while the same scripts compiled for years with no issues… Probably one of those bizarre issues that will remain a mystery.

Leo

From my experience InDesign and other Adobe apps work best with HFS string paths without the file keyword

For safe you may use

if class of myHFSPath is alias then set myHFSPath to myHFSPath as text
tell application "Adobe InDesign 2020"
	export document 1 format PDF type to file myHFSPath using PDF export preset 2
end tell

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 26 décembre 2019 12:11:04

The issue is that the above script - as well as anything with the term “file” inside “tell InDesign…” blocks - won’t compile anymore.

InDesign stopped accepting the term “file” for some reason.

As mentioned in previous posts, fortunately “file” isn’t required and can be safely removed from scripts altogether.

I didn’t wrote that, I wrote:

if class of myHFSPath is alias then set myHFSPath to myHFSPath as text
tell application "Adobe InDesign 2020"
   export document 1 format PDF type to file myHFSPath using PDF export preset 2
end tell

The first instruction was written so that, in case you pass an alias, it is coerced as a string which was supposed to be treated by the instruction:

export document 1 format PDF type to file myHFSPath using PDF export preset 2

Searching on the Web I found InDesign_ScriptingGuide_CS55.pdf and InDesign_ScriptingGuide_CS6.pdf and discovered with surprise that in every examples they pass a string value to define a file to write.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 27 décembre 2019 11:52:06

Yvan, the crucial part the is file keyword. The most reliable syntax is to omit it. Please see my post above.

Thanks StefanK

It’s what I discovered in the guides which I pointed to in my late message :wink:

I’m surprised by the fact that the OP discover that now. The pointed guides are dated 2011 and 2012.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 27 décembre 2019 14:14:50

it looks like that might no longer be the case. Someone just posted on the AS mailing list that the code place file pic was failing, where pic was an HFS path. Removing the word file unfortunately doesn’t fix the problem. (Using a «class furl» or coercing to an alias does.)