Need an Applescript Expert

Bob Sneidar bobsneidar at iotecdigital.com
Mon Oct 23 18:57:25 EDT 2017


Hi all. 

When populating forms on a Macintosh, I figured out a nice little hack which allows me to populate a fillable form with values using AppleScript. The trick is to tell Applescript to tell Acrobat to run a Javascript! Seems a little convoluted but it works great. 

So I discovered recently that Applescript can run Javascript natively! Great. I figured I would bypass applescript and pass javascript directly! But I've run ingo a snag. Here is a quick sample of what works:

tell application "/Applications/Adobe Acrobat DC/Adobe Acrobat.app"
set theScript to "this.getField(\"technotes\").value = \"This is only a test. \";"
do script theScript
end tell

Don't let the backslash quotes trip you up I am just escapting quote characters. Now the Javascript version *should* look like this but it does NOT work!

Acrobat = Application('Adobe Acrobat');
Acrobat.activate();
delay(1);

this.getField("technotes").value = "This is only a test.";

I get an error that this.getField is undefined! Whaaaaa??? Why does it work as an applescript command then??

Bob S






More information about the Use-livecode mailing list