Run an applescript on mouse down How can I trigger an applescript on mousedown? 
I want this applescript to run when a user doubleclicks on empty space in the desktop (i.e. not clicking on the icons present on desktop).

This is my script so far:

try
    set toggle to do shell script "defaults read com.apple.finder CreateDesktop"
    if toggle = "true" then
        do shell script "defaults write com.apple.finder CreateDesktop false"
    else if toggle = "false" then
        do shell script "defaults write com.apple.finder CreateDesktop true"
    end if
end try

do shell script "killall Finder"
delay 0.1
activate application "Finder"
Not sure the double click on empty space can be done, but I'm sure it would be kinder to ask the Finder to quit rather than kill it... Finders have feelings too ;-)

You could always save it as an app &amp; put it in the Dock.

tell application "Finder" to quit
-- /*give it time, otherwise it will try to activate before it's quit &amp; this simple version won't check if it relaunched.*/
delay 2 
try
    tell application "Finder" to activate
end try
--my testFinderRunning() --/*uncomment to add the belt &amp; braces method*/


Add this routine to make sure it relaunched

    on testFinderRunning()
    set test to 0
    repeat while test = 0
        log test
        tell application "System Events" to set test to count (every process whose name is "Finder")
        delay 2
        --/*we do this even if active because it doesn't naturally come to front.*/
        try
            tell application "Finder" to activate
        end try
        if (test &gt; 0) then exit repeat
    end repeat
end testFinderRunning


You can put the Applescript menu in the menu bar - http://thepoch.com/tumblr/enable-the-script-menu-in-mac-os-xs-menu-bar.html
short version... launch Applescript, get Prefs, set 'Show script menu in menu bar'

That may allow you to assign Key Commands from System Prefs/Keyboard, but I haven't had time to test yet.