Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

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

New Here ,
May 21, 2021 May 21, 2021

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
353
Translate
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
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.

Translate
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