Overview

The procedure described in this report will guide you through creating a Quick Action using Automator on macOS. This Quick Action can be used to convert text into a more filename-friendly format. The conversion process removes special characters, transforms the text to lowercase, and replaces spaces with hyphens.

Procedure

  1. Open Automator
  • Press Cmd + Space to open Spotlight, type “Automator,” and hit Enter.
  1. Create a new Service
  • In the Automator app, select “Quick Action” (previously called “Service”) and click “Choose.”
  1. Configure the Quick Action
  • At the top of the new window, change the “Workflow receives current” drop-down menu to “text.”
  • Make sure the “in” drop-down is set to “any application.”
  1. Add a “Run Shell Script” action
  • In the search bar on the left, type “Run Shell Script” and drag the action to the right pane.
  1. Configure the “Run Shell Script” action
  • Change “Pass input” to “as arguments.”
  • Paste the following script in the text box:
for text_input in "$@"
do
  echo "$text_input" | sed 's/[^a-zA-Z0-9 ]//g' | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g'
done
  1. Add a “Copy to Clipboard” action
  • In the search bar on the left, type “Copy to Clipboard” and drag the action to the right pane, below the “Run Shell Script” action.
  1. Save the Quick Action
  • Press Cmd + S and give your Quick Action a name, e.g., “Convert Text to filename”

The script is now ready to use from the right-click context menu in any text editor that supports macOS Services.

To use the script:

  1. Select a block of text in your text editor.
  2. Right-click on the selected text.
  3. Go to “Services” or “Quick Actions” (depending on your macOS version).
  4. Select the “Convert Text to filename” action.

The processed text will be copied to your clipboard, and you can paste it wherever you need to.

Conclusion

Creating a macOS Quick Action using Automator is a convenient way to streamline your workflow by automating repetitive tasks, such as converting text into a filename-friendly format. This report provided a detailed procedure for creating a Quick Action that can be used across multiple applications on macOS, making it an essential tool for anyone looking to improve their productivity and simplify their text editing process.