xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

macOS show “Open Folder in VS Code” icon and “Open Folder in Terminal” icon in Finder All In One

macOS show “Open in VS Code” icon and “Open in Terminal” icon in Finder All In One

image

Open Folder in VS Code code .

Open Automator.app Pick Application

  1. Run Shell Script
finderPath=`osascript -e 'tell application "Finder" to get the POSIX path of (target of front window as alias)'`
open -n -a "Visual Studio Code" --args "$finderPath"
  1. App Bundle ID
finderPath=`osascript -e 'tell application "Finder" to get the POSIX path of (target of front window as alias)'`
open -n -b "com.microsoft.VSCode" --args "$finderPath"

Open Folder in Terminal

Open Automator.app Pick Application

image

  1. Run AppleScript
on run {input, parameters}

  tell application "Finder"
    set myPath to (POSIX path of (target of front window as alias))
  end tell

  tell application "Terminal"
    do script "cd " & myPath
    activate
  end tell

  return input
end run
  1. Run Shell Script
osascript -e '
tell application "Finder"
  set myPath to (POSIX path of (target of front window as alias))
end tell

tell application "Terminal"
  do script "cd " & myPath
  activate
end tell
'

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

refs

https://flaviocopes.com/how-to-add-an-open-in-terminal-icon-in-macos-finder/

https://flaviocopes.com/how-to-add-an-open-in-vs-code-icon-in-macos-finder/



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2023-01-31 07:29  xgqfrms  阅读(51)  评论(0编辑  收藏  举报