Skip to content

Instantly share code, notes, and snippets.

@moyashi
Created May 20, 2011 03:11
Show Gist options
  • Save moyashi/982277 to your computer and use it in GitHub Desktop.
Save moyashi/982277 to your computer and use it in GitHub Desktop.
カーソル行のテキストをshで実行して、結果をカーソル位置に挿入 for TypeIt4Me ( http://bit.ly/iorZdU )
-- このスクリプトを「;sh」とかに割り当てて、行末で実行すると、「;sh」の直前までをクリップボードに送って
-- っていうかCommand + Xを押して、クリップボードに送られたテキストをshで実行する
-- 「;sh」の前にはスペースを開ける必要あり
-- ps ax ;sh
-- ps ax
-- ブワーっとプロセスリスト
-- といった感じ
-- 「;sh」は、打った時点でスクリプトの実行キーとして消化されて消える
-- TypeIt4Meマジ便利 ( http://bit.ly/iorZdU )
tell application "System Events"
tell process first process whose frontmost is true
keystroke "a" using (control down)
delay 0.1
keystroke (ASCII character 29) using (control down, shift down)
delay 0.1
key down command
delay 0.1
keystroke "x"
delay 0.1
key up command
delay 0.1
end tell
end tell
return do shell script "echo " & (quoted form of (the clipboard)) & " | sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment