Learning AppleScript? Get UI Browser. It writes it for you!

Hey MPU Family!

I posted this on Automators Discourse as well (prompted by the latest episode over there with Sal Saghoian and scripting) and thought you all might appreciate this as well.

For AppleScript, there is really no better app than Script Debugger app for creating and editing AppleScript.

I just wanted to pipe in some serious love for an app called UI Browser that is a magnificent tool to go along with Script Debugger. UI Browser saves you HOURS of time by allowing you to start with clicking a button or check box in an app, then seeing the app hierarchy of where that element falls so you can script it…

It’s hard to explain how incredibly useful this is.

Let’s say that you want to see if a particular box is checked (or check it) in Handbrake. How on earth do you know what element is or how to script it? Easy. Open UI Browser, go click on it, copy code into Script Debugger or Keyboard Maestro or whatever. Done

Did you hear that? UI BROWSER WRITES THE APPLESCRIPT FOR YOU!

Here is a video that shows this in action.

So awesome for beginning scripters to get going!

A couple things to know about UI Browser as a heads up:

It’s $55. Not cheap, but SO worth it if you really want to get serious.
The website is horrible. Like 1994 horrible. Just let that go.
The app itself isn’t that pretty. Get over that to. It literally generates magic for you.

Just a helpful heads up to those wanting to get going into scripting but aren’t that excited about the “having to learn a new programming language” part. Script Debugger and UI Browser are the essential tools.

Check it out!

8 Likes

thanks for the recommendations! I do find it ironic that a company that makes a product named UI Browser has a terrible UI on their site. :slight_smile:

Ha ha! So true!

In their defense their job is to get you through the UI, not design it! That’s funny, though @Volsee96

1 Like

Any good tutorials for AppleScript? Also, are there any useful scripts that are already written? @MacSparky, will you ever create a field guide for AppleScript?

  1. MacScripter is a venerable site. Though many of the listed resources are old, the dialog is frequently very helpful.
  2. MacOS-X Automation is Sal Soghoian’s site and has lots of treasures – samples, advice, etc. Covers more than AppleScript, because Mac automation is far more than just AppleScript. Sal is the godfather of Mac automation and formerly headed that area for Apple for many years.
  3. Rosemary’s own Automation Orchard is a rich source of useful automations.

The best way to learn AppleScript is to write AppleScript!

1 Like

I agree with @anon41602260’s recommendations.

I’d also recommend trying to find a problem you can solve with AppleScript. I find that the best way to learn.

1 Like

Agreed @MacSparky. My brain just works so much better with seeing something that works and then working backwards to customize it. That was why UI Browser was such a game-changer for me. It allows you to start at 60% finished and work from there. Always good to learn the fundamentals and then have a place to apply them.

It depends on how you learn, of course, but given what I know now and how I know I learn, if I were to counsel a previous version of myself who knew nothing about AppleScript, I would say first read AppleScript 1-2-3 by Sal Saghoian and Bill Cheeseman. Read it cover to cover, next to a computer, and type every letter of code in the book as they’re teaching it to you. Then, when you finish that, read Learn AppleScript by Hamish Sanderson and Hanaan Rosenthal and do the same thing with that.

And of course, just keep writing scripts for yourself whenever you can, keeping your mind open to problems you might need to solve.

Then, eventually, read Matt Neuburg’s AppleScript: The Definitive Guide. But save that until you’ve been noodling around with the language for a while.

MacScripter can be a great resource, but the discussions can also be overwhelming for a beginner (or even an intermediate, or whatever I am). But much of your code will probably be adapted versions of things you find in discussion forums, especially early on.

Script Debugger is a must, even the free version. But if you’re serious about AppleScript, you’ll buy it.

I’ve never used UI Browser, but I keep meaning to!

1 Like

Thank you. I’m listening to one of one of the lectures on MacOS-X Automation as we speak.

I do have a problem in mind. It’s a frivolous, first world problem but it is a problem nonetheless. Let me set the stage for you:

I have a Chrome Extension that allows you to upload instagram pics right from your Mac. The Problem is Instagram doesn’t accept PNG images but it does take JPG. So, whenever I take a screenshot it’s a PNG file and I have to open it in Photoshop to save another version as a JPG. I don’t want to change the utility setting for screen grabs to be JPG because I consider PNG files to be more useful.

What I want to do is have the CMD + Shift + 4 key combination save a PNG like normal as well as have a JPG of the same file created in another folder. I realize that may not be possible so I’m hoping an automation/script. can be created that says:

  1. Every time there is a new PNG on the desktop
  2. Create a JPG in “____” folder

I may be missing some steps in between. Don’t judge me too harshly, I’m a beginner at this.

That’s a very interesting and useful problem, and MacOSAutomation has some tips for the scripting part of it:

https://www.macosxautomation.com/applescript/imageevents/08.html

There is also a “change type of images” workflow action available in Automator.

So, additional option, either of the above could be combined with Hazel watching the folder and applying the script or applying the Automator workflow.

This thread is excellent. I’ve dabbled with AppleScript to automatically create tasks (to pay bills) in OmniFocus using Hazel automations. However, I never really got my head around it. Now, how much spare time do I have to learn again…? :smiley: Definitely worth it, though.

I wish there was a good AppleScript language reference. The one at Apple is terrible :frowning_face:

Same here. And for Lua.