Skip to content

iChatStatusPublisher

Posted on August 09, 2004 at 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

  1. Download the script.

  2. Create a new folder named “iChat” in your user’s Library folder (/Users/USERNAME/Library/iChat).

  3. Open the Script Editor which is located in the AppleScript directory inside your system’s Applications folder (/Applications/AppleScript/Script Editor).

  4. Copy and paste AppleScript code into the top box of the Script Editor.

  5. 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 transferring 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.

  6. Click “File” then “Save As…” and a dialog box will appear (see below).

    Dialog Box

  7. Save the file as “iChatStatusPublisher” and save it to your system’s Applications folder.

  8. Select “Application” from the File Format drop-down menu.

  9. Check the option to “Stay Open”. This will keep the script running in the background so it can communicate with iChat.

  10. 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.

  11. 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.)

  12. 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, please post a comment below. 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 web server 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.

  1. Open Terminal on your local computer and start a new shell session from the File menu.

  2. Type “ssh-keygen -d”.

  3. After entering the command, press the enter key three times.

  4. Your public and private keys are now saved to “~/.ssh/id_dsa.pub” and “~/.ssh/id_dsa”.

  5. Copy the key to your webserver by typing “scp ~/.ssh/id_dsa.pub yourdomain.com:.ssh/authorized_keys2”.

  6. Enter the password for your account on the webserver when prompted then press the enter key.

  7. 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.

  8. If you successfully connected to your account then you should be all ready to start uploading your iChat status file to your web server.

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

  1. Rename your pages from .html to .php.

  2. Upload your .php files to your server and delete the .html files which will no longer be used.

  3. 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.

  4. Upload your pages to your web server and you should now be able to view your iChat status.

  5. Now create a new file and name it “.htaccess” without the quotes.

  6. Copy and paste the four lines of code below into the file.

  7. 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

  1. Create a new file and name it “.htaccess” without the quotes.

  2. Copy and paste the line of code below into the file.

  3. Upload the file to your root web directory (e.g. public_html).

  4. Your .html pages will now be parsed as PHP.

  5. 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.

  6. 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: <%= Net::HTTP.get('www.xhtmled.com', '/scripts/ichatstatuspublisher.php') %>2,822

There are 13 comments on this post. Post yours →

Tagged with applescript, ichat, scripts, webdev

Comments

gravatar icon
1

Posted by flakaddict on August 11, 2004 EST

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 []
gravatar icon
2

Posted by flakaddict on August 11, 2004 EST

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…

gravatar icon
3

Posted by Bronski on August 11, 2004 EST

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?

gravatar icon
4

Posted by Jeff Miller on August 11, 2004 EST

@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.

gravatar icon
5

Posted by flakaddict on August 11, 2004 EST

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.

gravatar icon
6

Posted by Shaun on August 11, 2004 EST

Just a couple of bug-ettes for you.

AppleScript Code

else if
    status is equal to "offline"
then
    set iChatStatus to "idle"

Should be:

AppleScript Code

else if
    status is equal to "offline"
then
    set iChatStatus to "offline"

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.

gravatar icon
7

Posted by Jordan on August 11, 2004 EST

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

gravatar icon
8

Posted by Jeff Miller on August 12, 2004 EST

@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.

gravatar icon
9

Posted by Josh on August 12, 2004 EST

How can I point the applescript to my apache webserver instead of FTP and SCP?

gravatar icon
10

Posted by Jeff Miller on August 12, 2004 EST

@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

set iChatStatus to "available"

change to

AppleScript Code

set iChatStatus to <a href="aim:goim?screenname=YOURSCREENAME&message=Hello" title="Send me an Instant Message via iChat">Available</a>

PHP Code

// include this code where you would like your iChat status to appear on your webpage

// change this to the URL where status.inc is saved on your local computer
$file = "http://name.dyndns.org/status.inc";
$fd = @fopen($file, "r") or die("Not Available");

$contents = "";while(!feof($fd)) {
      $contents .= fgets($fd,100);
}

fclose($fd);
echo "$contents";

I haven’t tested this but it should work.

gravatar icon
11

Posted by Josh on August 12, 2004 EST

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.

gravatar icon
12

Posted by Jeff Miller on August 12, 2004 EST

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.

gravatar icon
13

Posted by levitra on May 25, 2008 EST

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. may be not here directly

Comment on This Post

Optional

http://www.xhtmled.com xhtmled PO Box 46 Annapolis MD 21404 USA Photo of Jeff Miller