Created
June 13, 2017 19:35
-
-
Save totomz/b00855bf66d3f85b04b54b5a35c17012 to your computer and use it in GitHub Desktop.
AppleScript to launch new windows instead of moving focus
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
| # iTerm | |
| ``` | |
| tell application "iTerm" | |
| set newWindow to (create window with default profile) | |
| tell newWindow | |
| activate | |
| end tell | |
| end tell | |
| ``` | |
| # Chrome | |
| ``` | |
| set myapp to "Google Chrome" | |
| on appIsRunning(appName) | |
| tell application "System Events" to (name of processes) contains appName | |
| end appIsRunning | |
| if appIsRunning(myapp) then | |
| tell application "Google Chrome" | |
| make new window | |
| activate | |
| end tell | |
| else | |
| tell application myapp | |
| activate | |
| end tell | |
| end if | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment