Planter for LaunchBar

This is a version of Planter (instant nested folder creation from indented text input) modified for LaunchBar1. It has a customized version of the Planter script and CocoaDialog embedded, so you can use it simply by unzipping the download, placing the .scptd file in ~/Library/Application Support/LaunchBar/Actions and running it directly from LaunchBar. Download at the end of this post.

If you use LaunchBar’s “Instant Send” feature or navigate to a folder, hitting tab and running the Planter action will automatically use that folder as the root. If you run Planter on its own, it will ask you to pick a root directory.

Next, it will show you any templates you have installed in ~/.planter. See the original post for more information on templates. If you choose “Custom” from this dialog, you’ll get a text dialog where you can enter your own indented directory structure to create. Directories are entered as plain text, and indenting a line will make that directory a child of the previous indent level before it:

top-level-folder
	second-level-folder
		third-level-folder
	second-level-folder-2
	etc.

Note: this version does not have a fallback if there are no templates installed. I should have, but I’m out of time to fix this right now. Therefore, you must have at least one .tpl file in ~/.planter. Put whatever common folder structure you use into default.tpl or just create a blank file with a .tpl extension.

Lastly, it will ask you for any replacement variables for the template. These are entered separated by spaces. Multiple-word replacements should be quoted (e.g. "client 1" "client 2").

Then, it instantly creates your nested structure with any variable replacements in the folder you chose. Boom.

The next step for Planter is to handle templated files. For example, entering index.html on an indented line below a folder name would create a skeleton html5 index file at that location. I plan to have any file in ~/.planter with an extension other than .tpl serve as a file template, so entering a matching name and extension in the file structure will place a file instead of creating a directory. Coming eventually.

If anyone wants to modify this script to work with Alfred, et al, it shouldn’t be terribly difficult. All dependencies are embedded in the script bundle.

Have fun. Be productive.

Planter for LaunchBar/CLI v1.3

Instantly create nested directory structures from indented text

Published 05/05/13.

Updated 05/05/13. Changelog

DonateMore info…

  1. Chunks of the AppleScript borrowed from Jonathan Poritsky