Applescript open folder on server from intranet link works, but...

Hi,


in our back office intranet web site, we need to let our local users to open folders from a repository.

Until now all this work was made by a jsp file (that is pointing to the desired folder), downloaded from our back office pages.

This jsp file was automatically opened by java web start, that open an applescript that display the desired folder to the user.


From some month, the various java update they have slowed all the chain (near 40 seconds from click to folder opening), and I need an alternative solution.


I think to be on the right way, I was started with this simple applescript (I'm an applescript newbie):


tell application "Finder" open ("/Volumes/SharedFoder/Folder/Folder/" as POSIX file) end tell


then I've URL encoded the script, an then added to an href in this way:


applescript://com.apple.scripteditor?action=new&script=tell%20application%20%22F inder%22%0A%20%20open%20(%22%2FVolumes%2FSharedFoder%2FFolder%2FFolder%2F%22%20a s%20POSIX%20file)%0Aend%20tell


And it works like a charm if... you manually run an close the applescript windows that appears when you click the link on back office.


I still need to automate the opening of the folder and the closing of the window, I've tried several way but until now no success 😐.


Any help is very much appreciated. 🙂

Posted on Mar 11, 2016 8:30 AM

Reply
4 replies

Mar 11, 2016 10:18 AM in response to Cesare Cerutti

At least now i quit Script Editor

tell application "Finder"

open ("/Volumes/SharedFoder/Folder/Folder/" as POSIX file)

end tell

tell application ("Script Editor") to quit without saving

Encoded url

applescript://com.apple.scripteditor?action=new&script=tell%20application%20%22F inder%22%0A%20%20open%20(%22%2FVolumes%2FSharedFoder%2FFolder%2FFolder%2F%22%20a s%20POSIX%20file)%0Aend%20tell%0Atell%20application%20(%22Script%20Editor%22)%20 to%20quit%20without%20saving


But still no automatic launch 😟

Mar 11, 2016 11:47 AM in response to Cesare Cerutti

I'm a little confused by your goal here.


For one, if you want to open a folder in the Finder, just craft a URL in the form:


file://Volumes/SharesFolder/Folder/Folder/


The browser should pass file:// URLs to the Finder that will do what you want.


Secondly, there are inherent security issues in crafting (and running) AppleScript via URLs - imagine the damage you could do with a malicious AppleScript that trashed your system just by clicking on a link. There are safeguards in the OS against this kind of thing, and as such, you may have problems taking the AppleScript route.

Mar 12, 2016 2:02 AM in response to Camelot

Thanks for the answer, I've already tried this method, but it doesn't works.


To be clear it works, but only if the html page with the link is on a local computer, but not from the server, I've tried:


file://Volumes/SharedFolder/Folder/Folder/

and more correctly

file:///Volumes/SharedFolder/Folder/Folder/

that's the reason for which I try to use applescript.


I'm conscious about the security issue, and that's the reason that I want to "autorun" the script, I don't want that users can inadvertently modify the script.


To be clear, those scripts run only on our intranet, so no one else than our coworkers can run them, to be more clear no more than 4 or 5 people and no one of them with any admin permission, so the danger is "relative".

Mar 14, 2016 6:18 AM in response to Cesare Cerutti

To be clear, those scripts run only on our intranet, so no one else than our coworkers can run them, to be more clear no more than 4 or 5 people and no one of them with any admin permission, so the danger is "relative"


Sure, you know the danger is 'relative', but the OS doesn't know that, which is why there are controls at the system level to prevent auto-run scripts via web pages.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Applescript open folder on server from intranet link works, but...

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.