These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Command + Enter to Execute Javascript in Debugger from Macbook/Leopard

abridges
Registered: Dec 13 2008
Posts: 3

Does anyone have a work around for the fact that you cannot execute a command in the debugger from a Macbook using Command + Enter?

My Product Information:
Acrobat Pro 8.1.3, Macintosh
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi abridges,

I don't use a mac but the Console Window should execute the code. What are the exact steps you take and code you are having trouble with? If you have multiple lines of code are you selecting them all before hitting Command + Enter?

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
greenmj
Registered: Aug 21 2006
Posts: 21
No the console does not respond and execute the code - be it one line or a selection of lines.

Apple has changed the keyboard - my six year old iBook had both a Return and an Enter key - with a numeric keypad shadowed over the standard keys. Now the new computers, both iBooks and MacBook Pros share an "enter return" key. The Acrobat Console does not respond to:
1) Enter/Return
2) Control + Enter/Return
3) FN + Enter/Return
4) Alt/Option + Enter/Return
5) Command + Enter/Return

When multiple lines are selected there is a danger that the Return key will delete the selection.

I have tried talking to staff in an Apple retail store but they did not find an answer. There is a keyboard remapping utility but it also did not seem to work. What a pain to NOT be able to use the Console to run code! :-( I've been using Acrobat Pro 7 and 8 on Macs with full keyboards (the numeric keypad's Enter key) but the laptops are now "broken" for my PDF JS work.

I wonder if there is an Accessibility trick that would make this work?
greenmj
Registered: Aug 21 2006
Posts: 21
As a workaround, the Console does have a 'split personality' view - mostly I use just the Console view but there is a "Script & Console" option. Use the hierarchy to drill down to the object script and look for the pencil icon in the space between script and console. This gives quick access to edit the script.I've arranged the view to allow my button with script to be activated while the Console is visible.

This is NOT running a script with the console ...
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi greenmj,

That is some bummer news :(

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
greenmj
Registered: Aug 21 2006
Posts: 21
Right now, try this old tip from Kas Thomas under the heading "Test-Fly Pieces of Code" at http://www.planetpdf.com/developer/article.asp?ContentID=6516

Build a quick PDF with a field and a button to execute the code with a app.alert feedback or print to console or other improvements.

I'd rather the Console with Command/Ctrl/Fn + Return worked as 'enter'
Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
I don't if it's still available around the web, but there was a great free utility named "ScriptEase". Very useful to manage and to test JavaScripts using Acrobat.

Otherwise, if you can't find it, I can send it to you, it's OK with the licence agreement.

;-)
j_shell
Registered: Nov 16 2007
Posts: 25
Not having a MacBook handy, I can't say whether this works (and it may be the utility you already mentioned), but this key mapper might work for you.

[url]http://www.pqrs.org/tekezo/macosx/keyremap4macbook[/url]
greenmj
Registered: Aug 21 2006
Posts: 21
Problem seems to be Adobe code is looking for a specific REAL key called "Enter" and is not recognizing the Mac OS sending Enter as a key combination of Function+Return.

This was just confirmed at the Mac User Group meeting by opening up Script Edit and using the Fn+Return to compile an Applescript. Also, an external keyboard Enter key will run code in the Acrobat Console but Fn+Enter does not work in the Console.

Please refer problem to programmers at Adobe.
kwakita
Registered: Dec 5 2008
Posts: 1
Hi,

I was suffering from this issue too. Last night, I made a small script that presents a JS interaction dialog, attached below. Save it in an appropriate folder, reboot your Acrobat. When you open a pdf, a small "Debug" button appears on the toolbar. Click it, and a dialog appears. Your input is sent to the JS console. I hope it works for you.

function DebugApplication() {

DebugApplication.JSInteractionDialog = {
initalize: function (dialog) { dialog.load({}); },

commit: function (dialog) {
var results = dialog.store();
console.show();
console.println('JavaScript Input:');
console.println(results.scrp);
console.println(eval(results.scrp));
},

description: {
name: "JavaScript Interaction",
align_children: 'align_left',
width: 350,
height: 200,
elements: [
{ type: 'static_text',
name: 'JavaScript fragment: ' },
{ item_id: 'scrp',
type: 'edit_text', multiline: true,
alignment: 'align_fill',
width: 300,
height: 150 },
{ type: 'ok',
alignment: 'align_right' } ]
}};

var debugEntry = {
cName: 'DebugEntry',
cExec: 'app.execDialog(DebugApplication.JSInteractionDialog);',
cTooltext: 'Open a JavaScript interaction dialog',
cEnabled: true,
cLabel: 'Debug' };

app.addToolButton(debugEntry);

} // Application [Debug]

DebugApplication();
greenmj
Registered: Aug 21 2006
Posts: 21
kwakita -- thanks for this script! I struggled with the location for my copy of the script and finally found the AcroJS.pdf for v7.0.5 with a reference to running app.getPath("user","javascript") from the console. The path location was buried in /Macintosh HD/Users/accountname/Library/Application Support/Adobe/Acrobat/9.0_x86/JavaScripts/ Your Debug toolbar appeared like magic and works easily for typed input. Debug does not seem to support Edit > Paste input.http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/javascript/AcroJS.pdf
khkremer
Acrobat 9
Registered: Mar 8 2006
Posts: 4
I just blogged about this problem - take a look here to see how the virtual keyboard can be used to execute JavaScript on a MacBook: http://www.khk.net/wordpress/2010/03/23/javascript-console/#AUC

PDF Acrobatics Without a Net
http://www.khkonsulting.com