AppleScript to mimic local server

Would It Float?

This may or may not be old news to some here…

With the help of a friend, I seem to have figured out a way to pass form input from HTML and JavaScript to a local AppleScript handler… which can (or could) in turn pass parameters/variables to other local AS scripts. The effect being a local ‘server’ behavior… without need of the server. It appears to be reliable.

What (I think) this means is that you could create a front end or GUI in HTML for almost anything you might like to do with AppleScript locally. (This is not intended or targeted for web use. Nor is it just another rehash of Missing Link… though there’s a direct relation.)

There are many questions and issues to resolve… and ‘LocalServer’ may never see the light of day, but here I am out on a limb again… without a clue as to its potential or merit.

What does anyone think?

Thanks for any/all comments.

Peter B.


Hi Peter,

It seems that lately, requests for this type of interaction have been increasing in frequency. While some scripters want to be able to embed executable AppleScript code in HTML on the WWW, others want something to deploy only on their LAN. This leads me to believe that your idea is worthy of further exploration. I’m not much of a HTML/JavaScript coder but, if you decide to move forward with this, I’ll be glad to help in whatever way I can.

Good luck!

– Rob

I am curious how you would go about implementing this. I know how to get AppleScript to return JavaScript form data from a browser (though you have to know which browser, window & information about the form itself and this has to be initiated from the AS side, not the JS side). I have also detailed several times on the board a way to have folder actions or a stay open script monitor a folder for a new file with the form data written to it from PHP. As far as I know, JS alone cannot write to a text file (although you can do this with an ActiveX control) but that isn’t an option for all browsers. I have some other ideas how you might implement this but I’d be interested in learning more, if you’re comfortable with that, of course.

As to the idea itself, yes, I think this would be very useful and have lots of interested parties but, as with everything, I’d be hesitant to open this to the masses because it presents serious security issues.

Jon

Rob & Jon:

Thanks much for your initial replies. I need to do more bulletproofing tests before making any additional claims… but I think the basics are in hand.

Implementation: ‘LocalServer’ (for want of a better name at this point) is - like Missing Link - a browser protocol… which means it works for most browsers without having to target an individual one to make a request for specific page or window content.

The AppleScript protocol handler ‘reads’ the aggregate URL passed to it and can take any action it wants on it… or hand it off to another AS script that can deal with it.

The ‘triggers’ for this ability come from Standard Additions… coupled with HTML and JavaScript. No extensions or bizarre coercions are necessary.

I’m sorry if this is still obscure. I’m only a couple of days into thinking about it all myself… and I have a feeling, if I got serious with it, I would be asking for a lot of help.

If you could take this much for true, what might you do with it? Am I trying to reinvent several wheels at once?

And/or/if there were similar windows of opportunity in Windows, or Linux or… ?

The cool thing about browser protocols is that they might go anywhere.

Pie & Sky

PB

PS - Jon: I’m only too well aware of security problems. It seems every time I come up with an idea, I get hit with the same bat. What am I doing right? :wink:


I’m now subscribed to this topic, and waiting for news :stuck_out_tongue:

I’m curious what became of this idea…

If you click on the email link next to one of his posts and below Peter’s name, you can Personal Message him and ask.

SwissalpS:

Look here…

http://scriptbuilders.net/files/missinglink2.3b3.html

… updated as of Friday 7/6/07.

To others interested:

I’d like to hear what you might think of Missing Link. It is still beta, and may never go beyond, but it seems reliable and has (I think) some interesting features.

Thanks.

Peter B.