Hi, I only found out about this site today, while I was working on a script I use to transcode DVDs onto my laptop. I was looking to have the script send a message to my mobile phone via bluetooth to alert me when a DVD had finished ripping, but I didn’t manage to find any solutions here or elsewhere. Eventually, after much trial and error with GUI scripting, I managed to put together a script that would send a text file over to my phone using Bluetooth File Transfer, and I thought that some of you here might find it useful:
tell application "Finder"
activate
make new Finder window
set target of Finder window 1 to item "textfile.txt" of folder "Random Folder" of startup disk
tell application "System Events"
tell process "Finder"
tell menu bar 1
tell menu bar item "Finder"
tell menu "Finder"
tell menu item "Services"
tell menu "Services"
click menu item "Send File To Bluetooth Device..."
end tell
end tell
end tell
end tell
end tell
end tell
end tell
delay 5
tell application "System Events"
tell process "Bluetooth File Exchange"
select row 1 of table of scroll area "Bluetooth Devices" of window 1
click button "Send" of window 1
end tell
end tell
activate
select Finder window 1
close Finder window 1
end tell
The one detail that might be worth worrying about is that it chooses the first bluetooth device in the list, rather than choosing a device by name. My phone always seems to be first on the list for me (perhaps the last-used device is listed first?), so it works fine for me, but you might want to have a look at what position the device you’re sending to will be in.