检测别名

时间:2015-04-10 16:46:26

标签: applescript

Applescript可以检测所选项是否是别名(如在Finder别名中是文件夹/文件的快捷方式)?

set toProcess to choose folder with prompt "Select folders:" with multiple selections allowed
tell application "System Events"
    if first item in toProcess is (* alias *) then ...
end tell

1 个答案:

答案 0 :(得分:1)

  tell application "Finder"

    set toProcess to choose folder with prompt "Select folders:" with multiple selections allowed
    set theClass to kind of (first item in toProcess)


    if theClass is "Alias" then
        display notification with title "Alias file"
    else

        display notification with title (theClass as string)
    end if

end tell

choose folder需要在finder tell块中,以便在finders上下文中返回结果