This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 脚本介绍 | |
-- 功能:获取所选文件、文件夹的目录路径,支持多选 | |
-- 如果仅仅想获取文件的目录路径,可以调用 isDirectory() 过滤掉文件夹的路径 | |
tell application "Finder" to set selectedItems to selection as alias list | |
-- 没选择的话直接退出脚本 | |
if selectedItems is {} then return | |
-- 获得所选文件/文件夹的父目录。 | |
set parentPath to do shell script "dirname " & quoted form of POSIX path of (item 1 of selectedItems) | |
-- 用于拼接多个路径 |