views:

75

answers:

4

I need to do click a button within the admin side of my external website and cause it to trigger an application within my local workstation (with parameters based on button). I have full control of the server, PHP, etc. I can also install any application on my workstation. What is the best way to do this? Adobe AIR/Flash? Java?

I need something simple and I am open to all ideas.

+1  A: 

Probably the easiest thing to do is to use a protocol other than HTTP. For example, Apple uses webcal:// urls to open iCal and subscribe to calendars. Your application will get the URL passed to it, and you can do whatever you like based on the data in the URL.

Here's on article on how to do this with Mozilla:

https://developer.mozilla.org/en/web-based_protocol_handlers

Sean McMains
+2  A: 

You can launch the program from a signed java applet. Try something like this:

String cmd = "notepad.exe";

try {
  Runtime rt;
  rt = Runtime.getRuntime();
  Process p = rt.exec( cmd );
  System.out.println( "Exit Value = " + p.waitFor() );
} catch ( IOException e ) {
  e.printStackTrace();
} catch ( InterruptedException e ) {
  e.printStackTrace();
}
no
Probably worth mentioning that this will only work with signed applets or a Java installation with seriously compromised security settings.
Carl Smotricz
Noted. I'm still pretty sure this is the "best" way to do it without requiring the user to jump through obscure hoops like registering uri scheme handlers, etc.
no
A: 

You can Register an Application to a URL Protocol (Windows link given).

Mark Peters
pretty interesting.. Thanks!
Pasta
A: 

You could do this in Java by having a listener on your workstation watch for a file that an applet from the site admin writes to, but that could be hard.

Flash/AIR would be more of a pain if you don't already have Flash CS4 or later, but it might be easier if you do. I don't know of a way to communicate directly between Flash and AIR, but there's probably something out there.

Matt