Skip to content

Instantly share code, notes, and snippets.

@MichaelDimmitt
Last active April 16, 2018 00:55
Show Gist options
  • Save MichaelDimmitt/7ecd6b58829fee5945b3c945aaffa9f9 to your computer and use it in GitHub Desktop.
Save MichaelDimmitt/7ecd6b58829fee5945b3c945aaffa9f9 to your computer and use it in GitHub Desktop.
aargh! I am not a fan of SystemPreferences -> Security & Privacy -> Accessability -> Assistive Access

Well, this was todays work.

Unable to get it working without assistive access.

works with assistive scripteditor, not works with assistive terminal

Not a good practice to enable it on peoples computers who user your program.

tell application "Finder"
set desktopSize to bounds of window 1
set widthval to ((item 3 of desktopSize) - (item 1 of desktopSize) - 33)
set heightval to ((item 4 of desktopSize) - (item 2 of desktopSize) - 33)
end tell
tell application "System Events" to tell (the first process whose unix id is 6728)
tell window 1
set position to {0, 0}
end tell
tell window 2
set position to {0, heightval}
end tell
tell window 3
set position to {widthval, 0}
end tell
tell window 4
set position to {widthval, heightval}
end tell
end tell
/System/Library/Frameworks/ScreenSaver.framework/Resources/./ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -window -numWindows 4 -background &
vary=$(ps -A | grep /System/Library/Frameworks/ScreenSaver.framework/Res |rev | cut -c 144- | rev | cut -c 2-);
echo $vary; osascript -e "
tell application \"System Events\" to tell (the first process whose unix id is $vary)
tell window 0
set position to {0, 0}
end tell
end tell
"
/System/Library/Frameworks/ScreenSaver.framework/Resources/./ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -window -numWindows 4 -background &
vary=$(ps -A | grep /System/Library/Frameworks/ScreenSaver.framework/Res |rev | cut -c 144- | rev | cut -c 2-);
echo $vary; osascript -e "
tell application \"System Events\" to tell (the first process whose unix id is $vary)
tell window 1
set position to {0, 0}
end tell
tell window 2
set position to {0, heightval}
end tell
tell window 3
set position to {widthval, 0}
end tell
tell window 4
set position to {widthval, heightval}
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment