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
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.
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
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
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.)