iChatStatusPublisher
Posted on August 9th, 2004 @ 11:15 PM EST
Description
iChatStatusPublisher is a stay-open script application that enables you to make your site more interactive by displaying your current iChat status. When you’re available, it will display a hyperlink that your visitors can click on to send you an instant message.
Requirements
- Mac OS X 10.1 or higher
- iChat AV
Installation
- Download the script.
- Create a new folder named “iChat” in your user’s Library folder (/Users/USERNAME/Library/iChat).
- Open the Script Editor which is located in the AppleScript directory inside your system’s Applications folder (/Applications/AppleScript/Script Editor).
- Copy and paste AppleScript code into the top box of the Script Editor.
- Edit the config variables at the top of the script and enter the appropriate information. I recommend using the SCP option as it is a more secure method of transfering files. If your web host does not support connections via SSH then you’ll need to use FTP. In this case I recommend creating an additional FTP account that just has access to a sub-folder on your account to help minimize security risks.
- Click “File” then “Save As…” and a dialog box will appear (see below).

- Save the file as “iChatStatusPublisher” and save it to your system’s Applications folder.
- Select “Application” from the File Format drop-down menu.
- Check the option to “Stay Open”. This will keep the script running in the background so it can communicate with iChat.
- Go to your Applications folder and double click on the icon for “iChatStatusPublisher” to run the script. You may also want to create an alias to the script and save it to your Desktop.
- Copy the PHP code and paste it where you would like the iChat status to appear on your webpage. This file must be saved as a .php file. (If your page is currently saved as an .htm or .html file, please see the instructions below on how to get it working on your page.)
- Edit the config variables at the top of the script and enter the appropriate information.
You should now be up and running! If you have any questions or problems, feel free to send me an email or post a comment. Feedback is greatly appreciated!
SCP Transfers
SCP (Secure Copy) is an alternative to using FTP and is a more secure protocol. Much like SSH, it uses secure shell encryption to protect your information in transit. If you would like to transfer the data to your webserver using SCP then follow the instructions listed below. If you’re not sure if support for SCP (SSH) is available to you, you’ll need to check with your web host to see if they support this feature. In order to transfer files via SCP, you’ll need to generate an SSH public/private key pair. These instructions assume that you don’t have any other keys present on your web server.
- Open Terminal on your local computer and start a new shell session from the File menu.
- Type “ssh-keygen -d”.
- After entering the command, press the enter key three times.
- Your public and private keys are now saved to “~/.ssh/id_dsa.pub” and “~/.ssh/id_dsa”.
- Copy the key to your webserver by typing “scp ~/.ssh/id_dsa.pub yourdomain.com:.ssh/authorized_keys2”.
- Enter the password for your account on the webserver when prompted then press the enter key.
- Test the SSH key by typing “ssh yourdomain.com”. It should log you in without a password. If not, check to make sure you typed everything in correctly.
- If you successfully connected to your account then you should be all ready to start uploading your iChat status file to your webserver.
If Your Pages End in .html
If your pages end in .html there are two different methods that you can follow to get iChatStatusPublisher to work on your site. I recommend the first one even though the second method is easier and doesn’t require you to rename all of your pages. The second method can slow your server down a bit because PHP will have to parse your HTML when it may not need to. These instructions will only work if your website is hosted on a UNIX server.
Rename Your Pages to .php
- Rename your pages from .html to .php.
- Upload your .php files to your server and delete the .html files which will no longer be used.
- Paste the PHP code below where you would like your iChat status to appear in your pages and be sure to change the config variables.
- Upload your pages to your web server and you should now be able to view your iChat status.
- Now create a new file and name it “.htaccess” without the quotes.
- Copy and paste the four lines of code below into the file.
- Upload the file to your root web directory (e.g. public_html). This will make it so any links that currently point to your .html pages will be redirected to the new .php pages.
# Redirect any links that point to .html extensions to .php
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.+).html$ $1.php [L]
Use PHP In Your .html Pages
- Create a new file and name it “.htaccess” without the quotes.
- Copy and paste the line of code below into the file.
- Upload the file to your root web directory (e.g. public_html).
- Your .html pages will now be parsed as PHP.
- Paste the PHP code below where you would like your iChat status to appear in your pages and be sure to change the config variables.
- Upload your pages to your web server and you should now be able to view iChat status.
AddType application/x-httpd-php .htm .html
Version History
v1.2 (August 11, 2004)
- Added support for transfers via SCP.
v1.1 (August 9, 2004)
- Initial release.
Disclaimer
THIS SOFTWARE IS PROVIDED AS-IS, WITHOUT WARRANTY OF ANY KIND. THE AUTHOR DISCLAIMS ANY DAMAGES RESULTING FROM THE USE OR MISUSE OF THIS SOFTWARE.
THIS SOFTWARE IS COPYRIGHT © 2004 JEFF MILLER. YOU MAY USE AND/OR DISTRIBUTE THE SOFTWARE WITHOUT RESTRICTION.
Download
iChatStatusPublisher_1.2.sit
File Size: 4.42 KBs
Downloads: 2389
Posted in Scripts, Web Development • Comments (12)




Comments
Here’s some code similar to what I used for my web site…not as cool, but it works for me…
AOL Instant Messenger: xhtmled []
Erm…that didn’t work too well. Take a look at the source for the Contact page I have…that will hopefully explain it a little better.
http://www.flakaddict.com/contact.html
I still think your php code rocks, though…the ability to differentiate between Mac and Windows is pretty cool…though I tried IM’ing you a few times from your web site and it brought iChat to the front and didn’t do anything.
Also, if I have the script running in my dock all the time it would get annoying quickly…is there a way to make it run in the background?
And just curious…how did you get the screen shot on the side of your page? I would really like to know how you did that, but also have the ability to turn it off sometimes when I don’t want people to be able to spy…
Err, what is FTP? It sends passwords in clear and really shouldn’t be used any more.
Why not simply use AOL’s status-service?
flakaddict: I’m not aware of any way to keep the icon from showing up in the dock since it’s a script application and not an application bundle. You might want to check out Dockless and that should do the trick. I will make a note to write something up and show how the screen shot of my desktop is displayed in my sidebar.
Bronski: I had originally used FTP because it got the job done. However, I’ve gone ahead and added support for SCP so users can choose between using this or FTP. I tried using AOL’s code a few months ago and it was really buggy. I didn’t like how it would show that I was available if my status was set to away. I had to completely log off in order to get it to show that I was unavailable. I prefer to keep iChat running 24/7 and set my status to away when I’m busy or not at my computer rather than having to log on/off. There’s also a long delay from the time you log on/off to the time it updates on your site if you use their code.
I found that once I logged off, my web site was immediately updated…then I logged back on again and it changed too…we’re talking within a minute here. I guess any bugs AOL used to have are squashed now.
It’s all in the wording…if you say you’re “Online” or “Offline”, that’s being more honest than saying “Available” or “Not Available”. The wording on my site says that I’m “Online”, which is true even if I have an away message set (I do the same thing as you, I’m almost never offline). People can still leave me messages, I’ll get them eventually.
I’d appreciate the tutorial on how you got the screen shot…that is really cool.
Just a couple of bug-ettes for you.
AppleScript Code
Should be:
AppleScript Code
in iChatAV 2.1 at least
and Xcode was complaining about the use of ‘start’ as a property so I changed it to something else.
I was hoping to put the ichat status publisher into my website, but all my pages are html. Is it still possible?
I know very little about php
Shaun: Thanks for pointing the error out. I normally use Script Editor and for some reason it didn’t pick up the problem with the variable. I loaded the script in Xcode and noticed it. I’ve renamed the “start” variable to “systemStartup” and have posted the updated file. I’ve also added an “else if” statement for “offline” status.
Jordan: Yes, it’s possible and there’s two different methods you can follow to get the script to work with your site. I posted some instructions above on how to get the script to work with your .html pages.
How can I point the applescript to my apache webserver instead of FTP and SCP?
Josh: You can use PHP’s fopen function on your remote server to retrieve the file. In order to do this your local machine will need to be running a webserver so your remote server can retrieve the status file. You’ll need to have a static IP address or use a service like DynDNS.org so the server can retrieve the file at all times. You will also need to make the following change in the AppleScript:
AppleScript Code
change to
AppleScript Code
PHP Code
I haven’t tested this but it should work.
ok, so would i have to change the following in the applescript since i wouldnt be “logging in”, and if so what to:
property login : “login” — login property pass : “password” — password property transfer : “SCP
and i already use dyndns.org to point my domain to my server, so thas cool. i understand the PHP part of it with no problem now, but im still confused about what I need to do with the applescript.
Thanks so much for helping me out with this though, i really appreciate it a lot. Sorry I’m so much trouble though heh.
All you would need to do is just delete SCP from the transfer property so it’s empty, but be sure to keep the quotes there.