Using @Lauri Ranta's answer as a starting point, I put together this Applescript for Alfred:
on alfred_script(q)
set q to "" & q
if q is "kind" then
tell application "Finder" to clean up window of desktop by kind
else if q is "cdate" then
tell application "Finder" to clean up window of desktop by creation date
else if q is "mdate" then
tell application "Finder" to clean up window of desktop by modification date
else if q is "size" then
tell application "Finder" to clean up window of desktop by physical size
else if q is "label" then
tell application "Finder" to clean up window of desktop by label index
else
tell application "Finder" to clean up window of desktop by name
end if
end alfred_script
You can see the different parameters to change the order that you want in the script (and change them to something that makes better sense to you if you want).
To use it, open Alfred's Preferences -> Extensions and click the + button in the lower left. Choose AppleScript and enter a name for it. (I called mine 'Clean up desktop'.) Write a Title and a Keyword for the script, and then paste the code into the AppleScript field. Click Save and you should be good to go!
osascriptliketell application "Finder" to clean up the desktopbut ran into problems with theclean upverb with thedesktopobject... apparently it only works on windows :(. Here's a bunch of suggestions for scripts that could probably be turned intoosascriptarguments discussions.apple.com/thread/416256?start=0&tstart=0 – nine9ths Nov 16 '12 at 4:28