I use Skype a lot (basically because there are so many people who don't use Jabber but whatever). If you set Skype.app to download files to one fixed folder it throws all the files in there. I'd like to sort them by user name though. As Skype doesn't have an option for that I created a Hazel rule for that

First you need to set Skype to download your files in one fixed folder:

Now let's create the Hazel rule for that. Add the folder you just set in Skype. Then create a new rule. Select "other" for the conditions and select "Where from", set it to "is not blank". Skype always sets the "Where from" attribute on the files to some string containing the user name and some garbage.

Now to the actions part: Add a "Run AppleScript" action and paste the following script:
- Code: Select all
tell application "System Events" to set filename to the POSIX path of theFile
set theUsername to do shell script "mdls -name kMDItemWhereFroms -raw \"" & filename & "\" | tr -d \"\\015\" | sed -n -e 's/^.*\\\"\\(.*\\) *(.*)\\..*Skype.*$/\\1/p' | sed -e 's/^ *//' -e 's/ *$//' -e 's/\\n//'"
return {hazelExportTokens:{skypeUsername:theUsername}}
Click the i button and add a token called "skypeUsername":

Add another action and set it to "sort into subfolder". Click the pattern editor and drag "skypeUsername" in the text field.

Set the options to "If file exists: rename", close the rule, run it and watch how the magic happens

Let me know if this works if you have set Skype to a different language setting. I don't see a reason why it shouldn't but I only tested this with the German version. (and only changed my language to make the screenshots for this)