Last active
May 10, 2023 00:34
-
-
Save willwade/b38de2f1e1b22c510c4deba981fbaf16 to your computer and use it in GitHub Desktop.
Auto Accept AppleScript service. Run on login startup and set to hide. Hopefully an improvement on https://photosautomation.com/auto-accept-airdrop-applet.html - Use alongside with this https://jimmyselix.blogspot.co.uk/2015/02/apple-os-x-yosemite-and-changing.html?m=1(or http://www.idownloadblog.com/2017/03/03/change-airdrop-destination-folder-…
This file contains hidden or 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
property delayInterval : 15 -- seconds | |
on run | |
activate | |
tell application "System Events" to set UIAccessStatus to UI elements enabled | |
end run | |
on idle | |
try | |
tell application "System Events" | |
tell process "NotificationCenter" | |
set theseAlerts to (every window whose subrole is "AXNotificationCenterAlert") | |
repeat with i from 1 to the count of theseAlerts | |
set thisWindow to item i of theseAlerts | |
set theseTextStrings to the value of static text of thisWindow | |
-- added second check for notification changes in El Capitan | |
if theseTextStrings contains "AirDrop" then | |
if exists button "Accept" of thisWindow then | |
click button "Accept" of thisWindow | |
else if exists menu button "Save to Downloads" of thisWindow then | |
click menu button "Save to Downloads" of thisWindow | |
else if exists menu button "Accept" of thisWindow then | |
click menu button "Accept" of thisWindow | |
end if | |
end if | |
end repeat | |
end tell | |
end tell | |
return delayInterval -- run the idle handler again after the indicated time delay | |
on error errorMessage number errorNumber | |
activate | |
display alert (errorNumber as string) message errorMessage | |
tell me to quit | |
end try | |
end idle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment