• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Temporarily set "When exception is thrown Ignore" via Javascript? Possible?

People's Champ ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

Hello!

I'm working on a form script that (unfortunately) relies a little on a try-catch statement.

The problem is that if the user sets their Acrobat to trace or break on exceptions, the Debug Console pops up every time there's an error (despite it being caught by the catch statement), disrupting the script.

I could try to teach the users to make sure they set the debugger to ignore errors before running this script, but the chances they'll actually do that are essentially nil.

So the question: Is there a way (at least temporarily, for the duration of the execution of the script) to set the debugger to ignore caught errors? Are Acrobat's Javascript preferences scriptable?

Or is there some other way around this issue?

Thanks!

Ariel

TOPICS
JavaScript

Views

766

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 04, 2023 Sep 04, 2023

Not possible.

Votes

Translate

Translate
Community Expert ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

Not possible.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

> Are Acrobat's Javascript preferences scriptable?

Some preferences are, but not anything related to JS itself, of course. That would be a huge security risk.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

Hmm, if it's not possible, I'm wondering what the best way to handle this situation is.

In this case, I'm trying to apply a font to a field, but I can't be sure which of several options the user has installed.

I'm going through a list of possibilities, applying each with myField.textFont wrapped in a try-catch. If applying the font throws an error, I try the next.

Is there a better way of knowing whether a particular font is available for a user without relying on try-catch like this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 05, 2023 Sep 05, 2023

Copy link to clipboard

Copied

That's the only way I'm aware of.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Sep 05, 2023 Sep 05, 2023

Copy link to clipboard

Copied

Thanks, One feels Adobe could up their game a little when it comes to Acrobat scripting...

Is the debugger set to "ignore" by default? Most users probably haven't changed the default setting, so i suppose if it's ignore by default I can presume that the issue won't be too common?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 05, 2023 Sep 05, 2023

Copy link to clipboard

Copied

LATEST

I agree there are many areas where the scripting model can be improved...

 

I don't have an answer as to whether the debugger is disabled by default, but I think it is.

But you can make the Console (and Debugger) window appear via your code:

console.show();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines