How to retreive signal strength on AirPort network?

I am trying to create a simple script with AppleScript to return the signal strength of an Airport network.

The Dictionary for Internet Connect indicates is as follows:


Class AirPort configuration: An AirPort configuration
Plural form:
	AirPort configurations
Properties:
	<Inheritance>  configuration  -- see the class “configuration” for more properties
	AirPort power  boolean  -- Is the AirPort hardware powered on?
	base station ID  plain text  [r/o]  -- the AirPort base station ID
	network name  plain text  -- the AirPort network name
	network type  plain text  [r/o]  -- the AirPort network type
	signal level  integer  [r/o]  -- the AirPort signal level, a value from 0% to 100%

so it appears there is a way to return the signal level but I have so far been unsuccessful with it.

I have tried:


tell app "Internet Connect"
set sigLev to signal level of Airport configuration "airportnetworkname"
end tell

as well as some variations of the above script. The script will compile, but returns errors.
I know this is probably scripting 101 for you experts, thanks in advance for any help.

Chris Zacharer

This works for me:

Jon


[This script was automatically tagged for color coded syntax by Script to Markup Code]

Thank you Jon! Works like a charm.

Now the $64,000 question (not important, just for intellectual curiosity): Why airport configuration 1?
Is the “1” the default airport network…does the number change, for instance, if there are more than one wi-fi networks available?

Again thank you very much.

Chris Zacharer.

You’re welcome. The “1” refers to the first of a list of AirPort configurations. You can use this code to get the list:

There is only one configuration on my machine and I’m not certain if there could be more besides the active configuration (but I assume there must be). To work around this, try:

Jon


[This script was automatically tagged for color coded syntax by Script to Markup Code]

Thanks again!

By the way, great website, I clicked through on your signature, (Script to Markup Code)

What I am ultimately trying to accomplish is a little menu item to display the airport signal strength in the menu bar as a number, rather than bars. Reason being is that my TiPBG4 seems to get sketchy airport performance on 3 bars, which probably corresponds to 50% to 75% (without regard to signal noise). Having an actual number in the menu would be more useful to me than just the airport menu bars.

Your Script Studio project MenuApp looks like it might assist me in that endeavor. I will let you know how it goes when I “finish.”

Again thanks.

If you’re interested, I quickly wrote a basic version of the app. You can take a look at it here: APMenu.hqx

It could easily be modified to alert you when a signal hits a certain level and to add a preference for how often it checks the signal strength.

Jon

is there any way of achieving this without the need for internet connect to open when ever the script is run