Jump to content
Twice Bitten

[SOLVED] Enter text into Current Terminal Window?

Recommended Posts

  I see that using the ! command in Alfred will open a new Terminal Session.  Is there a way to have Alfred pass the text into the current Terminal session window?

Thanks.

Share this post


Link to post
41 minutes ago, Twice Bitten said:

Is there a way to have Alfred pass the text into the current Terminal session window?

 

If the Terminal in question supports doing so via AppleScript, yes by setting the custom terminal integration. To get the exact code, you may wait for someone on the forum or try Ask Different.

Share this post


Link to post

@Twice Bitten, since you are not mentioning which Terminal application you are using, I guess you use Terminal.app. So, to "pass the text into the current Temrinal session window" and keeping your default Terminal integration as it is in Alfred (so you can keep your other action to open a new Terminal Session if you want), you can create a workflow that pass your text to a Run Script object with the script language set to /usr/bin/osascript (AS) and with the script set to:

 

on run argv
  tell application "Terminal"
    activate -- comment this line if you don't want to send the Terminal window to front
    do script (item 1 of argv) in tab 1 of window 1
  end tell
end run

or if you want to change Alfred's Terminal integration as mentioned by @vitor and use , you can set Alfred to use a Custom terminal application and set the script to :

 

on alfred_script(q)
  tell application "Terminal"
    activate -- comment this line if you don't want to send the Terminal window to front
    do script q in tab 1 of window 1
  end tell
end alfred_script

 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...