Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Code cookies

macrumors member
Original poster
Hi here is an apple script that i created that turns on wifi when there is no ethernet connection and turns it off when there is.
Just thought I would put it out there for anyone who may find it useful.
PHP:
property wifi : 0
repeat
	try
		do shell script "ipconfig getifaddr en0"
		if wifi = 1 then
			do shell script "networksetup -setairportpower en1 off"
			set wifi to 0
		end if
	on error
		if wifi = 0 then
			do shell script "networksetup -setairportpower en1 on"
			set wifi to 1
		end if
	end try
	delay 3
end repeat

Hope its useful. This is all self taught so if there is anything that is bad practice please let me know 🙂
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.