Last active
September 2, 2020 03:43
-
-
Save shoyuf/8b2821a48cfe7183680eeed6b5331516 to your computer and use it in GitHub Desktop.
open iTerm 2 and exec script on Alfred
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
| on alfred_script(q) | |
| tell application "System Events" to set isRunning to exists (processes where name is "iTerm2") | |
| if isRunning then | |
| tell application "iTerm2" to set hasWindow to exists (windows) | |
| if hasWindow then | |
| tell application "iTerm2" | |
| tell current window to create tab with default profile | |
| tell current session of current window to write text q | |
| end tell | |
| else | |
| tell application "iTerm2" to create window with default profile | |
| tell application "iTerm2" | |
| tell current session of current window to write text q | |
| end tell | |
| end if | |
| else | |
| launch application "iTerm" | |
| end if | |
| end alfred_script |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
official version in https://gist.githubusercontent.com/gnachman/4cbe6743baa7fe07536b/raw/61fceba4a0b2624850ac1b4a20ac8ca48e07f7d2/gistfile1.txt