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/...
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.
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:
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
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:...
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 ...
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 ...
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 ...
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 ...
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 ...
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
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 ...
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 ...
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 ...
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 ...
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 ...
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.
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 &...
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♦
- 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}"
...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
automator × 1595applescript × 683
macos × 405
finder × 208
terminal × 176
script × 123
automation × 93
services × 91
keyboard × 90
command-line × 89
bash × 83
pdf × 71
mac × 43
mail.app × 39
safari × 33
folders × 32
screen-capture × 32
shortcut × 30
python × 28
folder-action × 28
email × 26
copy-paste × 25
catalina × 24
google-chrome × 24
applications × 23