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
网友评论