-
-
Save pythoninthegrass/a8ce40374579f65682d1d1354c676918 to your computer and use it in GitHub Desktop.
Clicking "Allow" button in System Preferences via Screen Sharing
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
# This is clicking "Allow" in System Preferences "Security & Privacy" screen | |
# when you're on Screen Sharing. Otherwise it doesn't work. | |
# To fix: | |
# - Put "Security & Privacy" window in the top left screen | |
# - open a Terminal on a side | |
# - save click.oscript | |
# - Run: osascript click.oscript | |
# | |
# The mouse click you send should hit "Allow" button. You may need to move the window a little bit. | |
# Script originally from: https://discussions.apple.com/thread/3708948 | |
set x to 550 | |
set y to 490 | |
do shell script " | |
/usr/bin/env python <<END | |
import sys, time | |
from Quartz.CoreGraphics import * | |
def mouseEvent(type, posx, posy): | |
theEvent = CGEventCreateMouseEvent(None, type, (posx, posy), kCGMouseButtonLeft) | |
CGEventPost(kCGHIDEventTap, theEvent) | |
def mousemove(posx, posy): | |
mouseEvent(kCGEventMouseMoved, posx, posy) | |
def mouseclick(posx, posy): | |
mouseEvent(kCGEventLeftMouseDown, posx, posy) | |
mouseEvent(kCGEventLeftMouseUp, posx, posy) | |
ourEvent = CGEventCreate(None) | |
# Save current mouse position | |
currentpos=CGEventGetLocation(ourEvent) | |
mouseclick(" & x & "," & y & ") | |
END" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment