Javascript in AppleScript problem

I need to change the value of the ‘Title’ field of a PDF.

The scripting dictionaries of Adobe Acrobat 6 and 7 say the syntax should be -

set info active doc key "Title" value "A new value"

When compiled, this becomes -

set info active doc key "Title" input volume "A new value"

This is totally useless and, naturally, errors.
In order to get around this, I decided to insert a Javascript snippet using the “do script” command

do script " = \"" & newValueStoredInVariable & "\";"

This works fine when it’s part of a script run from Script Editor, but it does not work when run from a script in AppleScript Studio (Xcode 2.4, OS 10.4.8).
It doesn’t cause an error, it’s just ignored.

Any ideas?

Hi Simon,

I’ve tried it and this solution was working for me:

property titleScript1 : "tell application \"Acrobat 6.0 Professional\" to tell document 1 to do script \" = \\\""
property titleScript2 : "\\\";\""

on clicked theObject
	set newValueStoredInVariable to contents of text field "tf" of window "main"
	run script (titleScript1 & newValueStoredInVariable & titleScript2)
end clicked


Thanks D,

Looks promising. The project in question resides on my machine at work. I’ll test it on Monday and let you know how it goes.