My script sets the Natural Scroll Direction of either a Mouse or Trackpad (MB trackpad or Magic Trackpad), but instead of allowing the user to choose which one is attached, I'd like to be able to programmatically execute one of the two functions based on what hardware is attached.
Is there a way to check (ie. AS or Shell Script) what hardware is attached?
For example, this is what I want to accomplish:
If: Trackpad is attached then run Trackpad function.
Else if: Mouse is attached, run Mouse function.
Else if: Mouse and Trackpad are attached, run both
Else: throw error, no input devices detected
I am after a robust function but have no idea where to start.
tell application "System Preferences" reveal anchor "mouseTab" of pane id "com.apple.preference.mouse" end tell tell application "System Events" to tell process "System Preferences" tell checkbox 1 of window 1 to if value is 1 then click end tell quit application "System Preferences"
tell application "System Preferences" activate set current pane to pane "com.apple.preference.trackpad" end tell tell application "System Events" tell application process "System Preferences" to tell tab group 1 of window "Trackpad" click radio button 2 if value of checkbox 1 is 1 then click checkbox 1 end if end tell end tell quit application "System Preferences"
Thank you in advance, any help is greatly appreciated.