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


Click here to return to the '10.5: Add a 'recent things' stack to the Dock' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Add a 'recent things' stack to the Dock
Authored by: macfreek57 on Jan 22, '08 08:30:20PM
I made this handy (and simple) AppleScript to make adding Recent Items stacks to the dock easier. It displays a dialog that asks if you want a Recent Items stack, which you can accept or reject, then executes the proper terminal command and kills the dock. It even gives you the option of which side you'd like it on. Enjoy.
set dialogText to "Would you like to add a Recent Items icon to your Dock?"
set appSideScript to "defaults write com.apple.dock persistent-apps -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }';killall Dock"
set docSideScript to "defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }';killall Dock"

display dialog dialogText buttons {"No Thanks", "Yes! Left Side, Please!", "Yes! Right Side, Please!"} default button 1

if button returned of result is "Yes! Left Side, Please!" then
	do shell script appSideScript
else
	if button returned of result is "Yes! Right Side, Please!" then
		do shell script docSideScript
	end if
end if
Edited on Feb 03, '10 09:13:56PM by robg


[ Reply to This | # ]
10.5: Add a 'recent things' stack to the Dock
Authored by: xhints_ on Jan 25, '08 01:44:04PM

You have too many quotes – you put a string inside a string which really doesn't work.



[ Reply to This | # ]
10.5: Add a 'recent things' stack to the Dock
Authored by: dj60 on Jan 31, '08 09:54:41AM

New to all of this scripting.. when compling this code I'll get an error msg..

set appSideScript to "defaults write com.apple.dock persistent-apps -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' ';killall Dock"

On this line I'll get the msg "Syntax Error Expected end of line, etc. but found identifier" Using the apple scripting tool, the word "tile" here is highlighted. { "tile-data" = { "list-type" ...........

where did i go wrong?


Thanks
dj



[ Reply to This | # ]
Script update
Authored by: xhints_ on Feb 11, '08 12:08:47PM
Here's a neater version that works:
global abutton

set cbutton to "Cancel" -- cancel button
set abutton to "Applications Section" -- app side button
set dbutton to "Documents Section" -- docs side button

display dialog "Add a Recent Items stack to the Dock?
This will temporarily disable both the Dock and Dashboard" buttons {cbutton, abutton, dbutton} default button 3
set rbutton to the button returned of the result
if rbutton   cbutton then addStack(rbutton)


on addStack(button)
	if button = abutton then
		set side to "apps"
	else
		set side to "others"
	end if
	do shell script ("defaults write com.apple.dock persistent-" & side & " -array-add '{ \"tile-data\" = { \"list-type\" = 1; }; \"tile-type\" = \"recents-tile\"; }';killall Dock")
end addStack
Edited on Feb 03, '10 09:13:35PM by robg


[ Reply to This | # ]