How to Select the “OK” Button via Keyboard for Text Dialog Boxes (macOS)

Screen Shot 2018-09-03 at 4.48.58 PM

So if you’ve been using my macOS tip to append a text file using Automator and shell scripts, you’ve no doubt run into two frustrations: the window is not brought to front focus, allowing immediate typing, and the OK button isn’t accessible via the keyboard (typing Return only inserts a line break, attempting to Tab to the button just inserts a tab character in the text field).

The OK button is a simple keyboard shortcut: the Function key (fn) + the Return key.

I’ve updated the above post to include the simple AppleScript step in Automator that will bring the window to front-most focus.

Advertisements

Prepend Text File with Automator & Shell Scripts

As a followup to my earlier post about how to create a macOS Service (or a Text Expander snippet) to quickly append a text file using Hazel, Automator and Shell Scripts, here’s a way to instead prepend text to a text file using the same tools.

prepend text automator screenshot

Why would you want to do this?

My core interest in setting this up is for plain-text journaling. In a way, I am cobbling together the functionality I find extraordinarily useful in the iOS app Drafts for use on macOS.

I like to capture ideas, thoughts, errands, links, apps, articles, tasks and todos quickly, and I use a plain-text document system I’ve put together over the years. These automation setups remove friction in doing so, which make it more likely I will maintain the behavior.

With this setup and the companion append text automation setup, I can hit a keyboard combo, have a small window pop up where I type what I want to capture, hit OK and the automation goes and appends it to the right .txt file, in the right location, behind the scenes.

I will be writing about my plain-text journaling system in a future post. For now, read on to learn how to set this journaling automation up for yourself.

Continue reading “Prepend Text File with Automator & Shell Scripts”

Automatically Create a Specific Folder Structure with Automator & Hazel

Here’s a method using Automator and Hazel to automatically create a specific folder structure within a folder. I use this for client projects, since they are always the same. With this setup, I just add a new folder to my “Clients” folder, and all the standard sub-folders I need added are auto-created by Hazel, via Automator.  Continue reading “Automatically Create a Specific Folder Structure with Automator & Hazel”

Hazel: Essential Mac Automation Tool

Hazel is hands-down one of my top Mac productivity software tools. And it’s one of those tools that tough to describe exactly why you would want it, because what it does is up to the user. In its most simplest form, Hazel is a utility that watches folders you tell it to watch, and does things to files that meet the criteria you set up. A very small set of actions it can perform are things like setting the color label of the file, renaming a file, moving files into subfolders, moving files to other folders (including the Trash), run AppleScripts and Automator actions, import files to iPhoto or iTunes, open files, set Spotlight comments, and lots more.

If you’ve ever used Smart Playlists in iTunes, then you’ll understand how Hazel works. But Hazel goes a step further and lets you perform actions on the files that meet the criteria in the “Smart Playlists”. If you are familiar with Folder Actions in OS X, Hazel is like Folder Actions on steroids. The best way to explain Hazel is to give you a few of my usage examples, but keep in mind that there are not “built-in”, nor are you limited to these actions. They are just some of the many things I use Hazel to automate on my Mac.

Continue reading “Hazel: Essential Mac Automation Tool”

Invoke PopClip Via Keyboard Using AppleScript, Automator and OS X Services

A tweet from the PopClip developer directed me to the PopClip User Guide to take advantage of a feature I’ve been wanting in the app for some time: the ability to invoke PopClip via the keyboard.

The method uses AppleScript and the code is super simple:

tell application "PopClip" to appear

The documentation suggests using a few third-party “launcher” utility apps, but I’ve discovered a way to do so with just OS X, using Automator and OS X Services. Here’s how I did it. Continue reading “Invoke PopClip Via Keyboard Using AppleScript, Automator and OS X Services”

OS X: Global Keyboard Shortcut To Open A New Finder Window

I’ve often wanted to be able to open a new Finder window on my Mac using a global keyboard shortcut. Turns out someone else has as well, and the full instructions can be found here: OSX: Setting a global shortcut key to open a new Finder window. The method uses Automator and AppleScript, both of which ship with OS X and the walkthrough requires very little knowledge of either app.

Be sure to read the comments to make sure you set things up correctly, as the instructions on the post are slightly incorrect.

Related:

Global OS X keyboard shortcut to open a new email message