Posts Tagged ‘default folder’

Default Folder X: Using AppleScript to specify default folders on the fly

Tuesday, May 28th, 2019

Version 5.3.7 of Default Folder X introduced a new capability: it can now ask what the default folder for an application should be on the fly using AppleScript. That may sound like a mouthful of jargon, so let me explain, because it can be applied in a lot of situations.

Jason Snell (of Six Colors and The Incomparable fame) has been writing about Macs forever, and is now a prolific podcaster. He emailed to ask if it would be possible to make Default Folder X more flexible. At that time, you could set a default folder for an application so that when you chose Save As, it always offered to save a file in that particular folder. His problem was that you have to set a single folder as the app’s default folder – just one.

Jason creates podcasts – lots of them. His reasoning was that if he could magically tell Default Folder X what podcast he was working on, it would always offer to save the component audio files into the folder for that podcast. Essentially: Wouldn’t it be great if you could edit an audio clip, hit Save, and have it automatically go into the folder for the current podcast folder? No re-configuring a default folder for each new project – it’d just work.

So he hit on this idea (which I think is just brilliant). He uses Apple’s Logic X application to create his podcasts. So for each podcast episode, there’s one master Logic X project file. To find the correct default folder for audio clips, all he has to do is look at all the project files and see which one has been saved most recently. The “Audio Files” folder sitting next to that project is where everything should go for the current project. He wrote an AppleScript to do this, which he shared on the Six Colors blog.

This can obviously translate to all sorts of different workflows. If you have one primary file for each project, it’s easy to tell which one you’re currently working on – it’s the one that’s been saved most recently.

How to set up an AppleScript to specify a default folder

So how do you wire up Default Folder X to do this? It’s pretty simple. Put an AppleScript script in:

~/Library/Application Support/com.stclairsoft.DefaultFolderX5/Scripts/

or, if you want it to handle only a single application, put it in a sub-folder of the Scripts folder named for the application you want it to serve. To have it queried only for Preview, for example, put an AppleScript in:

~/Library/Application Support/com.stclairsoft.DefaultFolderX5/Scripts/Preview/

Download this example script file to see what you need to do in your AppleScript script:

http://www.stclairsoft.com/download/GetDefaultFolder.zip

The trick is that you need to implement this handler:

on getDefaultFolder(appName, dialogType, firstTime) 

which returns the location of the default folder. Open up the sample script file in Script Editor (or your AppleScript editor of choice) and have a look. I’ve tried to explain things clearly in the comment at the top, and the script shows a number of different ways of returning folders to Default Folder X. And of course, you can also use Jason’s complete script as a starting point.

I think Jason’s idea is great – it streamlines work on multiple projects, but most importantly, it reduces the chance for error as you’re trying to meet that pressing deadline. I’d love to hear how others use this feature, so please drop me a line if it works for you too!

DFX Secret Settings

Thursday, July 31st, 2008

Updated 3/29/2010 to include all of the latest settings.

So yeah – someone wrote to ask for a feature and I realized that there’s no documentation for the “secret settings” in Default Folder X.  Open System Preferences, click on Default Folder X, then hold down the option key and click on the Settings button.

Here’s the quick run-down:

  1. OpenFinderWindowsInColumnView:  Does what it says.  When DFX opens a folder for you in the Finder, the window will be in column view.
  2. OpenInFrontFinderWindow:  When DFX opens a folder in the Finder, it uses the frontmost Finder window instead of creating a new window.
  3. ReboundWhenChoosingFolders: Some apps use Open dialogs that allow you to select files or folders.  By default, DFX doesn’t do its “rebound” feature in these dialogs because it can cause the current folder to change if you’re using column view.  This switch makes it rebound anyway.
  4. MenusUseSmallFonts: For people with good eyes.
  5. HidePreviews: The OS X-supplied previews in column view in some apps (Photoshop) are really slow for large files.  This turns them off.
  6. HotkeysForRecentFolders: Option-up-arrow and option-down-arrow open windows in the Finder to show your  recently used folders.
  7. QuitWithoutConfirmation: Quitting DFX won’t bring up the “Are you sure?” alert.
  8. ShowHiddenFinderWindows: Makes Finder-click work even when the Finder is hidden.
  9. DisableContextualMenu: Turns off DFX’s contextual menus in Open and Save dialogs.
  10. ExportAndPrintToDocumentFolder: There’s a setting in DFX called “Make save dialogs automatically default to the current document’s folder.”  Normally it (intentionally) doesn’t work when you print to PDF files or export a file – this setting makes it work in Print to PDF and Export dialogs too.
  11. AlwaysShowFilesInMenus: Usually the menus that DFX displays next to file dialogs only show folders in them.  Turning on this option will make the menus display the files within those folders too.  Selecting a file will switch the file dialog to the folder that contains the file and select the file.
  12. OpenActiveFolderSet: Turn this on and DFX will open all Favorites in a folder set in the Finder whenever you change folder sets.
  13. ToolbarOnLeft: Displays the toolbar on the left side of Open and Save As dialogs instead of on the right.
  14. DisableOpenMetaUpgrade: Turn off the built-in code that upgrades old OpenMeta spotlight tags.  See the blog post about this.

So, there’s a few more little bits for Default Folder X.  Enjoy!