Reputation: 653
I am trying to write an applescript on OSX 7 that simply opens the "Edit Serial Ports" option in the Bluetooth Preferences Menu (I only have one paired device). I was able to get all the way to the bluetooth preferences pane, but I am stuck on how to tell applescript to select the appropriate option from the drop down menu. Would anyone be able to help me with this?
The applescript so far:
tell application "System Preferences"
activate
end tell
tell application "System Preferences"
activate
set current pane to pane "com.apple.preferences.Bluetooth"
end tell
Thank you so much for sharing your knowledge and expertise!
Upvotes: 1
Views: 880
Reputation: 653
I was able to answer my own question, and learned a lot about applescript and xcode in the process. The correct script is as follows:
tell application "System Preferences"
set current pane to pane id "com.apple.preferences.bluetooth"
tell application "System Events"
tell process "System Preferences"
click menu button "Perform tasks with the selected device" of splitter group 1 of group 1 of window "Bluetooth"
delay 1 -- give menu time to pop up
click menu item "Edit Serial Ports…" of menu 1 of menu button "Perform tasks with the selected device" of splitter group 1 of group 1 of window "Bluetooth"
delay 5
end tell
end tell
quit
end tell
Upvotes: 1