Adobe InDesign script wont work with CC

I´m new to scripts so please forgive me for using the wrong terms. I´ll try my best.

I inherited a workflow wich i did not design.
The script works fine with Adobe CS3 and Snow Leopard.
But when i try to run it in Indesign CC and Mavericks it gets stuck.
I´ve changed -Tell Indesign CS3- to -Tell Indesign CC-

The error message in automator says (translated from swedish):
“xxx.pdf” doesnt understand “place”-message
If I delete the place-command from the script it all runs fine. But of course it´s useless without the Place-command.

Here is the failing part of the script

		tell myDocument to place theImage on myPage place point {-10, -10}

And here is the whole script:

on run {input, parameters}
set loResFolder to “Produktion:veckans nummer:loRes:”

# Är det verkligen fredag?
set theDate to (current date)
if (weekday of theDate) as string is not equal to "Friday" then
	repeat until (weekday of theDate) as string is equal to "Friday"
		set theDate to theDate + (1 * days)
	end repeat
end if

# Formatera datum
set {year:y, month:m, day:d, time string:t} to (theDate)
set dateFormat to (y * 10000 + m * 100 + d) as string
set dateString to (characters 3 thru 8 of dateFormat) as string

repeat with myFile in input
	set theImage to myFile as string
	tell application "Finder" to set theFileName to name of file theImage
	tell application "Adobe InDesign CC"
		set loRes to properties of PDF export preset "loRes"
		set myDocument to make document without showing window
		tell document preferences of myDocument
			set page height to "203mm"
			set page width to "267mm"
			set page orientation to portrait
			set pages per document to 1
		end tell
		set myPage to page 1 of myDocument
		tell myDocument to place theImage on myPage place point {-10, -10}
		set loRes to properties of PDF export preset "loRes"
		set properties of PDF export preferences to loRes
		export myDocument format PDF type to loResFolder & dateString & theFileName without showing options
		close myDocument saving no
	end tell
	--return input
end repeat

end run

Hi headrick, and welcome to MacScripter

try changing out the offending line and replace with this, see if this works

place (theImage) as alias on myPage place point {-10, -10}

Budgie - you are a genuis!
It works.

How come it works without refereing to myDocument?

because myPage is already referred to from myDocument in the line before it. if you were using “page 1” or some numbered page that would be different.

Hello Budgie,

I just wanted to let you know that the “as alias” addition to the place command solved a tenacious little problem that I was having. Maybe if I write it down, others will be able to find it too.

I have a complex applescript that has been running fine in InDesign CS4 for years. When I migrated from a Snow Leopard machine to a Yosemite machine running InDesign CS6, the script broke at the “place” commands.

The script referred to a colon-delimited path and filename as a string. Your suggestion to the original poster to add “as alias” turned out to solve my problem too! So thank you for that.

One other little “gotcha” in InDesign CS6 is that the way that text frames are “named” has changed. InDesign CS4 has the scripter entering the text frame name in the Script Label panel. InDesign CS6 requires that the name (also?) be entered into the Layer Palette. It’s not obvious how to do this. Twiddle the disclosure icon in each layer to reveal text frames. By default, they are named “”. Triple click on that name to make it editable, then replace with the desired name for the text frame. Then it is possible to refer to the text frame by name in your applescript – something like:

set TextFrameRef to text frame named "Text Frame Named in Layer Panel"

As is often the nature of these things, discovering these two little bits of info represents about a day of work!

Pipsqueak, that frame name explanation was fantastic. I had a rough time going from InDesign CS4 to InDesign CS6 because of the ridiculous label/name change. Based on something I read I went in and changed hundreds of scripts to the cumbersome form "(item 1 of (every text frame whose label is “xxx”))!

I just ran this script on one of my templates and it worked like a charm. Now I can go back to using the simpler reference.

tell application “Adobe InDesign CS6”
tell document 1
set textFrames to every text frame – all in document
repeat with aFrame in textFrames
set name of aFrame to label of aFrame
end repeat
end tell
end tell

So now, for example,
delete text frame “column3”