Applescript 中查找器路径的正确语法

Applescript 中查找器路径的正确语法

我正在修改 Catalina 中的 Applescript 脚本。该脚本包含以下行:

set p2d to path to desktop as text

如何将“桌面”更改为“/Users/[用户名]/[文件夹名称]”?

我已经尝试过了:

set p2d to path to alias "/Users/[username]/[foldername]" as text

set p2d to path to "/Users/[username]/[foldername]" as text

但两者都不起作用。正确的语法是什么?

谢谢,geb

答案1

不要使用 ,而要path to desktop使用:path to home folder,例如:

set foo to (path to home folder) & "foldername:" as text

tell application "Finder" to make new Finder window to folder foo

相关内容