Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Jamie Allison

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Set Desktop Background droplet

-- This script should be run as a droplet
-- It expects that an image is dropped on it's icon

   1  
   2  
   3  -- 
   4  -- The on run handler is called if the user has double clicked the icon
   5  --
   6  on run
   7  	display dialog "Please drop an image file on this Icon to set it as the desktop background"
   8  end run
   9  
  10  
  11  --
  12  -- The on open handler is called when the user drags and drops  afile on the icon
  13  --
  14  on open draggeditems
  15  	set imageFile to last item of draggeditems
  16  	
  17  	tell application "Finder"
  18  		select window of desktop
  19  		try
  20  			set desktop picture to file (imageFile as text)
  21  		on error
  22  			display dialog "Invalid image file."
  23  		end try
  24  	end tell
  25  	
  26  end open
  27  
  28  
  29  
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS