Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Multilingual version without using menu extra' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Multilingual version without using menu extra
Authored by: triplef on May 06, '06 04:41:49AM
After some poking around I've written a small command-line utility which uses private APIs in the IOBluetooth framework to switch Bluetooth on and off.
Download the utility and use the following modified script to sync like this article explains:

property blueutilPath : "/usr/local/bin/blueutil"


-- Check the current bluetooth status and turn it on if necessary.
set btWasOn to true
if execBlueutil("status") ends with "off" then
	set btWasOn to false
	execBlueutil("on")
end if

-- Do the sync and wait for it to finish
tell application "iSync"
	if not (synchronize) then
		display dialog "Failed to start sync"
	else
		repeat while (syncing is true)
			delay 5
		end repeat
		set syncStatus to sync status
		
		if syncStatus = 2 then
			-- Success
			quit
		else
			if syncStatus = 3 then
				set syncStatus to "completed with warnings"
			else if syncStatus = 4 then
				set syncStatus to "completed with errors"
			else if syncStatus = 5 then
				set syncStatus to "last sync cancelled"
			else if syncStatus = 6 then
				set syncStatus to "last sync failed to complete"
			else if syncStatus = 7 then
				set syncStatus to "never synced"
			end if
			display dialog "Sync completed: " & syncStatus
		end if
	end if
end tell


-- Set the bluetooth status to what it was before.
if not btWasOn then execBlueutil("off")


on execBlueutil(command)
	set res to do shell script blueutilPath & " " & command
	if res contains "Error" then
		display dialog res
		quit
	end if
	return res
end execBlueutil


[ Reply to This | # ]
Corrected link
Authored by: SeanAhern on Jun 02, '06 02:41:52AM
I think your link is borked. The correct link is [link:]http://www.frederikseiffert.de/blueutil/

[ Reply to This | # ]