(* AutoStacks by Mike Fahy, nospam@turdhead.com Copyright (C) 2007 by Mike Fahy Released under the common THC (TurdHead.Com) license, which doesn't actually exist. AutoStacks gives some of the functionality many of us expected to see in the final implementation of OS X Leopard "Stacks" -- Drag any random assortment of files onto this app, and a new Stack is generated containing only those files. Behind the scenes, this script will create an "AutoStacks" folder in your home directory and place other directories to represent each new stack. Just as with any other stack, removing the stack from your Dock will not remove this directory or its contents. Note 1: USE AT YOUR OWN RISK! To add this functionality, AutoStacks writes to your default Dock.plist file, and in theory could ruin it. It hasn't wrecked mine, however, but I do not in any way guarantee it won't destroy you, your computer and everything you hold dear to your heart. Thus, USE AT YOUR OWN RISK. I am not, nor have I ever been, responsible for anything you or your computer might do. Note 2: Turdhead.com is not that bad of a domain name. Really. Enjoy! *) on open files_ set stackDir to "AutoStacks" as string set plistStart to "tile-datahome directory relative" set plistEnd to "arrangement2showas1tile-typedirectory-tile" set timeStr to time string of (current date) set cPosition to offset of ":" in timeStr set theHour to characters 1 thru (cPosition - 1) of timeStr as string set timeStr to characters (cPosition + 1) through end of timeStr as string set cPosition to offset of ":" in timeStr set theMin to characters 1 thru (cPosition - 1) of timeStr as string set timeStr to characters (cPosition + 1) through end of timeStr as string set cPosition to offset of ":" in timeStr set theSec to characters 1 thru (cPosition - 1) of timeStr as string set timeStr to year of (current date) & (month of (current date) as integer) & day of (current date) & timeStr as string set timeStrTmp to timeStr set timeStr to "" repeat while timeStr is "" display dialog "Please provide a label for the new Stack:" default answer timeStrTmp set timeStr to text returned of result end repeat set myPath to (path to home folder) as string tell application "Finder" activate -- Make the AutoStacks folder if it's not there already try make new folder at myPath with properties {name:"AutoStacks"} end try set stackFolder to myPath & stackDir as string try make new folder at stackFolder with properties {name:timeStr} end try set newStackFolder to stackFolder & ":" & timeStr repeat with file_ in files_ (* ******************************************************** NOTE: If you prefer making ALIASES to existing files (rather than moving files to a new AutoStacks directory), comment out the next line by adding "--" before it, and remove the two hyphens from the line following it. That should do it! *********************************************************** *) move file_ to newStackFolder --make alias to file_ at newStackFolder end repeat do shell script "defaults write com.apple.dock persistent-others -array-add '" & plistStart & POSIX path of newStackFolder & plistEnd & "'" do shell script "killall -HUP Dock" activate end tell end open