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
end if

-- Do the sync and wait for it to finish
tell application "iSync"
	if not (synchronize) then
		display dialog "Failed to start sync"
		repeat while (syncing is true)
			delay 5
		end repeat
		set syncStatus to sync status
		if syncStatus = 2 then
			-- Success
			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
	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:]

[ Reply to This | # ]