Automator Horked

bowjest

Registered
I've decided to try automating a few things on my MBP and started playing around with Automator last night.

My first "application" was a simple recording of my clicking on the wireless icon in the toolbar across the top of the screen and selecting "Turn AirPort on".

This recorded fine and when I ran it in Automator, it worked fine (although for some strange reason once the cursor had clicked on the wireless icon and moved down to "Turn AirPort on" is moved back and forth a few times before actually clicking on the option and starting AirPort.

I then exported this as an application, but although it did the exact same steps as it did in the workflow, it didn't actually turn on AirPort.

I go back to the workflow and run it and it works every time.

What gives?

I decided to try a similar but different experiment in that I started a new recording, clicked on the Apple icon, moved down to "About this Mac", and then selected "More Info" to start the System Profiler, but whether I run this in the workflow or export it as an app, it just clicks on the Apple icon, then jumps immediately to the right without moving down to my choosen selection, moves back and forth a few times, then throws up an error stating "The action Watch Me Do encountered an error. Check the action's properties and try running it again".

It does this, by the way, with the first app.

I can't figure out where I've gone wrong. Is this a common problem?

Thanks
 
For these two tasks, you'd be better off using simple applescripts. Here's one for toggling AirPort. For System Profiler, the basic applescript command is:
Code:
tell application "System Profiler" to activate
Watch Me Do is a modern recreation of UI Scripting and I think it's designed for interfaces that can't be scripted otherwise. Use it for clicking buttons in windows, not for selecting menu items.
 
Thanks, Earthsaver, I found something similar just a few minutes after I sent my original post. I hope you can help me with it.

I've set up a location called AirPort-Off and removed AirPort from the list of things it can control (thus effectively turning AirPort off).

Via /usr/sbin/scselect I can then turn off AirPort by calling this location or turn it back on by selecting the default of Automatic:

do shell script "/usr/sbin/scselect AirPort-Off"
do shell script "/usr/sbin/scselect Automatic"

So far so good.

What I ideally need, however, is a script that can see which option is currently selected (either on or off) and then select the other option.

If I call scselect from a terminal window, it tells me the following:

bash-3.2$ /usr/sbin/scselect AirPort-Off
CurrentSet updated to 46B9D672-CB06-4573-93E9-8FCBD4E7F748 (AirPort-Off)
bash-3.2$ scselect
Defined sets include: (* == current set)
* 46B9D672-CB06-4573-93E9-8FCBD4E7F748 (AirPort-Off)
4727E0F0-7C42-42F7-B92A-19D7C6CFCE64 (Automatic)

Can you advise how I would word/script that? I don't have a background in doing this sort of thing, so I apologize in advice for the need for spoonfeeding.

Thanks
 
The other script to which I linked can tell you current status. Read the documentation and maybe it has a way to do what you desire. Otherwise, check in with the MacPorts community/developer.
 
Back
Top