Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: A simple Widget installation AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: A simple Widget installation AppleScript
Authored by: notverypc on Jun 22, '05 06:43:29AM
I've add a few bits to the Script posted. The following script needs to be saved as an application. The script is a droplet, so just drag your widgets on the the icon. It will then ask were you want to install the widgets. (System or User) I couldn't get the ZIP thing to work so this script only works with unzipped widgets.

on run
	display dialog "To use this installer, please drag widgets onto its Finder icon." buttons {"OK"} default button 1 
		with title "Widget Installer" with icon alias 
		((path to startup disk) & "Applications:Dashboard.app:Contents:Resources:Dashboard.icns" as string)
end run

on open draggedItems
	
	display dialog "Install Where?" buttons {"System"} & {"User"} default button 2 
		giving up after 5 with title "Widget Installer" with icon alias 
		((path to startup disk) & "Applications:Dashboard.app:Contents:Resources:Dashboard.icns" as string)
	copy the result as list to {WidgetPlace}
	
	repeat with thisFile in draggedItems
		set SystemWidget to (path to library folder as string) & "Widgets"
		set UserWidget to (path to home folder as string) & "Library:Widgets"
		
		
		if WidgetPlace is "System" then
			tell application "Finder"
				set thisFile to draggedItems
				set filePath to (item 1 of thisFile as text)
				move thisFile to SystemWidget
			end tell
			
		else
			
			try
				get UserWidget as alias
			on error
				tell application "Finder"
					set UserWidget to make new folder at (path to home folder as string) & "Library" with properties {name:"Widgets"}
				end tell
			end try
			
			tell application "Finder"
				set thisFile to draggedItems
				set filePath to (item 1 of thisFile as text)
				move thisFile to UserWidget
			end tell
			
			
		end if
	end repeat
end open


[ Reply to This | # ]