Guest User

Untitled

a guest
Mar 15th, 2019
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. function Accepts ()
  2. {
  3. osascript <<EOF
  4. tell application "System Events"
  5. repeat while exists (processes where name is "SecurityAgent")
  6. tell process "SecurityAgent" to click button "Allow" of window 1
  7. delay 0.2
  8. end repeat
  9. end tell
  10. EOF
  11. }
  12.  
  13. function AcceptWithCreds ()
  14. {
  15. username="$1"
  16. password="$2"
  17.  
  18. [ -z "${password}" ] && return 1
  19.  
  20. osascript 2>/dev/null <<EOF
  21. set appName to "${username}"
  22. set appPass to "${password}"
  23.  
  24. tell application "System Events"
  25. repeat while exists (processes where name is "SecurityAgent")
  26. tell process "SecurityAgent"
  27. if exists (text field 1 of window 1) then
  28. set value of text field 1 of window 1 to appName
  29. set value of text field 2 of window 1 to appPass
  30. end if
  31. end tell
  32. tell process "SecurityAgent" to click button "Allow" of window 1
  33. delay 0.2
  34. end repeat
  35. end tell
  36. EOF
  37. echo 'Finished...'
  38. }
Add Comment
Please, Sign In to add comment