27 votes

Batch compress multiple folders into individual zip files

There's an alternative solution that's built-in if you don't want to use Automator and are fine with changing Archive Utility's settings. Open the Archive Utility.app located in /System/Library/...
ababak's user avatar
  • 379
25 votes
Accepted

Passing arguments to 'Run Shell Script' in Automator

When passing input to Run Shell Script in Automator you need to change Pass input: to stdin to Pass input: as arguments as shown in the example workflow below.
user3439894's user avatar
  • 57.9k
25 votes

When writing AppleScript in Automator, what is the significance of "input" and "parameters"?

I'll try to answer my own question, making use of the relevant documentation1 provided by @user3439894 in a comment on my question. Where does the AppleScript code get these variables from? input: ...
rubik's sphere's user avatar
20 votes
Accepted

Drag to convert Automator Action into Applescript

In case anyone has this question, I found it, but it only works for recorded actions. After you Record some clicks or other actions in Automator, they appear in a "Watch Me Do" action. You can then ...
Nate's user avatar
  • 421
18 votes

Create global shortcut to run command line applications

I tried all those options, but they're too complex and unreliable or really expensive. So i ended up writing my own solution (open-source and free). iCanHazShortcut It can't do much right now, but ...
deseven's user avatar
  • 181
18 votes
Accepted

Batch compress multiple folders into individual zip files

Here is an Automator Service1 that becomes available in Finder when Folders are selected and emulates the context-menus Compress [n] Items command except it creates an individual zip archive file for ...
user3439894's user avatar
  • 57.9k
18 votes

com.automator.runner.xpc is not allowed to send keystrokes

I have solved this issue recently in case anyone is interested in how. It is NOT actually necessary for System Events to have direct Accessibility privileges. What you need to add are a total of 3 ...
user321627's user avatar
16 votes

How do you remove the Automator gear icon in the menu bar?

If you are starting a long-running process with "Run Shell Script", redirecting its output should be enough. For example: long-running-process &>/dev/null & The gear icon appears then ...
cYrus's user avatar
  • 302
13 votes

How can I automate mouse clicks and keyboard input with Automator in Mac Mojave?

Yes, you can use Automator -> Utilities -> Watch Me Do and record mouse and keyboard actions and then add an Automator -> Utilities -> Loop and configure it to loop however many times you ...
Wawrzyniec Pruski's user avatar
13 votes
Accepted

Removing all characters except digits from clipboard

The shell snippet pbpaste | tr -cd "[:digit:]+" | pbcopy will take the content of the clipboard, remove all non-digits and put the result back into the clipboard.
nohillside's user avatar
  • 98k
12 votes

How should I start a new iTerm terminal with shortcut?

You can change the Action in your Automator-defined service to an AppleScript action: Select Library/Run AppleScript in the Actions window Add the following AppleScript in the created Action and save:...
Maxim's user avatar
  • 223
12 votes

Is there any way to change the mac dock's position with a keyboard shortcut?

This AppleScript code works for me using the latest version of macOS Mojave. tell application "System Events" to tell dock preferences if screen edge is bottom then set screen edge to ...
wch1zpink's user avatar
  • 7,521
11 votes
Accepted

Renaming files/names in bulk, any smarter solution?

export into a CSV (unicode UTF-8 or any other 8bit encoding, not UTF-16): two columns, separated by ; (assuming there is no ; in a file name) open Terminal change to folder containing the files run ...
nohillside's user avatar
  • 98k
11 votes

com.automator.runner.xpc is not allowed to send keystrokes

I found that all applications involved that are targeted by the Automation also need to be given Accessibility permission. So, if your Automation reloads a page in Chrome then both Chrome and ...
searaig's user avatar
  • 111
10 votes
Accepted

How do I get Automator actions for Microsoft Powerpoint and Word?

Microsoft Office for Mac 2011 (and 2008) includes several Automator workflows, but Microsoft is no longer providing Automator actions for Office 2016. So, you must run an AppleScript from the ...
jackjr300's user avatar
  • 2,572
10 votes
Accepted

How to export Text replacements from the Keyboard System Preference from shell?

There is an unofficial command line tool, which does exactly what you want, its called shortcuts. As mentioned on GitHub, you can install it via homebrew brew install rodionovd/taps/shortcuts and ...
dastrobu's user avatar
  • 308
10 votes

How to prepend a character to start of each line in 250,000+ line file using a script?

Prepend each line of a file with a capital A and write a new file- awk '{print "A"$0}' < FILE > NEWFILE
fd0's user avatar
  • 10.6k
9 votes

Can Mac App Store installs & upgrades be automated?

This is possible using the open source mas command line utility: mas-cli A simple command line interface for the Mac App Store. Designed for scripting and automation. Disclosure: I am the ...
argon's user avatar
  • 401
9 votes
Accepted

Copy specific files and keep the subfolder structure

rsync -avh --include='*/' --include='*.xls' --exclude='*' path/to/sourceFolder/ path/to/destinationFolder Note the / at the end of the source path, it's important. This solution would add all empty ...
Manuel's user avatar
  • 630
9 votes

How to prepend a character to start of each line in 250,000+ line file using a script?

To prepend X to the start of every line of file, writing to newfile, in Terminal: sed 's/^/X/' file > newfile Here I'm using sed, the Unix stream editor, to use a very simple regular expression ...
scruss's user avatar
  • 608
9 votes
Accepted

Convert image and save to same folder in Automator

Use the following actions: Duplicate Finder Items Change Type of Images Rename Finder Items: Replace Text (" copy" with "") With this sequence, the 'change type' occurs with the copy while ignoring ...
Mockman's user avatar
  • 1,090
8 votes

How to create an Automator service to run a script on all files in a folder

If you're creating a Service using RunShell Script which you want to pass the selected Folder(s) to the RunShell Script and have additional actions take place in the script on them, then start with ...
user3439894's user avatar
  • 57.9k
8 votes

How do you remove the Automator gear icon in the menu bar?

If you are using a shell script, you can add "killall ScriptMonitor" at the top of it.
Reza's user avatar
  • 81
8 votes
Accepted

Automator "Watch Me Do" function does not work in app

Watch Me Do and Accessibility Since macOS 10.9, you need to add your Automator application to your Mac's accessibility list. To add your Automator workflow, go to: System Preferences → Security &...
ecmanaut's user avatar
  • 1,070
8 votes

How to replace a folder that's name is a date i.e. YYYYMMDD with folder hierarchy of year, month, date?

You can use the following in Terminal. cd to the containing folder, then run the following: find . -type f -exec bash -c \ 'F=$(sed -E "s#^\./([0-9]{4})([0-9]{2})([0-9]{2})#\1/\2/\3#" <<< $...
grg's user avatar
  • 199k
8 votes
Accepted

How to replace a folder that's name is a date i.e. YYYYMMDD with folder hierarchy of year, month, date?

Assuming all these YYYYMMDD folders are part of the same parent directory you could run cd PARENT_DIRECTORY for d in */; do [[ $d =~ [0-9]{8}/ ]] || continue mkdir -p -- "${d:0:4}/${d:4:2}" ...
nohillside's user avatar
  • 98k
8 votes

Keyboard shortcut in finder to launch >share via>airdrop

You can go to System prefrensces --> Keyboard --> Choose shortcuts from the menu above --> Choose "App shortcuts" from the side menu and click the + button. After that choose Finder ...
AyhamSYR's user avatar
7 votes

Find multi-line block using grep and/or automator with BBEdit

You can do multiline greps in TextWrangler using various pattern modifiers (i, m, s, and/or x) e.g. searching for <item>(?s).*?<\/item> will match across lines. After that, you can ...
Trent Bartlem's user avatar
7 votes

Automator gets stuck at shell script

I found this link helpful to solve a similar problem I was having: https://discussions.apple.com/thread/1867978 I tried adding exit 0 to the end of my Automator shell script and it didn't seem to ...
user3139574's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible