Skip to main content
Elementaryfa
Participant
May 21, 2021
Question

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

  • May 21, 2021
  • 1 reply
  • 380 views

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?

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
May 21, 2021

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