AppleScript - TerminalHere.app

2017-05-31  本文已影响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

上一篇 下一篇

猜你喜欢

热点阅读