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.
While I have older hardware (a 2013 MacBook Pro) that I use for testing macOS betas—it's now running Catalina—it's often handy to have the latest macOS beta running in VMware Fusion on my iMac. With past OS releases, this has been a relatively easy process. With Catalina, however, attempting the install results in a black screen.
Thankfully, some enterprising Fusion users (Bogdam and intel008) have figured out a workaround. I tried it, and while it did work for me, I had to change the instructions just a bit (read on for the details).
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.
In my recent post A new set of Hubble deep space iMac retina desktops, I included a set of auto-cropped 5120x2880 desktops. In that post, I wrote:
These images were automatically cropped from the master image (after I cropped that; more detail on what I did is coming in a follow-up post), via ImageMagick.
So this would be that post: How to auto-crop huge images using ImageMagick. If you're not familiar with it, ImageMagick is a set of command-line tools to manipulate images. There are a number of ways to install ImageMagick, but I used Homebrew (brew install imagemagick).
I recently reviewed my new third-party mouse, the Logitech MX Master 2s ($70 at Amazon). I love all the customizable buttons on this mouse, and in particular, the ability to create gestures (which are simply a directional drag while holding down a button).
I've used two buttons to create a total of 10 gesture actions on my mouse:
I created the above image from the Logitech Options app, so I can refer to it if I forget which action I've assigned to which gesture. But it's a pain to find the folder on the disk and open it just to see the image. Then I remembered I had an unused button on my mouse1The upper button of the two near the side scroll wheel…
Note: While the following is specific to my Logitech mouse in terms of implementation, read on if you're curious about how to access QuickLook previews from Terminal and/or via a simple AppleScript.
There are some musical tracks that—even though they're distinct on the CD (or sold as separate tracks online)—are meant to be played together. As examples, there are a number of such Pink Floyd tracks, Queen's We Will Rock You and We are the Champions, and Jackson Browne's The Load Out and Stay.
I thought I remembered that iTunes used to be able to merge such tracks, and said as much on Twitter:
From the responses, I learned that my memory was wrong: You could only merge tracks during a CD import, which you can still do today:
But for online purchases or other non-CD music, the only solution appeared to be exporting the tracks, merging them together, then reimporting as one. (Doug Adams' $5 Join Together, for example, makes the process about as simple as possible.)
I only had a few such tracks I wanted to combine, so duplicating song data and using an external tool seemed like overkill, but it seemed like the only way. Then Chris Jennings came up with a solution that works for me (with some caveats…).
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.
Note: This was originally published in 2015; I've updated it with a minor change required for Mojave, and clarified a bit of the text.
macOS includes—and enables by default—translucency, which gives you 'wonderful' effects such as this in Calculator:
This is just one example; lots of other apps (Mail and Messages, to name two) contain panes that become grossly distorted by background color bleed-through. I'm not sure who at Apple (Marketing?) thinks this feature is good for productivity , but I find it completely distracting.
As a result, I turn off translucency on every Mac I own. You can do so yourself in System Preferences > Universal Access > Display. Just check the Reduce transparency* box, and you won't get any more bleed-through. (You'll also get a solid Dock, and perhaps the world's ugliest Command-Tab task switcher. Such is the cost of usability.)
* It's ridiculous that Apple calls this transparency, which is defined as "the condition of being transparent," and being transparent means being see-through, clear, invisible, etc. This is clearly translucency, or "allowing light, but not detailed images, to pass through." But I digress…
However, when writing for Many Tricks or Macworld, I often need to take screenshots. And because most users won't disable translucency, I prefer to take those screenshots with translucency enabled, so that they're closer to what most users might see. That means a trip through System Preferences to toggle the checkbox, which gets annoying after the second or third time you've done it.
There had to be an easier way—and after some missteps, I eventually found it.
I occasionally need to help one of our customers get the bundle identifier for a given app, for some purpose with one of our apps. While the task isn't complicated—the value is stored in a file named Info.plist within each app bundle—it's not something that's necessarily easy to explain to someone who doesn't have a lot of Mac experience.
I figured there must be a less-complicated solution, and I was right, though it's probably higher on the geek factor. After some searching, I found this thread at Super User, which offers a number of solutions. The simplest—and always working, in my experience—was the very first one: Open Terminal and run this command:
osascript -e 'id of app "Name of App"'
The "Name of App" is replaced with the name of the app as it appears when hovering over its Dock icon. For Excel, for example, it'd be:
osascript -e 'id of app "Microsoft Excel"'
Run that command, and it returns com.microsoft.Excel, which is just what I need—I just have the customer copy the output and email it back to me.
I use a ScanSnap ix500 scanner to scan a lot of paper into PDFs on my iMac. And thanks to the ScanSnap's bundled optical character recognition (OCR), all of those scans are searchable via Spotlight. While the OCR may not be perfect, it's generally more than good enough to find what I'm looking for.
However, I noticed that I had a number of PDFs that weren't searchable—some electronic statements from credit cards and utility companies, and some older documents that predated my purchase of the ScanSnap, at least based on some tests with Spotlight.
But I wanted to know how many such PDFs I had, so I could run OCR on all of them, via the excellent PDFPen Pro app. (The Fujitsu's software will only perform OCR on documents it scanned.) The question was how to find all such files, and then once found, how to most easily run them through PDFPen Pro's OCR process.
In the end, I needed to install one set of Unix tools, and then write two small scripts—one shell script and one AppleScript. Of course, you'll also need PDFPen (I don't think Pro is required), or some other app that can perform OCR on PDF files.