Add folder to sidebar in Finder

Is there a way to add a folder to the sidebar of Finder windows using AppleScript?


You have to use system events:

tell application "Finder"
set theFolder to choose folder --choose the folder to put in the sidebar
	set theParentName to (name of (container of theFolder))
	select theFolder
	repeat until exists window theParentName --to be sure the Finder window is open before the next step
		delay 0.05
	end repeat
	tell application "System Events" to tell process "Finder" to keystroke "t" using command down --puts folder in sidebar, at the bottom
close window 1 --closes the window that opened when the folder was selected
end tell

I knew I could do it with GUI scripting, I was just wondering if I could instruct the Finder to do it using AppleScript.

Thanks anyways.

Browser: Firefox
Operating System: Mac OS X (10.5)

No, the AppleScript dictionary of the Finder has no sidebar entries (except the property sidebar width of a Finder window)