Applescript:如何获取当前查找器窗口的完整路径?

时间:2016-10-08 12:45:21

标签: applescript

我有这个脚本它运行正常但是当我在网络上打开一个查找器窗口时,它不会给我完整的链接,我应该从'卷开始,如何制作它发现它?

谢谢

    tell application "Finder"
            if exists window 1 then
                set currentDir to POSIX path of ((target of front Finder window) as text)
            else
                set currentDir to POSIX path of (path to desktop folder)
            end if
    end tell
        log currentDir

1 个答案:

答案 0 :(得分:5)

tell application "Finder"
    if exists Finder window 1 then
        set currentDir to target of Finder window 1 as alias
    else
        set currentDir to desktop as alias
    end if
end tell
log POSIX path of currentDir