I've used the St. Clair Software's default folder since the days of System 7. It's a tool that lets you set a different default location for the Open / Save dialogs in each app you use and provides some other clear features like clicking on an open Finder window to change the Open / Save dialog box to the window's location.
A few weeks ago, I had a feature request for Jon Gotow, the standard folder developer. I realized that in at least one app I use, it's a very common location I want to save all my files, but the location is not persistent. When I record ads and other audio for podcasts, I always stop saving everything in the audio files folder in the project folder for my current Logic project, which is always on the desktop.
So I asked Jon, Is there any way to program define where the default folder opens? His answer was to send me a standard folder development building that would allow the default location to be exceeded with an AppleScript, a "hidden" feature now available in version 5.3.7 of standard folder X. Now the is customer service.
In any case, I now needed to write the script, which means I needed to find out the specific rules that would define the correct destination folder. Finally, I realized that what I needed to do was find the newly modified folder on the desktop that contained a Logic X project file. AppleScript, but perhaps not the best tool for this job, is the tool I know how to use.
on getDefaultFolder (appName) Tell application "Finder" put folder_list to folders (path to desktop folder as alias) Finally tell seen theNewestDate to date "Tuesday, October 6, 1970 at 07:00:00"
This first section gets a list of folders on the desktop, and then sets a variable to a very old date for reasons that make sense little while.
repeat with theFolder in folder_list Tell application "Finder" insert folder_contents for the entire contents of theFolder Finally tell Repeat with the_item in folder_contents whose type the_item is "Logic X Project" then add theDate (get theFolder modification date) if the date is greater than the latest day then set theNewestDate to Date end up end up Finally repeat
Next part runs through these folders, gets the content. The script then runs through the content to see if there is a Logic project file inside. In that case, the script compares that folder's modification time with the contents of the variable
theNewestDate and if it is newer, this variable is updated to the modification time of the newer folder.
(Write this Script I discovered that AppleScript does allows you to compare dates using the amazing design "if [a date] is larger than [another date]." In this case, larger means newer.)  ifNewestDate is date "Tuesday, October 6, 1970 at 07:00:00" then
set theResult (path to desktop folder as alias)
Tell application "Finder"
add theDestinationFolder (each item of (path to desktop folder as alias) whose modification date is NewDateDate)
set theResult to the POSIX path (element 1 of the destination folder as alias) and "audio files"
The last step (after making sure is is a folder on the desktop that contains a Logic project, because if
theNewestDate is still 1970, it is not en) is to find the latest folder, add the name audio files its subfolder, and send it the result back to the default folder.
The result is a bit magical: Now that I record sound in Sound Studio and press Save, the Save To dialog box stores the Audio Files folder in the latest Logic project folder on the desktop. Nine times out of ten, that's exactly where I want to be.
[ If you appreciate articles like this, you can continue to make Six Colors (and get some fun benefits) by becoming a Six Colors subscriber. ]