This content has been marked as final. Show 14 replies
Not sure where you got your info, but the "window" object is not part of core JS. It is provided by your browser, for your browser, only for use in your browser.
thanks for that, point taken. I got the information from w3schools.com (http://www.w3schools.com/htmldom/met_win_open.asp) but after reading your comment, I went back and realise I misinterpreted the examples and what was being said. I thought that I could access Windows Explorer by using the same function - I was wrong.
Back to square one. Any ideas how I could open an instance of Windows Explorer from within a PDF?
If Internet Explorer is set as the default browser, this might do the trick (you can change the string to point to whichever folder you want):
launchURL will not allow a file:// reference for security reasons. This is documented clearly in the API Reference.
You can use app.launchURL to open a link to a PDF hosted on the web somewhere, and if you want it to open in the system default browser (not necessarily IE, it will just use the system default) make sure you set the 2nd parameter to true.
PDL, did you try it? My guess is that you didn't, because it works.
I tried it using both Acrobat 8 Pro and Reader 9, and it worked in both.
I just added a button to a blank form, only script on the button is:
When clicked, the JS Console shows:
NotAllowedError: Security settings prevent access to this property or method.
App.launchURL:1:Field Button1:Mouse Up
(Acrobat 9.1 Pro Extended)
See the documentation at:
It specifically says:
Even if it was a bug and it did work (which it isn't since it works as documented), why would you recommend something that is forbidden by the documentation? As of any future update it could stop working and break the workflow, making him have start all over again with a different method.
Until now I ran it from the console, but after your message I've put it in a folder-level script, and it worked as well.
The reason I provided him with this information is that it's the only solution to his problem. It's up to him to decide whether to use it or not. Anyway, I wasn't aware that this was "forbidden by the documentation", which is obviously irrelevant since it's working.
> Anyway, I wasn't aware that this was "forbidden by the documentation", which is obviously irrelevant since it's working.
Not irrelevant at all, in fact you just explained why it's working for you but won't work from a document-level script. Running script from the console runs it in an elevated security context which is why it's working for you, but won't work if you add "app.launchURL" directly to a button.
Please see the security documentation in the SDK. A "priviledged context" is a batch, console or app init event.
Add you script to a button as I showed above and click the button. It won't work - security restricted, exactly as I and the documentation have been saying. Again, documentation correct.
If the form will be distributed to users who's machines you have no control over and who aren't going to open the console and run the script, meaning it has to be in a document-level script, it will not work.
OK, so we agree that it can work under *some* circumstances.
I'm very familiar with the different security contexts of Acrobat, maybe I didn't pay enough attention to the fact that he wants to run it from a link.
> OK, so we agree that it can work under *some* circumstances.
Thanks PDL, thanks try67,
your feedback and discussion is much appreciated. Try67, I haven't been able to get this to work yet, my results being the security error that PDL mentioned.
I need to do a bit more study. I'm trying to keep this as simple as possible by keeping the scripts in the document (i.e. the scripts are part of the link I put in), therefore not having to refer to external scripts in a folder, but if I have to I'll create external scripts. The document I'm working on will be delivered on a CD together with the files that I want displayed in a folder.
Thanks again for your help.