2017-08-14 56 views
0

我正在寻找解决方案以获取用户关闭的文件夹的路径。目的是在参数中调用这条路径的另一个脚本。使用Applescript获取封闭文件夹的路径

我已经尝试过这一点,但它似乎不工作(我的文件夹操作设置是否正确):

on closing folder window for theAttachedFolder 
tell application "Finder" 

    set thePath to POSIX path of theAttachedFolder 
    display dialog thePath 

    end tell 
end on closing folder window for 

回答

0

您需要更改end on closing folder window forend closing folder window for,因为该块字开头on和以词end结尾。在这两种情况下,在它旁边必须写下行动的名称,在这种情况下:closing folder window。 另外,您可以将display dialog移出tell块,因为不需要定位Finder应用程序。 display dialog是Standard Additions的一部分。

代码:

on closing folder window for theAttachedFolder 
    tell application "Finder" 

     set thePath to POSIX path of theAttachedFolder 

    end tell 
    display dialog thePath 
end closing folder window for 
相关问题