Very basic applescript question.

hi guys, I’m a seasoned developer but a noob at applescript. I have a web app that generates some applescript that I want my visitors to download and run and have some problems

running my web applications I hit a link in the app that references the script like

regular script app script
  1. if I create a regular script file its downloaded to the desktop but then the client has to run it using the script editor
  2. if I create a application script like myscript.app it is not downloaded properly - in firefox 2.0 it appends .exe to the end (bug?) if I option click the file in firefox or safari I get a warning its a binary file and and asks me if i want to run launch it, once I say yes the scripts’ icon changes to a “stop” sign and osx tells me I can run the script “myscript” beacuse its not supported by the system.

can someone help, its driving me nuts :slight_smile:

Grant

What problem are you attempting to solve? Why do you need to generate custom scripts for visitors? This methodology seems highly strange.

Compress them into a zip file.

regular script (compress)

Zip is the most diffuse method for compress files. No browser problem, no virus detected, no strange message.
if you want, inser the description

“Please, unzip the file for execute it”

Bye

Mikey san, I agree it seems a little strange :slight_smile:

My web application is an asset ingest system for video, the videos are put on a shared drive on the web server that the client osx based machines can access through a shared mount. What my client wants is when a client machine accesses the web app through the browser, they can click on a link that will open the finder pointing to the shared folder so for example

support we have a mapped drive of

/shared/assets/asset1/

/shared/assets/asset2/

shared/assets/asset3/

etc…

in the browser there is a html table with the different asset descriptions, how many videos there are per asset folder etc…

when a user clicks on a link on a row in the table they client wants me to launch the mac finder referencing the physical location of those files, so if they user clicked the link for asset1 in the html table I’d popup the finder and display the folder /shared/assets/asset1 in it via applescript. The user would then drag/drop their videos to their desktop from finder for editing.

I could not find any other way to launch the finder, I have to support firefox and IE on the mac for this application, firefox seems hell bent on preserving security which I would agree with but unfortunately I have to figure out a way to launch a desktop app (finder) from a webbrowser.

Cheers
Grant

Hi Grant,

Where are the folders on the users computer? i.e where is this:

/shared/assets/asset1/

Edited: nevermind, it’s on the mounted disk.

gl,

Could you have a script that the user launches, parses the html source, and uses that information to find the assessts rather? Seems like a better way to me as long as the HTML set up right.

Hi Grant,

You can try this. For you link, use a url like:

(a href=“file://localhost/Volumes/TestImage/shared/assets/asset1/”>asset1</a)

where asset1 is the name of the link. TestImage is a mounted disk image I had to use. When the user clicks on the link to a folder (“asset1”), Finder opens the folder. I changed the angle brackets to parenthesis for posting.

gl,

Jerome, not sure I understand you question/plan.

the whole issue I have right now is even launching a script to show the folder that the video’s are in on the “desktop” or launching a script that can open finder… I know it has some security implications and security warnings are ok, but right now it appears that if I try to open an applescript “app” file from safari or firefox it gets trashed, probably for security reasons. If there is some setting I can make on the clients to say “allow applescripts to be opened from the domain” then that would work too… We have full access to all the client machines and can make client specific settings to support these requirements.

Cheers
Grant

kel, thanks I tried the file link but firefox doesn’t process it, it writes to the error log that its a security violation that the domain can’t access the local disk, maybe there is firefox setting we can change ?

Grant

Try file:/// instead.

Grant:

I think the only way you’re going to get uniform behavior from the various browsers you need to support is with a custom protocol.

Use this forum’s internal search for the term ‘protocol helper’ and you’ll find a number of relevant threads.

Yes, there are definitely security considerations… especially if you’re hosting the access pages on the web… rather than a closed local network.

Peter B.


A custom protocol seriously sounds like overkill.

I’m not sure why custom-generated AppleScript is required here at all, honestly.

I’m going to try the file link again but I’m pretty sure firefox will block it.

I’ll then look at custom protocols, thanks a bunch, this really helps, I’ll probably be back for custom protocol help :slight_smile:

Grant

Peter it is actually a closed local network, xserver is the webserver on a gigabyte lan and the clients are pc’s and macs, but predominately mac’s running finalcut pro that will want to use the web app to find the assets and then finder to drag the files to their desktop for editing… the webapp will have 1000’s of assets and provides the “search” interface. We could have written the whole app in cocoa instead but it was time/cost prohibitive and this function is the only desktop style function we need, poping the finder…

Mikey-San wrote:

Perhaps you’re right, but… do you have an alternative solution?

The original poster hasn’t specified exactly why the workflow needs to be set up as he describes… but I assumed he had his reasons, so I replied in that spirit.

He might be better served simply by making .zip or .dmg files of the assets involved and having his clients download them directly.

Peter B.


I didn’t install Firefox this time, so can’t check to see if it opens local urls.

Hi guys,

the workflow is this

reporter uploads lots of video via the asset ingest application (php, web based app). A unique folder is created for each project, there will be 1000’s of projects and each folder will have 2 - 30 video files, we generate thumbs on the fly for each video that is displayed in the asset ingest app.

Now the Editor, says “I need footage of gardening” so he searches the system for “gardening”, finds some matching projects and clicks one, it shows him some thumbs and about 20 video files that he plays within the browser. He decides this is good footage and now he want a copy of the video, they want to open a finder window to the actual video on the server NOT copy of it as these files are HD raw video in terabytes of size so they only pick the files they want and they want to drag/drop the particular files from finder to their desktop for editing.

I think they could “download” some of the files, but client has requested finder visibility of the file sytem via the browser and the client gets what they want in the end since they pay the bill :slight_smile:

The download portion of what you are describing is very much like the Transmit interface which is drag and drop from “yours” to “theirs” and vice-versa. Further, Transmit is quite scriptable with instructions like “connect to favorite”. You could automate that. It does both flavors of FTP (public and secure) and of WEBDAV

just a question before I get too involved in the custom protocol, is this handled correctly when using the firefox browser, i.e. it defers protocol handling to the OS if he doesn’t understand the protocol ? I can’t have a safari only solution.

Grant:

Yes… at least as of Firefox 1.5.0.7… but you must jump through all the other hoops required in the protocol preparation and will need a third party utility - More Internet, MisFox (or similar, both mentioned are freeware) to enable the protocol (a one time only set up). You will also encounter additional ‘Are You Sure?’ dialogs when you first run your protocol app - either from the browser or OS X. These can be dismissed readily and won’t show again… typically.

I use my own protocol - ‘Missing Link’ - everyday to access local files, folders, run scripts, etc. from local HTML pages. It does pretty much exactly what you’re looking for.

I wouldn’t leave home without it.

Peter B.