AppleScript - TerminalHere.app

TerminalHere.app


tellapplication"Finder"

setseltoselection

if(countsel) > 0then

setmyTargettoitem1ofsel

elseif(countwindow) > 0then

setmyTargettotargetofwindow1

else

setmyTargettopath todesktop folder

endif

myopenTerminal(myTarget)

endtell

onopenTerminal(location)

setlocationtolocationasalias

setthe_pathtoPOSIX pathoflocation

repeatuntilthe_pathends with"/"

setthe_pathtotext1thru-2ofthe_path

endrepeat

setcmdto"cd " "ed formofthe_path& " && echo $'\\ec'"

tellapplication"System Events"tosetterminalIsRunningtoexistsapplication process"Terminal"

tellapplication"Terminal"

activate

ifterminalIsRunningistruethen

do scriptwith commandcmd

else

do scriptwith commandcmdinwindow1

endif

endtell

endopenTerminal

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • ¥开启¥ 【iAPP实现进入界面执行逐一显】 〖2017-08-25 15:22:14〗 《//首先开一个线程,因...
    小菜c阅读 7,506评论 0 17
  • 本例为设置密码窗口 (1) If Application.InputBox(“请输入密码:”) = 1234 Th...
    浮浮尘尘阅读 14,931评论 1 20
  • 不支持上传文件,所以就复制过来了。作者信息什么的都没删。对前端基本属于一窍不通,所以没有任何修改,反正用着没问题就...
    全栈在路上阅读 2,084评论 0 2
  • 穿越998条河流 和一条汹涌的大江 只为找着你 我扺达的那个日子 本以为老天会感动流泪 可天上只有高悬的太阳 你静...
    且向洞庭赊月色阅读 482评论 0 8
  • 一个女人在什么样的情况下会出轨,经不起诱惑,或者说是报复,或者说是只是孤单。作为一个他人婚姻的陪衬者,就像海藻如此...
    李苏珊阅读 372评论 0 0

友情链接更多精彩内容