Extended app icon shortcut

I was scrolling through Federico Viticci’s shortcuts library the other day, looking for something to steal, when I came across this shortcut for finding and saving icons from the App Store. It’s the kind of thing that can be very helpful when writing a blog post about an app, so I installed it. I soon decided that it would work better for me with a little tweaking.

Here’s how Federico’s shortcut works: It asks you for a search term and returns the top five hits from the App Store. You select the one you want (or cancel and try again if the search didn’t work) and a 512×512 PNG of the app’s icon appears in your Photos app. In a nice touch, the corners of the icon are rounded off to appear as they would on your home screen.

You can imagine how often this shortcut gets used by the industrial-strength app reviewing team at MacStories, but even a small-timer like me can make use of it. But to automate the process further, I wanted the shortcut to upload the image to my server and delete the local copy from my iOS device. Also, since I’m usually in the App Store at some point when I’m researching or writing a post about an app, it seemed more useful to my work habits to have the shortcut start from the share sheet instead of a search.

Here’s how my Upload App Icon shortcut works:

  1. Go to the App Store entry for the app of interest.
  2. Tap the three-dots button near the upper left corner of the page and choose Share App… from the popup menu. This will bring up the standard share sheet.

    Sharing from the App Store

  3. Choose Shortcuts from the share sheet and select the Upload App Icon shortcut.
  4. Enter a description for the image. The default description is “App icon for app name,” which is what I want most of the time.

    Default description of uploaded icon

  5. Decide whether to delete the icon image from Photos.

    Ask to delete local icon image

The image is now on my blog’s server, in a folder (for the above example) named “images2018” with the name “20181121-App icon for Annotable.png.” The year in the folder name and the date prefix in the file name are handled by the shortcut.

Here’s the shortcut itself, with the server information anonymized.

Upload App Icon shortcut

I think I’ve reached (or maybe exceeded) the limit of shortcut length that can be comfortably displayed here. If you want to adapt the shortcut for your own use, download it and edit away.

The first five steps (not counting comments) are taken straight from Federico’s shortcut. They get the icon’s URL, download the image, mask it to round off the corners, and save it to Photos.

The next three steps handle the file extension of the saved image, making it all lower case and changing “jpeg” to “jpg.” The latter is probably unnecessary, as icons are (I think) always PNGs, but better safe than sorry. We’ll use the extension later to set the name of the uploaded image and to decide whether it’s necessary to run an image compression command.

The following four steps get the date strings that will be used to set the folder and the prefix of the image name. They’re taken from this shortcut I wrote a couple of months ago.

The next five steps set the name for the uploaded file. This starts by getting the app’s name and using regular expressions to extract just the part before the first colon or hyphen. Many apps, like Annotable, include descriptive bits in their name to make them easier to find. The Match and Replace regexes get rid of that stuff. The user is then asked to provide the description, with the default as described above. Finally, the full name of the uploaded file is assembled from the date, the description, and the extension.

The next eight steps upload the image and, if necessary, run the OptiPNG image compression command. These steps are also mainly lifted from my earlier screenshot uploading shortcut.

Finally, the last two steps delete the icon from Photos. The Delete Photos step automatically gives the user the option to cancel the deletion, so there was no need to write any of that code.

Sharp-eyed readers will notice that this shortcut includes no Set Variable steps. It’s possible that I’ve finally figured out how to use Shortcuts’s magic variables. One feature that makes them easier to use, and the resulting code easier to understand, is renaming. After choosing a magic variable, you can tap on it to reveal several options for the information you can extract. This is like a dictionary in Python, a hash in Perl, or a record in AppleScript.

Magic variable info

As important as the ability to pull out different information is the little Rename button at the top left. This allows you to give the magic variables that appear in your shortcut a more descriptive name than the default—especially helpful when you have more than one magic variable called “Text” or “Match Results.”

Rename magic variable

Update Nov 22, 2018 6:41 AM
If you download the shortcut now, you’ll get a version that’s been considerably simplified, partially through suggestions from Federico and partially through my own exploration and testing.

The simplifications are as follows:

  • It gets the icon directly as an app property instead of getting the icon’s URL and then downloading it.
  • It no longer saves the icon to Photos and therefore doesn’t have to delete the image at the end. When it’s time to upload, it accesses the image via the Masked Image magic variable.
  • It no longer includes provisions for JPEG images. I’m pretty sure icon artwork is always in PNG format.

Here are the steps of the new streamlined version.

Upload App Icon shortcut

Down to cases

The new iPad Pro design caught third party case makers flat-footed. Too many have started by following the old formula of offering new cases that match the 2018 iPad Pro geometry. Too few have adapted their cases to handle the key 2018 iPad Pro features: the many magnets and the new way to charge the Pencil.

In the past, it was common for leather cases to cover the edges of the iPad, with small cutouts for the Lightning and earbud ports, holes that aligned with the speaker grills, and flexible areas over the buttons. And when the new iPad Pros were announced, the first instinct of many case makers was to pop out new cases of that same general style.

Sena, who make the Vettra case I use (and love) with my 2016 9.7″ Pro is offering a couple of cases for the 2018 Pros, but neither of them put the Pencil where it belongs, snapped to the long edge of the iPad. The photos of the new Vettra case aren’t clear on this, but I wrote Sena, and they told me their new cases don’t have a cutout along the side to allow the Pencil to attach to the iPad, nor can they charge through the material.

New Sena iPad Pro cases

This is absurd. Sena cases are meant to be kept on the iPad all the time; how can they in good conscience offer a product that prevents the Pencil from charging?

Speck, at least, is up front about it. It says clearly of its Presidio case that it “Does not allow for charging of Apple Pencil (Generation 2)—update coming in early 2019.”

Speck Presidio case for iPad Pro

In the Overview section of the page it says

Currently, the design of Speck Balance FOLIO, Balance FOLIO Clear, and Presidio Pro Folio does not allow for the full use and housing of the latest Apple Pencil® (Generation 2). In some cases, it’s unable to charge the newly designed pencil. This is not unique to Speck cases as most leading protective cases on the market were designed to house the older version of the pencil.

However, Speck is committed to quality and will be releasing updated versions of the Balance FOLIO, Balance FOLIO Clear, and Presidio Pro Folio designs in early 2019. These updated versions will accommodate all the latest Apple iPad functionality. Also, in our continued commitment to customer satisfaction, Speck will provide all customers who purchased the current design with a FREE UPGRADE as soon as they are available.

This is good—better than Sena—but based on the complaints in some of the Presidio reviews, I suspect Speck wasn’t as explicit about the lack of Pencil support when they started selling cases for the new Pros.

Pad and Quill, to their credit, are not preventing the Pencil from attaching, but they stick their case to the back of the iPad with adhesive instead of magnets. No thanks.

Pad and Quill iPad Pro case

I was resigning myself to buying the Apple Smart Folio1 as a temporary solution until the other case makers get their act together with regard to the Pencil and the magnets. Given that the Smart Folio isn’t leather, this is an expensive stopgap. But I’ve noticed more recently that cheaper versions of it, in leather, are starting to appear on Amazon. One of these will probably be my case until Speck or Sena or someone else comes up with a premium case that really works.

  1. This is the regular Smart Folio, not the Smart Keyboard Folio, which I don’t like as a keyboard or as a case. 

Screenshooting on the iPad

About 55 minutes in to the current episode of Upgrade, Myke Hurley and Jason Snell talk about taking screenshots on the new iPad Pro. With the home button gone, the process has become more like that on the iPhone X line: press the top1 and volume up buttons simultaneously. This does seem, as Myke says, a little awkward, but I’m surprised either of them use that method of taking a screenshot very often.

If you’re using a keyboard with your iPad—as I believe Myke and Jason usually do when they’re working—the traditional Mac keyboard shortcuts of ⇧⌘3 and ⇧⌘4 work, and the difference between the two is an interesting twist on the Mac behavior.

As you probably remember, ⇧⌘3 on a Mac takes a screenshot of the whole screen and ⇧⌘4 turns the cursor into crosshairs so you can select a rectangular portion of the screen to capture.2. On the iPad, ⇧⌘3 captures the whole screen, just like the Mac (and just like capturing with the top and volume up buttons). The ⇧⌘4 shortcut also captures the whole screen, but in a neat analogy to the Mac, it immediately puts you into editing mode so you can crop the capture down to a smaller size.

Screenshot in editing mode before saving

One oddity about screenshots on iOS that has no analogy with the Mac is that their file format depends on whether they’ve been edited. If you take a screenshot on your iPhone or iPad and save it directly to Photos with no changes, it’s saved as a PNG. But if you crop it or draw on it before saving to Photos, it’s saved as a JPEG. Check the full-screen image above, and you’ll see that its a PNG. This cropped one, though, is a JPEG.

Cropped screenshot saved as a JPEG

As with many things in the Apple world, I have no idea why this is the case.

  1. What used to be called the sleep/wake button on both machines is now called the top button on the iPad and the side button on the iPhone. 

  2. Yes, I know you can also use ⇧⌘4 to capture a window at a time, but I’m focusing on the default behavior here. 

An unzipping shortcut

I’ve been planning to write a post about the new Apple products for over a week, but I keep getting distracted. Today, I went to Apple’s PR pages for the MacBook Air, the Mac mini, and the iPad Pro to download images and went off on another tangent. As usual, I will inflict that tangent on you.

Apple provides the product images as zipped archives, so when I clicked on the link in the press release, I was confronted with this “what do I do?” screen in Safari.

Zip file in Safari

The efficient thing would have been to walk ten feet over to my iMac and download the zip files there, where they can be expanded with almost no thought. But I took the procrastinator’s way out, deciding to solve the problem of dealing with zip files on iOS once and for all.

In the past, I’ve tried out a few zipping/unzipping apps, and they’ve all sucked, with user interfaces that are clumsy to navigate and look like something out of Windows 3.1. What I wanted was a clean, one-click solution similar to what we have on a Mac. A shortcut, if you will…

I went to the Shortcuts Gallery and searched on “zip,” “unzip,” and “archive.” There was a shortcut for zipping up a bunch of files and putting them into an email message, but nothing for unzipping and saving. I also couldn’t find anything by Googling. So I made my own.

Unzip to iCloud shortcut

As you can see, there’s not much to it. You can make it yourself or download it.

You run it as an Action Extension by bringing up the Share Sheet and selecting the Shortcuts Action. After you choose it from your list of Extension shortcuts, you’ll be presented with a Files-like location picker, from which you can choose where the expanded archive will be saved.

Choose where to save the expanded archive

Even though “iCloud Drive” is the Service chosen in Step 2 of the shortcut, it can also save locally and into Dropbox. I suspect it can use services like Box and Google Drive, too, but I don’t use those services and haven’t tested them.

There are a few thing to keep in mind:

I make no claim of originality with this. I’m sure plenty of people have written similar shortcuts, but I couldn’t find them. I didn’t even know there was an Extract Archive step in Shortcuts until today. I should spend more time on this page and this one.

Update Nov 12, 2018 6:53 PM
A few more things:

  • As with the Mac’s Archive Utility and the default behavior of the unzip command, the Extract Files action expands the archive exactly the way it was compressed. Whatever directory structure was zipped up will reappear within the folder you select in Step 2 of the shortcut. This could be a problem, as we’ll discuss below.
  • As you might expect, Federico Viticci has already made a shortcut to do this, which you can download and install. Federico’s is more complicated than mine. He uses the name of the archive (without the .zip extension) to create a new folder within the iCloud Drive Shortcuts folder and extracts the contents of the archive there.

    I’m of two minds on Federico’s shortcut. On the one hand, by creating a folder, it keeps things neat. With my shortcut, when you expand an archive that has lots of top-level files, those files can make a mess of the folder you save them in. On the other hand, Federico’s shortcut puts the expanded archive in a place I’ll never want it to go. It would be easy to edit Federico’s shortcut to put the extracted files somewhere other than the Shortcuts folder, but no matter what, it will go into a fixed location.

    As best I can tell, there’s no way to get the best of both worlds: a neat folder of the extracted files and a choice of where that folder will be.

  • Federico is putting together a massive list of shortcuts he’s built. The list is organized by category and includes both a download link for each shortcut and a brief description of what it does. The list is being continually updated, so it’ll be worth returning to after your first perusal.