Last active
January 21, 2016 17:10
-
-
Save kaplas/c2bfc2cc84a4b4bf02e1 to your computer and use it in GitHub Desktop.
A collection of useful AppleScripts
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
# Open a new Chrome ignognito tab for Gmail | |
if application "Google Chrome" is running then | |
tell application "Google Chrome" | |
set theURL to URL of active tab of window 1 | |
set incogWin to make new window with properties {mode:"incognito"} | |
set incogTab to active tab of window 1 | |
tell incogTab | |
set URL to "https://gmail.com" | |
end tell | |
end tell | |
else | |
do shell script "open -a /Applications/Google\\ Chrome.app --args --incognito https://gmail.com" | |
end if | |
tell application "Google Chrome" to activate |
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
# Play a random album on Spotify | |
tell application "System Events" to set runningApps to every application process's name | |
if runningApps does not contain "Spotify" then | |
# Open Spotify on the background | |
do shell script "open -ga /Applications/Spotify.app" | |
# Hide the newly opened Spotify window | |
tell application "Finder" | |
set visible of process "Spotify" to false | |
end tell | |
end if | |
set spotifyUri to do shell script "curl http://www.spotifynewmusic.com/randomalbumgenerator.php\\?site\\=All\\&score\\=0\\&genrefilter\\=All\\&weeks\\=52 | grep -oh 'spotify:album:\\w*'" | |
tell application "Spotify" to play track spotifyUri |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment