I have this script to send music files from iTunes to a mobile phone over bluetooth, but it only works for 1 file. Can anyone advise on how to fix it, so that it works for a selected list? Thanks.
-- found initial script on
-- needed to activate System Preferences -> Universal Access
-- Enable Access for assistive devices
-- didn't work the first time, but works after that.
-- name of mobile phone
property device : "Nokia N81"
tell application "iTunes"
if selection is not {} then
set sel to selection
repeat with aTrack in sel
set fileToSend to aTrack's location
tell application "Finder" to open fileToSend using application file id "com.apple.BluetoothFileExchange"
activate application "Bluetooth File Exchange"
tell application "System Events"
tell process "Bluetooth File Exchange"
repeat until exists window 1
delay 0.5
end repeat
select (1st row of table of scroll area "Bluetooth Devices" of window 1 whose value of text field 1 is device)
click button "Send" of window 1
end tell
end tell
end repeat
else
display dialog "No track selected"
end if
end tell