Rather than spending your time with Folder Actions (which I, and many others, have found to be unreliable), might I suggest that you give Hazel a try?
Disclaimers: I'm going to start off by telling you it isn't free (it's US$28), but if you like automation, this is the place to start. There is a free 14-day trial. I am completely unrelated to the company except as an extremely happy user.
Hazel allows you to create 'folder actions' very easily using a nice GUI which is similar to creating Mail.app rules. You can take action depending on filename, extension, kind (i.e. "images, documents, movies") and many other.
Here is the rule I use for any file/folder added to ~/Action/ZipIt/
Hazel looks for any file which is not already an archive (I could have told it to act on any files at all, but I want to avoid compressing files which are already compressed). I could add other criteria (which could be options or requirements, like boolean "AND" or "OR" statements).
Whatever it is will be archived, then moved to the Desktop, then it will be shown to me in the Finder.
See the little "Options" button next to the 'Move to Desktop'? Click on that and you can tell Hazel what to do if it detects that the file you are going to move is a duplicate.
There is also an option to have Finder brought to the front or not.
There are lots of other actions Hazel can do besides archive:
(Note: iPhoto and Aperture are greyed out because I don't have them installed.)
The options to run AppleScript/Automator/shell scripts means that you have the power to do pretty much anything you can imagine.
I could go on and on, but here's one more example: I have Hazel watch ~/Downloads/ for .zip files. When it finds them, it unzips them to ~/Action/Unzipped/ (you can do this either by telling Archive Utility to use that folder, or use The Unarchiver). Hazel then looks in ~/Action/Unzipped/ for new files which end with .app and, if found, moves them to /Applications/ and opens them. Voilà! Instant installation of apps.
In the world of 99¢ apps, $28 probably sounds like a huge expense, but to me Hazel is one of those tools which takes something Apple did, but not very well (Folder Actions), and replaces it with something that will make you wonder why Apple didn't do it. You get a 2 week trial, and a dedicated developer who has worked on this app for years, and who is very good at answering support questions.
Sorry to sound like a fanboi, but when it comes to Hazel and a few other Mac apps, I really am.