美文网首页
AppleScript - TerminalHere.app

AppleScript - TerminalHere.app

作者: 成江海 | 来源:发表于2017-05-31 22:43 被阅读0次

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

相关文章

网友评论

      本文标题:AppleScript - TerminalHere.app

      本文链接:https://www.haomeiwen.com/subject/hlxsfxtx.html