Posts Tagged MacBook

Toggle Bluetooth with Applescript

I've just written a little Applescript to toggle the Bluetooth power on my MacBook on or off. It doesn't take any parameters or anything, it literally just toggles it off if it's already on, or on if it's already off. The script looks like this:

#! /usr/bin/osascript
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# *  Author:	Haydn Williams
# *  URL:	http://www.haydnwilliams.com
# *  Date:	March 2008
# *  Script:	toggleBluetooth.scpt
# *  Purpose:	Toggle bluetooth status
# *  Useage:	toggleBluetooth.scpt
#  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
tell application "System Preferences"
	activate
	set current pane to pane "com.apple.preferences.Bluetooth"
	try
		tell application "System Events"
			tell process "System Preferences"
				click checkbox "On" of window "Bluetooth"
			end tell
		end tell
	on error
		display dialog "Failed to toggle bluetooth."
	end try
	tell application "System Preferences" to close the first window
end tell


You can download the compiled script from here. Please note that you'll need to 'Enable GUI Scripting' in the AppleScript Utility (you can find it in the AppleScript folder of Applications). To run the script, just double-click on it. Please note that this will probably only work on English language systems, but should be easy enough to alter.

Tags: , , , ,

K750i bluetooth MacBook modem

I've had great success in the past using my Sony Ericsson K750i as a bluetooth GPRS modem for my MacBook. Reinstalling Leopard meant setting that up again, and there were a few little tweaks from Tiger. In addition, I had enough trouble finding enough information to set it up originally, so hopefully this will help someone else in future. I guess these instructions are applicable to most phones, because nothing really needs doing on the phone, it's all on the MacBook.

  1. Firstly, download modem scripts for your phone from Ross Barkman's incredibly useful web page. Please, for the love of god, read the whole web page and the readme that comes with the scripts too.
  2. Copy the modem scripts to /Library/Modem Scripts.
  3. Open System Preferences, and then the Network panel.
  4. Create a new location if you want- I have one called 'Mobile' (cunning, eh?)
  5. Click the Bluetooth tab on the left-hand side.
  6. In the Telephone field, type the APN for your telephone service provider (UK settings available on Ross' website here).
  7. In the User and Password fields, type the appropriate information as per the page above.
  8. Click the Advanced< button, and select the PPP tab. Change the Settings dropdown to Configuration and ensure that 'Send PPP echo packets' isn't checked.
  9. Select the Modem tab.
  10. Choose Other in the Vendor dropdown, and your phone should then be listed in the Model dropdown – choose it! Make sure that 'Enable error correction and compression in modem' is ticked.
  11. Select the DNS tab, and add the DNS servers for your network provider, again as per Ross' page.
  12. Click OK, and then Apply once you're back at the 'Network' window.
  13. Click Connect and bask in the glory of a reasonable internet connection anywhere you have 'phone signal.

That's it! Note that the 'Internet Connect' application in Tiger has disappeared with Leopard, so you'll need to go into the System Preferences to connect, or have the modem status displayed in the status bar.

Tags: , , , , , , ,