Can anyone help me with these two Applescripts (Very Simple One! lol)
I want to be able to make a applescript which will determine what OS is running on the machine and choose which Applescript to run.
I want machine running Leopard to run the Leopard Airport Card script and the same in Snow but with the SL airport card script. I don't know how to do so hopefully someone will be able to help?
These are the two AS's:
Leopard Turn OFF Airport Card
SL Turn Off Airport Card
Hope this makes sense.
Many Thanks,
Matt
I want to be able to make a applescript which will determine what OS is running on the machine and choose which Applescript to run.
I want machine running Leopard to run the Leopard Airport Card script and the same in Snow but with the SL airport card script. I don't know how to do so hopefully someone will be able to help?
These are the two AS's:
Leopard Turn OFF Airport Card
Code:
do shell script "/usr/sbin/networksetup -setairportpower off"
Code:
--list all of the network hardware ports
set the_ports to (do shell script "/usr/sbin/networksetup -listallhardwareports")
set old_delims to AppleScript's text item delimiters
try
set AppleScript's text item delimiters to return
set the_count to the count of text items in the_ports
on error
set AppleScript's text item delimiters to old_delims
end try
--get the port number of the AirPort device
repeat with x from 1 to the_count
if text item x of the_ports contains "AirPort" then
set device_line to (text item (x + 1) of the_ports)
end if
end repeat
set AppleScript's text item delimiters to ":"
try
set the_port to (text item 2 of device_line)
set AppleScript's text item delimiters to old_delims
on error
set AppleScript's text item delimiters to old_delims
end try
--do shell script "/usr/sbin/networksetup -setairportpower" & the_port & " off" with administrator privileges
Many Thanks,
Matt
Last edited by a moderator: