Skip to content

Using an AppleScript app to automatically click "More Info"

Ross Matsuda edited this page Dec 2, 2021 · 6 revisions

With some additional components, it is possible to have users click on the "Update Device" button in Nudge and be taken directly to the "More Info" list of available minor updates to apply.

WHY

Many users in our environment complain of confusion when running Nudge, because of Apple's placement of macOS upgrade banners. Instructing users to look for a smaller "More Info" button, of which there can be two thanks to the upgrade banner, is cumbersome. We've included screenshots to help guide users, but it would be much more convenient to bypass the first page altogether and have the Nudge button take users as far as possible to minimize mistakes and support desk tickets.

LIMITATIONS

At the moment, this workflow only works in Nudge Swift, as I have not yet been able to find a way to get Nudge Python to invoke the launcher app. The AppleScript logic itself is tested in 10.15.7, so this may eventually be supported.

COMPONENTS

In order to make this function, a few items need to be in place:

  1. Signed AppleScript app You'll embed some AppleScript commands into an application bundle and sign it with your developer ID so that it will not get caught/barred by Gatekeeper upon execution
  2. PPPC for app The app you've built requires a few permissions to be set in order to function
  3. "actionButtonPath" key in configuration You'll need to define a path using the file URI that points at your app. Please note that because we're using this key, this does limit Nudge's functionality to only minor updates by default, and users will have to cancel out of the "More Info" window to view the macOS upgrade banner if they want to click on it

WALKTHROUGH

  1. Create your AppleScript

In Script Editor on your device, paste the following code:

https://github.com/xirianlight/openToMoreInfo/blob/main/Loading%20Available%20Updates.scpt

Select File → Export

Set File Format to "Application"

For code signing, you have two options:

  • Set Code Sign to your Developer ID if you're comfortable with the app being visible in the Dock while running (this is helpful for testing and validation)

  • Set Code Sign to "Don't Code Sign" when you've finished testing - you'll be editing the .app bundle and signing it manually to hide the Dock icon while it is running.

1a. Hide the app from the Dock

Locate your created app and open dig through the package to Contents/Info.plist

Add the following key and save:

<key>LSUIElement</key>

`<true/>`

In Terminal, run the following command, targeting your app bundle and replacing the text in quotes with the full name of your developer ID:

codesign --force --sign "Apple Development: John Doe (1234567890)" -v /path/to/bundle.app

Your app should now be signed and ready for MDM distribution. If you receive an error about 'resource fork, Finder information, or similar detritus not allowed', run the following command to strip extended attributes from your bundle, then try signing again:

xattr -cr /path/to/bundle.app

Clone this wiki locally