46
votes
Accepted
Easy way to copy paste file paths on Macs
I think this is an option that will do exactly what you want. Using your Serial Number.jpg example, do as follows:
In the Finder browse to the image called “Serial Number.jpg” located on Server1
...
28
votes
Easy way to copy paste file paths on Macs
You can just drag & drop a file [or a whole swathe of them] into a text area to get its [their] path[s] - not in all apps but in many, including Terminal [& incidentally in the question/answer ...
17
votes
Delete all duplicate files
nohillside's answer to use rm *\ 2.ext will work just fine, but if you want extra confidence it's doing the right thing, you can instead use
mkdir to_be_deleted
mv -- *\ 2.ext to_be_deleted
That'll ...
14
votes
Keyboard shortcut flip screen
The following has been tested under macOS Sierra 10.12.5 and macOS High Sierra 10.13.3, and works without any issue on my system.
Using the example AppleScript code, from my original answer, saved as ...
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.
13
votes
Accepted
Delete all duplicate files
As much as I love the shell, it’s unforgiving with wildcards and spaces in general and worse if your script gets to folders you didn’t expect. Your case of all within one folder and no recursion ...
12
votes
Accepted
Create script to disallow using Mac at night?
This is what Parental Controls can be used for.
You can set the times where you can and cannot use the computer. The caveat is that you cannot be an Admin so you will need to give the reins of ...
12
votes
Accepted
How to md5 a list of filepaths contained in a file?
find . -type f -exec /sbin/md5 -r {} +
^^^^^^^ ^^^^^ ^^^^^^^^^^^^ ^^ ^
| | | | |
| | | | +- add as many file names as possible per call
...
12
votes
How to use terminal to visit a site and take screenshot?
You can use the open utility to open a URL in your default browser, along with the screencapture utility to take a screenshot. You may want to use the -T <seconds> option for the latter to give ...
11
votes
Using Apple Script to Manage Sound Output Selection
With a little experimentation on Arthur Hammer's script I discovered that the lines set deviceselected to "xyz" appear to be just visual feedback whilst in Script Editor & don't seem to be part of ...
11
votes
Can AppleScript be used to brute force a FileVault drive where the password is lost?
As a proof of concept, I formatted a USB Thumb-drive using a GUID Partition Map and formatted it Mac OS Extended (Journaled) naming it "Encrypted".
Then in Finder, I selected the disk named "...
11
votes
How to use terminal to visit a site and take screenshot?
If you have Google Chrome, you can open it in headless mode. It also have a way to "print" page to pdf. Try:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --headless --...
10
votes
AppleScript alternatives
Since Yosemite, OS X/macOS also supports JavaScript as an inter-process scripting language--officially known as JavaScript for Automation, also referred to as JXA. The documentation (and some would ...
9
votes
How to md5 a list of filepaths contained in a file?
Try this:
find . -type f -print0 | xargs -0 md5 -r
Note -print0 and -0 to handle spaces in filenames.
Compared to find . -type f -exec, this solution runs md5 much less frequently, although this ...
9
votes
Delete all duplicate files
In Terminal, rm *\ 2.ext should work.
PS: To be sure that the correct files get deleted, run ls *\ 2.ext first, or use rm -i *\ 2.ext to be prompted for each file.
8
votes
Is there a keyboard shortcut that I could use to set a task priority in Reminders.app on a Mac?
Yes. And it is built-in.
Tools used:
OS X 12.0.1
Reminders
System Preferences
Method:
Open Reminders
Open a reminder
Note the menubar sequence to create priority:Menubar > Edit > Priority &...
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
Accepted
AppleScript - How to identify buttons and press them?
Here's a little trick:
Obtain the screen coordinates of that button. You can do this by initiating a screen capture with crosshairs, usually by pressing ⌘⇧4 (⟨Cmd⟩⟨Shift⟩⟨4⟩). Navigate the cross ...
8
votes
Accepted
How to programatically set Terminal theme/profile
Alright i've figured out a solution:
To set the terminal theme programmatically you need to write to your systems preferences. So the easiest way that i found to do this was to extract the user ...
8
votes
macOS: How to take a picture from camera after 1 minute
You could do this using a Terminal tool like ImageSnap. ImageSnap can be installed using Homebrew:
$ brew install imagesnap
Or downloaded from GitHub.
You can then schedule a photograph using the -...
7
votes
How do I make a bash script so that I can drag its input on top of the icon?
I have created a AppleScript, that redirects all files dropped onto it, to a shell script with the matching name. Simply save as application from within Apple's ScriptEditor and rename as script.app ...
7
votes
How can I set a scaled display resolution from the command-line in macOS Catalina?
I’m not aware of any way to do this via defaults write (although it seems like it should be possible). I even checked MacPilot which is usually my go-to for hidden defaults.
My suggestion would be to ...
6
votes
Accepted
How do I automatically enable Personal Hotspot when my Bluetooth device is in range? (Similar to Tasker for Android)
There's a way to do this if you're jailbroken with tweak called Activator by Ryan Petrich, and unfortunately it's the only solution because regular App Store apps aren't allowed to access settings ...
6
votes
Accepted
AppleScript to return condition depending on audio file length
Okay, I've downloaded Hazel and tested the following AppleScript code on a New Rule to validate it works. The following code when used in an embedded script will set theResult to true on theFile, an ...
6
votes
Accepted
Keyboard shortcut flip screen
I wrote a program named displayplacer that makes this easy to do via a terminal command. You could bind this to a keyboard shortcut with a program like BetterTouchTool or maybe Automator. Works with ...
6
votes
Accepted
How do I run my automator service without opening automator?
In summary, to create a keyboard shortcut to run your Automator service you will need to use:
Automator to create your service so that it'll work the way you want
System Preferences to assign a ...
6
votes
What is the keystroke code for space bar in applescript?
Your sample code works properly on my machine (running OS X 10.11.6).
If keystroke space does not work on your machine, try the following:
tell application "System Events"
key code 49 -- space bar
...
6
votes
Accepted
macOS: How to take a picture from camera after 1 minute
If you do not want to install any utilities, you can define a workflow using Automator. Among the predefined actions that can be used, there's both Take Picture or Take Video Snapshot, which can be ...
6
votes
How to start an application when a specific disk is mounted
I didn't downvote wch1zpink's answer, but it's very much not the way that I would solve the problem.
Having an app run an AppleScript every 5 seconds is a very inefficient way to handle this ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
automation × 601macos × 272
applescript × 158
automator × 93
ios × 60
script × 49
command-line × 45
iphone × 43
terminal × 43
finder × 39
shortcuts-app × 34
keyboard × 25
bash × 25
shortcut × 21
pdf × 19
safari × 18
software-recommendation × 18
applications × 14
wifi × 12
network × 11
numbers × 11
folders × 11
siri × 11
mac × 10
macbook-pro × 9