![]() Here’s a download link to the Keyboard Maestro Macro. When I’m ready to take the laptop, I push the button, wait a moment, and then unplug and head out. This is the method that has stuck with me. I’ve also mapped it to a button on my Stream Deck, which is how I usually activate it. I use the Hyper Key plus Q to activate it (⇧⌃⌥⌘Q). (I have separate scripts for setting up screens on the laptop screen or the monitor when I plug back in.) Then I eject the drives by running the above AppleScript. I prefer to close everything out when disconnecting. I do this because I have very particular screen setups when I connect to the big monitor. I run this script as part of a Keyboard Maestro Macro. Here’s the script: try tell application "Finder"ĭisplay dialog “Successfully ejected disks.” buttons default button “Close”Īs AppleScripts go, this one is pretty basic. (The two things that would make this easier, one is being able to configure the shell that Keyboard Maestro uses to execute shell commands - this is not your default shell, does not respect the /. So I made a simple AppleScript that ejects all external drives. ![]() I wanted, however, something more automated. A power tip with EjectBar is to Command-Click the menu bar icon, and it automatically ejects all connected drives. All of these should be run from an Execute an AppleScript action, and they will run a bit faster if run as compiled-scripts rather than as text-scripts. This is a menu bar app that, once you click it, lets you eject from the menu bar, saving you a trip to the Finder. Three AppleScripts to make navigating in the Keyboard Maestro Editor a little easier. There are also some excellent apps to solve this problem. (In my case, Dagobah is my Time Machine Drive, and Batuu is my extra storage.) This solution works but is tedious. There is a handy little Eject button next to each removable drive. This returns everythinginput, output, and the prompts. Getting back to the macro, Line 5 defines a short AppleScript that gets the history of the frontmost Terminal session and Line 6 runs it. You could go in the Finder and eject the drive under “Locations” in the Sidebar. The former runs an AppleScript command and returns the output the latter rewrites a string with quotes that AppleScript understands. (Just yanking a drive out of your Mac is a terrible idea.) It’s important that I properly dismount those drives before unplugging. Scripting on OS X Using Keyboard Maestro. I have a Time Machine and external storage drive connected to my Mac when attached to the monitor. It appears macOS 12.3s Finder breaks AppleScript support for opening files, it this: set rtfile to alias ((path to desktop as text) & richtext.rtf) tell. ![]() However, another friction point is disconnecting. Maybe it is the Apple silicon switchover or improvements to macOS, but that’s no longer a problem. I prefer to keep the laptop closed when doing this (often called “clamshell” mode), and for years macOS did not like that. The last time I tried this, I had lots of problems getting the Mac and monitor to talk to each other when I’d plug it in. I’ve been using a laptop + monitor setup for a while now, and I like it more than I expected.
0 Comments
Leave a Reply. |