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

app.openDoc() return something to JavaScript console even using try{} catch {}

New Here ,
May 21, 2021 May 21, 2021

Copy link to clipboard

Copied

I tried using app.openDoc to test wether a file exist or not, like this 

It does work (although bHidden set to true is ineffective)... unless a file doesn't exist or there is an open handle of the file in another application. In both cases,it returns the same NotAllowed error, so using try{} catch {} to discern between both cases is useless. However, if file doesn't exist, it prints that directly in console, regardless of where the script is (batch, document or folder level) and how i try to escape this. I can only clear console with console.clear(), but i didn't find a way to catch this. So the question is: is there a method to read console output or to pipe that into variable, to check if a file exist? Also is possible to make the "bHidden" parameter to work?

TOPICS
Acrobat SDK and JavaScript

Views

66

Likes

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 ,
May 21, 2021 May 21, 2021

Copy link to clipboard

Copied

LATEST

> is there a method to read console output or to pipe that into variable, to check if a file exist?

No.

 

> Also is possible to make the "bHidden" parameter to work?

No. It seems to have been deprecated without being documented, which is very annoying, but not the first time it happens.

Likes

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