I want to be able to alert individual client’s when a task has changed on our intranet, without them having a browser open.
My thinking is that a PHP script makes the decision to either start or stop an applescript on the client mac. The PHP bit is real easy for me, but not the Applescript.
Can Applescript create an icon in the menu bar and flash it?
Can I remotely activate the script on an individual machine over a TCP/IP network?
Can an Applescript run indefinitly until it is told to stop?
The client’s are MacOS 9.2.2. The server is an OSX 10.2.6 Mac running PHP 4.3. The network has manual IP addresses… so each machine always has the same IP address.
Any ideas, pointers etc will be gratefully received…
The way to do this (I’ve got it working on my Mac) it that you code PHP to create a text file in a folder based on the results of some web action. You also have a stay open AppleScript with an idle routine (like the one above) constantly looking for the new file. The AppleScript could read properties from the contents or the title of the new text document and delete it when it’s finished.
To pass values back to PHP from AppleScript, just do the opposite, have the AppleScript write the values to a text file and have PHP look for that file (set a loop checking for the returned file exiting when it’s there) then read, parse, and delete the file.
So I got pulled off this project and stuck on another… but back into it now.
Thanks Jonn8
I’ve taken your workings and added a bit to both the PHP and the Applescript.
Essentially I write a file from PHP that contains the user_name, password, ip_address, and a short message. (The users ip_address gets updated everytime they log in… so if they swap machines or the DHCP server does a client reset it doesn’t matter).
Then I’m just watching for a new file and then reading it in Applescript and setting the variables from the file.
And it works brilliantly for both OS 9 and OS X clients (although the applescript only runs reliably on our OSX server).
Plus users don’t even need to have their browser open… as long as they’ve logged in on the machine they’re sitting at they’ll get the new task message.
Many thanks to everyone and if you’d like the code please feel free to contact me.