Skip to main content
March 15, 2016
質問

Javascript Tooltip clearing issue

  • March 15, 2016
  • 返信数 3.
  • 1458 ビュー

I have using the script below to clear a massive amount of tool tips and am getting a syntax error from the javascript debugger. Can someone let me know possibly why I am encountering this? I can't seem to get it to work on a test PDF with simply name fields as well. I know I gotten this to work before.

// Set all field tooltips to blank
for (var i = 0; i < numFields; i++) {
getField(getNthFieldName(i)).userName = "";
}

SyntaxError: syntax error

1:Console:Exec

undefined

Thank you

このトピックへの返信は締め切られました。

返信数 3

March 15, 2016

I ended up uninstalling acrobat to make sure it is now any settings/preferences that could trigger this hiccup, did that and redid the script and it worked. Thank you to everybody

Inspiring
March 15, 2016

It is a good practice to include the "object" of the property or method you are trying to access or modify. All the properties and methods you are trying to use refer to the current opened and focused PDF, so I would add the "this." for the object;

Have you tried to add any debugging statements to print out the item being processed?

// Set all field tooltips to blank
console.show();console.clear();
console.println("number of fields: " + this.numFields);
for (var i = 0; i < numFields; i++) {
console.println(i + ": " + this.getNthFieldName(i) + " " + this.getField(this.getNthFieldName(i)).userName);
getField(getNthFieldName(i)).userName = "";
}

March 15, 2016

I did try the script provided with the same error.

try67
Community Expert
Community Expert
March 15, 2016

Works fine for me. Are you sure you're selecting the whole code when you're executing it?

March 15, 2016

Well I pasted the script above exactly so if that's what you validated, I am not sure why it doesn't work for me.

I merely place it in it in the javascript debugger > script and console

Karl Heinz  Kremer
Community Expert
Community Expert
March 15, 2016

To execute more than one line in the JavaScript console, you have to select all of it. Take a look here for more information about how to use the console: https://acrobatusers.com/tutorials/javascript_console