checkpoint1993

Q: Bluetooth auto file transfer applescript

Hi there. I encountered a problem when I trying to run this applescript.

The purpose of this applescript is when you single click on any file, and run this script, it will automatically transfer this file to a device on the bluetooth named "david". But I encourtered a problem in the line of underdashed. The result shows:

 

"error "System Events got an error: Can’t get scroll area \"Bluetooth Devices\" of window 1 of process \"Bluetooth File Exchange\"." number -1728 from scroll area "Bluetooth Devices" of window 1 of process "Bluetooth File Exchange""

 

and I don't know why. I am completely a noob to applescript, this is some script wrote by someone else, and I just changed and add a little bit to it.

Can anyone help please?

 

 

property device : "david"

tell application "Finder" to set fileAlias to selection as alias

set fileToSend to fileAlias

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

  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

MacBook Air, OS X El Capitan (10.11.4)

Posted on May 12, 2016 7:56 AM