Apple

How to Automate Recurring macOS Tasks with Automator

How to Automate Recurring macOS Tasks with Automator

Do you find yourself doing the same monotonous tasks over and over again? In this tutorial, I’ll show you how to use an automator to automate 5 of the frustrating repetitive tasks that take up too much of your time on macOS.

1. Convert PDF to plain text

A PDF is basically a text image, but what if you need to separate text from an image? Don’t waste time and effort manually copying / pasting each paragraph into separate text documents! You can create an app that automatically extracts each line of text from a PDF and then saves this text as a separate file.

  1. Start Automator, by opening your Mac’s Finder, pointing to “Applications” and then selecting the Automator application.
  2. We are building an application, so select “Applications -> Select.”1(4)
  3. Now you will see Automator’s main editor, where we will build all of our applications. Make sure the “Actions” tab is selected.
  1. In the “Library” field, select “PDF”.2(4)
  2. Find “Extract PDF text” and drag and drop this item into the editor. The “Extract …” action will now be added to the editor, ready for you to customize.3(4)
  3. You can now specify whether Automator should save the extracted text as a rich text document or as a plain text document.
  4. Open the “Save output to” dropdown and choose where the resulting text file should be stored.
  5. Specify whether the resulting text file should have the same name as the original PDF, or you can assign it a unique name using “Output file name: Custom Name.”
  6. In the Automator toolbar, select “File -> Save…” and give your application a name.

There she is! Now, you can extract all the text from the PDF, simply by dropping the PDF into the application you just created.

2. Create an “Exit All” switch

If you are in the habit of leaving lots of applications running in the background then this can have a significant impact on the performance of your Mac.

While you can close each application manually, why not save time and effort, and create a custom “out of all” application?

  1. Run Automator, or select “File -> New” from the Automator toolbar.
  2. Select “Applications -> Select.”
  3. In the “Library” column, select “Utilities”.
  4. Find the “Quit All Applications” item, and drag it to the editor.4(4)
  5. Are there any applications that you would like to exclude from the “close all” button? To make an application immune, click “Add” and then select that application from the list.
  6. When you are ready to build the “out of all” application, select “File -> Save …” and give the application a name.

Now, the next time you want to “get out of all”, just run this app and it will close all running apps for you!

3. Rename hundreds of files

There are a lot of situations where you have to rename lots of files, but what I don’t like the most is renaming a bunch of photos that I just downloaded to my Mac, following a big event like a holiday, wedding or birthday party.

In this situation, you may want to use a similar name for each file.

  1. On the Automator toolbar, select “File -> New.”
  2. Select “Applications> Select”.
  3. In the “Libraries” column, select “Files & Folders”.
  4. When launched, it will ask you which file you want to rename, so find “Ask for Finder items,” and place it in the editor.
  5. Since we want to bulk rename files, click the “Add Multiple Selection” checkbox.
  6. In the left menu, find “Rename Finder Items” and drop it into the editor.5(3)
  7. At this point, a pop-up will warn you that this action may change the original file, and you will have the option to apply this change to the original copy of the file. Since we’re only changing the file name, I’m not going to make a copy of it.
  8. Next, select the “New Name” checkbox and let Automator know how it should rename your files. You can use whatever naming structure you like, but I wanted to add a serial number to each file, so I chose “Create sequential” followed by “Add number to: existing item name”.
  9. If you are happy with the information you entered, click “File -> Save…”

Now, whenever you launch this app, it will open a new Finder window where you can specify all the files you want to rename.

4. Rotate any image From Landscape to portrait

If you have lots of photos, screenshots, PDFs, or other files that you want to play back, you can use Automator to play those files without having to open each file, play it manually, then exit the file.

  1. Launch Automator, or select “File -> New” from the Automator toolbar.
  2. Select “Applications> Select”.
  3. In the “Library” column, select “Photos”.
  4. Find “Rotate Images” and place it in the editor area.
  5. At this point you will see a popup warning that this action may change the original file. Since we’re only changing the angle, I’ll apply these changes to the original file.
  6. Tell Automator how it should rotate the file in question – left, right, or 180 degrees.
  7. Now you can create this application, by selecting “File -> Save …”

Now, whenever you want to play a file, just drag and drop it into your application. Note that unless you specify otherwise, the files will remain in their original location.

5. Text-to-audio: Turn any part of the text into narration

Sometimes, it’s easier to listen than to read. You can use Automator to create a service that converts text to audio. To give you the flexibility to convert any text to audio, I implemented this workflow as a service that you can access directly from the macOS context menu.

6(3)

  1. On the Automator toolbar, select “File -> New.”
  2. Select “Service -> Select.”
  3. In the “Library” column, select “Text”.
  4. Select “Text to audio file”, and drag it to the editor section.
  5. Open the “System Sound” drop-down menu and select your narrator. You can preview any system sound, by selecting it from the list and then clicking “Play.”
  6. In “Save As”, enter a name that will be used by the resulting audio file.
  7. On the Automator toolbar, select “File -> Save…” and then provide a name for this service, which will represent this service in the macOS context menu.

Now you can use this service to convert any piece of text into an audio file:

  • Drag to highlight the text in question.
  • Control-click the highlighted text and choose “Services …” followed by the name of the service you just created.

Automator will now generate an audio file from this text.

7(2)

To play this file, click it and macOS will start playing audio on your default media player.

Related posts

How to Install Windows 10 VirtualBox VM on macOS

Howto

How to Get Rid of iOS 14 Beta Update

Apple

How to Convert HEIC Images to PNG on iPhone the Easy Way

Apple

How to uninstall apps on a Mac

Apple

How to Change the Sound Output Device on a Mac

Apple

How to use AirDrop on iPhone and iPad

Apple

How to Swap Left and Right Mouse Buttons on a Mac

Apple

How to put Apple Watch in vibrate mode

Apple

Shazam: Music Recognition Application Acquired by Apple

Apple