A user asked me a question about Moom…
Say I’ve resized a window to the dimensions I want. Is there a way to figure out what these are so I can create a resize action in Moom?
Basically, the user wants to save a window size as a custom action, to make it easy to reapply that action to any window. (If it were just one window in one app, you could use Moom’s Save Window Layout feature to save that layout for easy recall.)
There is a way to see this info in Moom, but it requires enabling our debug log and digging through a bunch of output. As an easier alternative, I was certain that AppleScript could do this; I fiddled a bit on my own, and did some web searching, which led me to this thorough post on StackExchange.
Using the very first bit of the first script there, I came up with this version:
tell application "System Events"
set appOfInterest to "Safari"
set windowXY to size of the first window of application process appOfInterest
display notification (item 1 of windowXY as text) & " x " & (item 2 of windowXY as text) with title "Frontmost window of " & appOfInterest & ":"
Run the above, assuming Safari is running and has an open window, and you’ll see this system notification:
Change Safari to whichever app you’re interested in, re-run the script, and you’ll have that app’s window dimensions. This script is incredibly basic (no error checking, hardcoded app), but it works1If you see a message about ScriptEditor needing Accessibility access, open System Preferences > Security & Privacy > Privacy, click on Accessibility in the left panel, click the lock icon to unlock the panel, click the plus sign to add an app, and navigate to Script Editor in Applications > Utilities, then click Open..
Of course, me being me, I decided I’d spend a couple hours making it more useful, even though I probably won’t use it all that often. So I modified it to work for whichever app is frontmost, and made it run from Keyboard Maestro. I then assigned it a gesture trigger with my mouse, so I can easily see any window’s dimensions with a simple mouse movement.
I use Excel for a ton of stuff, both personal and work. As an example, on the work side I use an Excel workbook to track our apps’ hidden prefs—which are set using a long ugly Terminal command1Something like this: defaults write com.manytricks.Moom “PMWindowFadingDuration” -float 0.
These hidden prefs can be used to invoke features we’re testing, or to revert a behavior we’ve changed at some point, etc. For example, Moom has hidden prefs to use the full screen grid without clicking in the big box and to disable the fade in/out of the keyboard controller.
We don’t publish all of these, as we’re not necessarily ready for them to be put to use by everyone (otherwise, they’d be visible prefs). But there are cases when a user has a specific need for a setting, or when troubleshooting, that these hidden prefs can be very useful. As such, I often have to send someone a defaults write command.
Read on to see how I use Excel’s formatting features—plus the ever-valuable Keyboard Maestro—to disguise some of this workbook’s formula results, yet still easily copy them for sending to a user.
Note: Revised on December 4, 2018 with a much better implementation of the pop-up palette, and some changes in timing and mouse movement.
One of the “problems” with Keyboard Maestro is that it’s so useful I use it a lot, leading to a large collection of macros. Due to the number of macros, sometimes when I want to add a new shortcut, I can’t remember if I’ve used that shortcut before or not. Today’s tip comes in two flavors to address that problem: Simple and Complex.
The Simple solution
Short of just trying the shortcut, there’s a way to check from within Keyboard Maestro itself: Type the macro’s activation keys into the search box, as seen in the box at right.
You can’t do this by pressing the actual shortcut keys—you have to type their character representations. You can do this with the “Show Emoji & Symbols” option under the flag icon in the menu bar, if you’ve enabled it in the Keyboard System Preferences panel. But finding those few special keys (if you even know how to search for them) is a pain.
Technically, you could also use the pop-up character palette macro I wrote, except there’s an issue: When the palette activates, it deactivates the search box, so the characters don’t make it there. It’s also overkill for this task, because there are characters that wouldn’t be part of keyboard shortcuts, and you’d never need the HTML codes, just the characters.
So I wrote what wound up being a set of new macros that make searching for assigned keyboard shortcuts much easier.
Last fall, I finally made the move from iPhoto to Photos…months later, I still find myself frustrated by many things in the Photos’ user interface.
Today’s aggravation dealt with cleaning up a bunch of older photo albums—some I just wanted to delete, others I wanted to convert from Smart Albums into normal albums (because I wouldn’t be adding any more photos that used the keywords in the Smart Album). That meant I wanted to delete a bunch of albums—well over 100.
Deleting an album in Photos can only be done from either the My Albums overview, where you can select more than one (though not across folders), or via the contextual menu in the sidebar.
The My Albums view wasn’t going to work for me, as I needed to look at and work with many of the albums, across many folders. But after the sixth time of doing the “right click, select Delete Album, tab to Delete in the confirmation dialog, press Return” dance, I was sick of it. Time for another Keyboard Maestro macro.
This one is very simple—it just replicates the actions required to delete an album. With it in place, I click on the album I wish to delete, then press Control-D. It’s still more mouse interaction than I’d prefer—why can’t I select albums via the keyboard?—but it’s oh so much faster than using the contextual menu.
Between Many Tricks and this blog, I spend a lot of time in browsers. Most of the time, I use Safari, but I do occasionally work in Chrome and Firefox, too—most often to check how a page looks or functions.
I keep my “permanent” bookmarks in Safari, and don’t presently use any sort of cross-browser sync. (I used to use one, but had a lot of trouble with duplicates, so I stopped.)
I wanted a way to open a limited number of URLs in either Safari (if that’s what I was in, or if I wasn’t in a browser), or in the frontmost browser, if that browser were frontmost. I could just create the subset as bookmarks in each browser, but if I wanted to add or remove a page from the list, I’d have to do so multiple times.
In the end, I came up with a set of Keyboard Maestro macros that do exactly what I want. I access my short list of multi-browser URLs via Keyboard Maestro’s pop-up palette, as seen at right.
This appears when I press ⌃1; after that, a single digit opens the desired URL. But how does it know whether to open the URL in Safari or one of the other browsers? It takes one helper macro, then one macro for each URL that I want to open in this manner.
Yesterday on Twitter, Dave Hamilton tweeted…
What is this speedtest exactly? And what is brew, you may also be wondering? You may also be wondering why, if you have brew, Dave’s command doesn’t work…that’s because it’s actually brew install speedtest_cli…but I’m getting ahead of myself.
speedtest is a command line interface (i.e. Unix app run from Terminal) to the connection speed tests at Speedtest.net—you get the results without the fancy animated graphics. And Brew is “the missing package manager for macOS.” In other words, it’s an app to help you install (and uninstall) other apps.
Here’s how speedtest looks in its default mode—note that I’ve sped things up greatly for the GIF…
Much nicer to me, though, is the simplified version:
$ speedtest_cli --simple
Ping: 9.482 ms
Download: 94.23 Mbit/s
Upload: 68.66 Mbit/s
No animated dots, just three lines with the results. As you might expect if you read here regularly, I also wrote a Keyboard Maestro macro (of course I did!) that makes it really easy to run the simple version of the test, and does some editing of the output to simplify the display:
If you’d like to install speedtest (and maybe add the macro)—even if you don’t want to install Brew to do so—keep reading…
This post was originally published in Decwember of 2016. I took it down to replace one section (using repeats) with another (using groups), and to expand some other areas.
I’ve been using Keyboard Maestro (or KM for short) a lot lately, i.e. Create an iTunes song info window or A much improved special character palette, or a slew of others.
As my collection of macros has grown, and some of those macros have gotten more complex, I’ve been using a few of KM’s features to help keep my macros organized, and make it easier to debug them while I’m working on them. Some of these are obvious, some maybe not so obvious, so I thought I’d share what I’m doing.
Yesterday, I added an SSL certificate to my site, and posted a brief note about the change. In that post, I included an image…which turned out to be, well, the comments say it all:
Yes, I posted a non-https image in the ‘site is secure’ post. Sigh.
So I took Jonathan’s comment to heart, and created a Keyboard Maestro macro that ensures I post only relative URLs from now on.
Generally, I don’t think such a thing would be worth sharing, as it’s just a basic text replacement macro, right?. Mostly right, but in this case, I learned about a Keyboard Maestro feature that may be useful to others. So share I will…
I was working on something with Peter about Moom and its disk usage (it doesn’t use much), and I was curious as to just how long Moom had been running on my Mac. I last rebooted my Mac a week ago, but I often quit and relaunch our own apps to run test versions.
Finder has this info, but that requires finding the running app in Finder. I wanted a quicker solution. In Activity Monitor (and ps in Terminal), you can see how much CPU time an activity has taken…
…but that doesn’t really help at all with knowing when the app (or process) launched. As long as you’re in Activity Monitor, you can get the information by doing the following:
- Click once on the app or process of interest.
- Press Command-I or click the small ‘i’ icon in the toolbar.
- In the new window that opens, click Sample, then wait.
When the sample is complete, you’ll see its output, and included there is the selected item’s launch date and time:
Analysis of sampling Moom (pid 89861) every 1 millisecond
Parent Process: ??? 
Date/Time: 2017-02-15 07:41:18.611 -0800
Launch Time: 2017-02-13 19:44:11.957 -0800
That’s all fine if you’re in Activity Monitor, but a bit of a pain if you need to launch it, find the app, run a sample, etc.
As you might expect, there’s another way via Terminal: The lsappinfo command, which queries CoreApplicationServices about any app or process on your Mac.
My home workspace is a 27″ Retina 5K iMac (2560×1440) paired with a vertical 4K display (scaled to view 1440×2560). While I love this setup in general, there’s one time it’s annoying: When I need to move the cursor between displays, and it’s located far away from its destination.
There are many ways to solve this problem, including our own Keymo, which I still use when I want to teleport a drag across displays. But what I really wanted was a fast way to move the cursor to the other display when I switched to a window on the other display—because generally, if I’ve activated the window, I’m probably going to use the mouse in that window at some point.
Using Keyboard Maestro, it’s possible to create a macro to make this happen automatically:
This macro will activate every time you switch applications, and then move the mouse to the center of that newly-frontmost window and highlight its location with a quick circle. Having tested this, however, I can say it’s a non-ideal solution: Most of the time when I switch an app, I do not want the cursor to move. I found it more annoying—much more annoying—than useful.
As useless as the above macro is, with one minor change it quickly became one of my most-used macros…