I often use Acrobat automation in Delphi applications I write, usually without any problem.
At the moment, I'm trying to write a Delphi application to assist other developers retrieve the list of menu item names available to use with CAcroApp.ExecuteMenuItem.
So far, I've found this script which gets a list of menu item names
function FancyMenuList(m, nLevel)
var s = "";
for (var i = 0; i < nLevel; i++) s += " ";
console.println(s + "+-" + m.cName);
if ( m.oChildren != null )
for ( var i = 0; i < m.oChildren.length; i++ )
FancyMenuList(m.oChildren[i], nLevel + 1);
var m = app.listMenuItems();
for ( var i=0; i < m.length; i++ ) FancyMenuList(m[i], 0);
and I can execute that by hand (in the Acrobat gui) in the JS console window fine, and copy the output to the clipboard.
What I'd like do do is to run the script and retrieve its output back into my Delphi app, and that's where I'm stuck.
I'm using Acrobat 8, btw.
As an alternative to using ExecuteThisScript, you can also install a folder level script and execute that via the JSObject. See this tutorial for more information: