Created
April 27, 2018 10:11
-
-
Save konn/30d23aced4ee36354850582d1769813d to your computer and use it in GitHub Desktop.
Toggles Tap-to-Click with AppleScript (UI Scripting)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
osascript $HOME/usr/share/toggle-tap-to-click.scpt false | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
osascript $HOME/usr/share/toggle-tap-to-click.scpt true | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on setTapToClickAndDragging(p) | |
set ran to running of application "System Preferences" | |
tell application "System Preferences" | |
set origPane to the current pane | |
set the current pane to pane id "com.apple.preference.trackpad" | |
activate | |
end tell | |
tell application "System Events" | |
tell process "System Preferences" | |
delay 0.5 | |
tell the tab group of the first window | |
click the first radio button | |
tell the last checkbox | |
set en to the value as boolean | |
if p is not en then | |
click | |
end if | |
end tell | |
end tell | |
end tell | |
end tell | |
tell application "System Preferences" | |
set the current pane to pane id "com.apple.preference.universalaccess" | |
activate | |
end tell | |
tell application "System Events" | |
tell process "System Preferences" | |
delay 0.5 | |
set theCount to (the count of scroll areas of window 1) as integer | |
repeat with theArea in scroll areas of window 1 | |
tell theArea | |
try | |
tell the table 1 | |
select (row 17) | |
end tell | |
end try | |
end tell | |
end repeat | |
delay 0.5 | |
tell window 1 | |
click the button "トラックパッドオプション…" | |
tell sheet 1 | |
tell the checkbox "ドラッグを有効にする" | |
set e to the value as boolean | |
if e is not p then | |
click | |
end if | |
end tell | |
click the button "OK" | |
end tell | |
end tell | |
end tell | |
end tell | |
tell application "System Preferences" | |
if ran then | |
set the current pane to origPane | |
else | |
quit | |
end if | |
end tell | |
end setTapToClickAndDragging | |
on run {tapToClick} | |
setTapToClickAndDragging(tapToClick as boolean) | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment