This Week's Sponsor:

Incogni

Put an End to Spam, Scams, and Robocalls on Your iPhone


Posts tagged with "applescript"

Jack Wellborn on Making Computers Personal with Automation

Jack Wellborn, one of our Automation April Shortcuts Contest judges, has a great post on his website that’s perfect for Automation April.

As Jack explains, apps built for a general audience require some features to make way for the ones that most people use. While the approach is understandable from a design standpoint, it can be frustrating if any of those semi-hidden features are ones you rely on. However, as Jack explains, there’s a solution:

This is where personal automation comes in. Personal automation gives individuals the ability to choose which of their features should be most easily accessed. I used Shortcuts and AppleScript to elevate star ratings using dedicated keys on my Stream Deck. Now I can rate songs regardless of what app I am currently using, and in one step instead of five. Using personal automation, I have also changed how Time Machine works, streamlined pasting links from Safari, and made joining Zoom meetings practically effortless.

Personal automation doesn’t need to involve expensive third party hardware, or require scripting. It can be something as simple as customizing keyboard shortcuts or defining text replacement macros. Apple’s Shortcuts app is completely drag-and-drop, and makes building personal automation easy enough for even basic users. On top of the many automation apps and features included with Apple’s platforms, there are also a slew of great third party apps that unlock even more possibilities.

I love Jack’s perspective on automation. He was the winner of our Best Overall Shortcut in last year’s Automation April Shortcut Contest. It wasn’t the most complex shortcut we received, but it had the perfect combination of originality, thoughtful design, and everyday utility that our judges look for. As Jack points out, personal automation is about making your devices work for you and not the other way around, which is what Automation April is all about.

To learn more about how to submit a shortcut to the Automation April Shortcuts Contest, be sure to check out my story with all the details that was published on MacStories yesterday.


You can also follow MacStories’ Automation April coverage through our dedicated hub, or subscribe to its RSS feed.

Permalink

Generating Markdown Links to Mail Messages with Shortcuts and AppleScript

One of the system app updates we covered on AppStories this week that I’m most excited about is Mail. The app will finally introduce several advanced features this fall, including:

  • Undo send, allowing you to recall a message for 10 seconds after sending a message
  • Message scheduling with suggested and fully-customizable future delivery times and dates
  • Follow Up, which surfaces requests you’ve made in messages for which you haven’t received a response
  • Remind Me, a snooze-like feature for scheduling messages to reappear in your inbox later
  • Missing recipient and attachment alerts
  • Improved search

For the first time in quite a while, that list makes Mail a much more attractive alternative to third-party apps. Mail won’t match every feature offered by third parties, but my needs for advanced email client features are fairly modest, which I expect puts me squarely in the demographic that Apple is targeting.

Mimestream offers Gmail's excellent search and other features in a native Mac package.

Mimestream offers Gmail’s excellent search and other features in a native Mac package.

Until recently, my email use was split between Mimestream, which is only available on the Mac, and Spark on iOS and iPadOS. The split wasn’t ideal, but because I handle most of my email on my Mac, I tolerated it.

For the past several weeks, I’ve been using Mail exclusively on all of my devices, which has been a refreshing change of pace. Still, it’s not perfect. Of the features I use most in third-party mail clients, the single biggest shortcoming of Mail is its clunky implementation of deep linking.

I drop links to email messages in my notes and tasks all the time as a way to quickly access important contextual information. Mimestream offers Gmail URLs, and Spark can create its own app-specific and web URLs right within those apps’ UIs.

I like the way drag and drop on the iPhone and iPad links a message to its subject, but having to use drag and drop is clunky.

I like the way drag and drop on the iPhone and iPad links a message to its subject, but having to use drag and drop is clunky.

In contrast, on iOS and iPadOS, you can only link to a Mail message by dragging it out of Mail into another app’s text field. I’ll take it, but I’d prefer if I could quickly generate a link from the share sheet or with Shortcuts instead. The situation on the Mac isn’t much better, requiring users to resort to AppleScript to construct a URL that links back to a Mail message.

With weeks of Ventura testing ahead of me, I decided to see what I could do to improve the situation. The result isn’t perfect: I still have no choice on iOS and iPadOS but to drag and drop messages. However, I’ve improved the experience on the Mac using a combination of AppleScript and a shortcut that I trigger using Raycast to link the subject of a Mail message to its URL. For added context, my shortcut adds the sender’s name too.

Read more


UI Browser for macOS to Be Retired in October 2022

Longtime MacStories readers may be familiar with UI Browser, an incredible scripting tool for macOS created by Bill Cheeseman. UI Browser lets you discover the AppleScript structure of an app’s menu system, taking advantage of Apple’s Accessibility APIs to make it easier to script UI, which is not – how do I put this – normally “fun”, per se. UI Browser developer Bill Cheeseman, having turned 79 years old, has decided it is now time to “bring this good work to a conclusion”, and the app will be retired in October.

Here’s what John Gruber wrote about UI Browser last week:

Long story as short as possible: “Regular” AppleScript scripting is accomplished using the programming syntax terms defined in scriptable apps’ scripting dictionaries. If you ever merely tinkered with writing or tweaking AppleScript scripts, this is almost certainly what you know. But as an expansion of accessibility features under Mac OS X, Apple added UI scripting — a way to automate apps that either don’t support AppleScript properly at all, or to accomplish something unscriptable in an otherwise scriptable app. UI scripting is, basically, a way to expose everything accessible to the Accessibility APIs to anyone writing an AppleScript script. They’re not APIs per se but just ways to automate the things you — a human — can do on screen.

A great idea. The only downside: scripting the user interface this way is tedious (very verbose) at best, and inscrutable at worst. Cheeseman’s UI Browser makes it easy. Arguably — but I’ll argue this side — “regular” AppleScript scripting is easier than “UI” AppleScript scripting, but “UI” AppleScript scripting with UI Browser is easier than anything else. UI Browser is both incredibly well-designed and well-named: it lets you browse the user interface of an app and copy the scripting syntax to automate elements of it.

I first covered UI Browser in 2019, when I published a story on how I could control my Mac mini from the iPad Pro using Luna Display and some AppleScript, which I was able to learn thanks to UI Browser. I then mentioned UI Browser twice last month for Automation April: it was thanks to the app that I managed to create shortcuts to toggle the Lyrics and Up Next sidebars in the Music app for Monterey. Maybe it’s silly, but I think there’s something beautiful in the fact that the last thing I did with UI Browser was bridging the old world of AppleScript with the modern reality of Shortcuts.

Gruber argued that Apple should acquire UI Browser and make it part of their built-in scripting tools for macOS; while I don’t disagree, I think it’s more realistic to hope another indie developer or studio picks up UI Browser and continues developing for as long as possible. There’s nothing else like it on the market, and I’d like to thank Bill Cheeseman for his amazing work on this application over the years. It’ll be missed.

Permalink

MacStories Starter Pack: Clean Up URLs and Remove Tracking Parameters with URL Cleaner

URL Cleaner for iOS.

URL Cleaner for iOS.

Editor’s Note: Clean Up URLs and Remove Tracking Parameters with URL Cleaner is part of the MacStories Starter Pack, a collection of ready-to-use shortcuts, apps, workflows, and more that we’ve created to help you get the most out of your Mac, iPhone, and iPad.

Picture this:

You’ve just come across an interesting article or product you want to share with someone, so you copy the URL and you’re ready to send it over iMessage, tweet it, link it on your site – you name it. Then, you notice that the URL has a bunch of ugly tracking parameters appended to the end of it. I’m sure you’ve seen them too: it’s those ?utm and soc_src1 and similar strings of text that some web publishers rely on to monitor where traffic is coming from and track other parameters about clicked URLs. For a publisher, those bits of data can actually be useful; for the end user, however, I’ve always wished there was an easy way for apps or extensions to “clean up” URLs and return the vanilla version of a link without any tracking parameter attached.

So, for the debut of our MacStories Pack event, I decided to fix the problem myself with a shortcut I appropriately called URL Cleaner. With this shortcut, which you can download for free at the end of the story and find in the MacStories Shortcuts Archive, you’ll be able to instantly remove popular tracking parameters from any URL and get a “cleaned up” version of it copied into the system clipboard. Best of all, URL Cleaner has been specifically optimized for iOS, iPadOS, and macOS, taking advantage of desktop-specific actions in macOS Monterey all while remaining integrated with the share sheet and Siri on iPhone and iPad.

Let’s take a look.

Read more


How to Batch Convert Shortcuts for Use Throughout Monterey and with Other Automation Apps

My latest Shortcuts experiments began in earnest on my way back from Rome. I stopped in Ireland for a few days to deal with COVID testing and start ramping back up to my normal work routine. I wasn’t quite ready to tackle the day-to-day yet, so I decided to revisit a Shortcuts experiment I had started back in June.

I’ve been a fan of PopClip for years and have played around with creating my own extensions for the app occasionally. So, shortly after WWDC, I tried building a PopClip extension that triggered a shortcut that had been saved as a Service. PopClip works with services, and the extension I built came tantalizingly close to working, but it had too many issues to be useful, so I set it aside.

PopClip.

PopClip.

Sitting in Dublin with the released version of Monterey and a new version of PopClip that had been updated to work with Shortcuts, I revisited my early experiments. The updates to macOS and PopClip made adding shortcuts as PopClip extensions trivially easy, as Federico demonstrated recently in MacStories Weekly. Then, when I got home, my Stream Deck was waiting for me, which led to another round of experimentation and an in-depth story on the many ways it can run shortcuts.

Since then, I’ve been incorporating Mac shortcuts I’ve built into my workflows using multiple third-party apps like BetterTouchTool, Alfred, and, of course, PopClip. It wasn’t long before I wished there was a way to batch process shortcuts, so I could use them in multiple ways across Monterey and in third-party apps.

Scripts built with AppleScript are just one way to integrate shortcuts with other apps.

Scripts built with AppleScript are just one way to integrate shortcuts with other apps.

To streamline the process, I turned, of course, to Shortcuts itself. In total, I’ve created four shortcuts to help me deploy my favorite shortcuts across macOS:

  • Script Builder: Generates .scpt files that can be incorporated in other apps from multiple shortcuts using AppleScript
  • Dock Applet Builder: Creates Dock applets from shortcuts that can be launched from the Finder, app launchers, and more
  • Script Applet Builder: Converts shortcuts into AppleScript applets with custom icons that behave like Dock applets but don’t get automatically deposited in your Dock
  • PopClip Builder: Produces and streamlines installation of multiple PopClip extensions with custom icons that run shortcuts

I’ll cover the first two shortcuts here. Script Applet Builder and PopClip Extension Builder are included in The Macintosh Desktop Experience, my column for ClubMacStories+ that explores new ways to make your Mac work for you.

Read more


Shortcuts for Mac: The Future Is Now

Source: Apple.

Source: Apple.

To say we’ve followed Shortcuts closely at MacStories is probably an understatement. Federico was relying on it to run MacStories months before it was publicly released as Workflow, and today, the app is deeply embedded in every aspect of our production of the website, podcasts, and Club MacStories content, as well as the way we operate the business.

As someone who works across a Mac and iPad all day, the lack of Shortcuts on the Mac was frustrating, but something I was willing to deal with because the app was such a good fit for the way I worked, even when I had to run it in parallel to my Mac instead of on it. Going into WWDC, though, my feelings about automation on the Mac aligned closely to what Jason Snell wrote on Six Colors earlier this year. As we discussed on AppStories, the time had come for Shortcuts to be available on all of Apple’s platforms, which was why I was so pleased to see it become a reality during this week’s WWDC keynote.

Read more


iPad Diaries: Using a Mac from iOS, Part 1 – Finder Folders, Siri Shortcuts, and App Windows with Keyboard Maestro

iPad Diaries is a regular series about using the iPad as a primary computer. You can find more installments here and subscribe to the dedicated RSS feed.

After several years without updates to a product that, somewhat oddly, “remained in Apple’s lineup”, the Mac mini was revived by the company last November with a major redesign geared toward pro users and designed for flexibility. As listeners of Connected know, one of the show’s long-running jokes was that I would buy my last Mac ever as soon as Apple released a new Mac mini1; when it happened, I took the opportunity to completely rethink my home office with a new desk, well-specced Mac mini, and 4K display that supported both modern Macs and iPad Pros via USB-C.

Effectively, I had never owned a desktop Mac until2 this Mac mini arrived. I always preferred portable Macs to workstations, and over the years I moved from a late 2008 MacBook Pro to a 2011 MacBook Air and, in 2015, back to the (now Retina) MacBook Pro again. Over the past couple of years, however, and particularly since the introduction of iOS 11, my penchant for Mac laptops started clashing with the realization that the iPad Pro had become my de-facto laptop. I was using a MacBook Pro because I thought I needed a portable Mac machine just like when I started MacStories in 2009; in reality, the iPad had been chipping away at the MacBook’s core tasks for a while. Eventually, I saw how my MacBook Pro had become a computer I’d open twice a week to record podcasts, and nothing more.

With the iPad Pro as my primary computer, the Mac’s role in my life evolved into a fixed environment that was necessary for multi-track audio recording and Plex Media Server. And as I shared on Connected on several occasions, I realized that my workflow in 2018 wasn’t the same as 2009 anymore: it no longer made sense for me to have a Mac laptop when what I really needed was a small, but powerful and extensible Mac desktop. That’s why I started waiting for a new Mac mini, and my wishes were granted with the 2018 relaunch of the mighty desktop machine.

For the past three months, I’ve been busy setting up the Mac mini and optimizing it for the tasks that inspired its purchase. I bought external SSD drives (these two) to use for Plex and Time Machine backups; I set up a homebridge server to add unsupported accessories to HomeKit (such as our 2017 LG TV) and turn iTunes playlists into HomeKit scenes; I rethought my podcasting setup (I now have a Zoom H6 recorder and a taller microphone stand) and arranged my desk to make it easier to use the same UltraFine 4K display with the Mac mini and iPad Pro (I just need to plug in a different USB-C cable). Because this Mac mini is fast enough to handle 4K transcoding for Plex without breaking a sweat, I started using youtube-dl to enjoy 4K YouTube videos on iOS devices with the Infuse or Plex apps. I’m trying to take advantage of a powerful, always-on Mac server in any way I can, and I’m having lots of fun doing it.

This doesn’t change the fact that the iPad Pro is my main computer, and that I want to interact with macOS as little as possible. Aside from recording podcasts using Mac apps, I rely on the Mac mini as a server that performs tasks or provides media in the background. Any server requires a front-end interface to access and manage it; in my case, that meant finding apps, creating shortcuts, and setting up workflows on my iPad Pro to access, manage, and use the Mac mini from iOS without having to physically sit down in front of it.

In this multi-part series, I’m going to cover how I’m using the 2018 iPad Pro to access my Mac mini both locally and remotely, the apps I employ for file management, the custom shortcuts I set up to execute macOS commands from iOS and the HomePod, various automations I created via AppleScript and Keyboard Maestro, and more. Let’s dive in.

Read more


  1. It was funny because everybody thought the Mac mini line was done. ↩︎
  2. Many years ago, I did use an iMac for a few months. However, I never considered that machine truly mine – it was set up at my parents' house (where it now sits unused) and I worked on it for a while until I moved in with my girlfriend a few months later. ↩︎

AppleScript, the Perfect Adjunct to iTunes

Kirk McElhearn, writing for Macworld on automation in iTunes following Sal Soghoian’s departure from Apple:

No application can do everything its users need, and none should offer everything they want. For this reason, AppleScript has long been the perfect adjunct to iTunes, which is already feature-rich (some say “bloated,” but I disagree), and doesn’t need more options and tools. Many of these AppleScripts are designed to tag files, edit their metadata to correct errors, improve consistency, and ensure that users can find the files they want, and help them efficiently use smart playlists.

It’s not clear whether the termination of Mr. Soghoian means the demise of AppleScript altogether, and particularly in iTunes, but many developers, iTunes users, and others are concerned by this decision.

You see, it’s all about freedom. Freedom to do things we want that Apple doesn’t think we need to be able to do. Freedom to explore. Freedom to discover new ways to link applications, to interact with files, to create our own solutions. We can’t expect apps to cater to all our whims, and tools like AppleScript and Automator allow us to go a step further and discover ways to do things that Apple never even considered.

Losing AppleScript and automation features altogether would be a horrific loss for the Mac. However, I don’t think that’s going to be the case. Like Jason Snell, I believe today’s Apple finds this stuff uninteresting and “vintage”; rather than removing it, I feel like they’ll stop pretending they care about it, just as they did for Dashboard. Which isn’t an ideal scenario either, but between two poisons, it’s the one I’d pick.

See also: Dr. Drang back in 2013, ‘When and why I automate’.

Permalink

More On The AppleScript Improvements In Latest iWork Update

With yesterday’s update of the iWork suite for OS X, Apple reintroduced several AppleScript functionalities that had been removed in October, and brought new scripting features to Pages, Numbers, and Keynote as well.

Ben Waldie published an overview of the changes at Macworld, noting that the AppleScript improvements aren’t only focused on additions: Apple is now using a consistent AppleScript dictionary that should allow scripts to be easily reused across all iWork apps.

What’s especially interesting is that these suites are consistent from app to app. In other words, since all the apps have certain features in common, the same exact AppleScript terminology is used to script those features. This is huge: It means that if you write a script that builds a table or chart in Numbers, you can change the app name in your code to Keynote and your script should “just work” in Keynote. Want to add an image, replace some text, change the volume of every movie in a document? The code you write is the same for any of these tasks, regardless of which app you’re targeting.

When Apple relaunched iWork last year, they stressed how the apps had been rebuilt with full 64-bit support and a new unified file format. The return of AppleScript in iWork seems to highlight – as Waldie notes – a collaboration between different teams at Apple to improve consistency between apps, data exchange, and scripting features.

It took six months, but AppleScript appears to be alive and well at Apple. It may not be a priority anymore, and there’s no denying that Apple put power users through a rough transition last year, but the new scripting capabilities of the iWork apps are fairly impressive and it sounds like there’s still room for improvement.

Permalink