0

再次被 AppleScript 工作流解决方案的语法和排序弄糊涂了

当我创建以下代码

tell application "Finder"
    set remote_p to alias (POSIX file '/Volumes/WAM XSAN/Audio/AAA)
    set main_folder to (make new folder at remote_p with properties {name:temp_name}) as     alias

end tell

一切正常。但是,我需要根据输入“client_code”和“department”在不同的位置创建 main_folder,所以我尝试了这个:

tell application "Finder"
    set x_san to "/Volumes/WAM XSAN/"
    set x_sannewpath to (x_san & department & "/" & client_code)
    set x_sanfolder to POSIX file x_sannewpath
    set remote_p to alias (POSIX file x_sanfolder)
    set main_folder to (make new folder at remote_p with properties {name:temp_name}) as     alias

end tell

错误又回来了“无法获得应用程序查找器的“卷/WAM XSAN/音频/AAA””

我在设置 POSIX 路径时哪里出错了?

请帮忙!!!!

4

2 回答 2

0

试试这个例子。我试图按照你想要做的事情来建模它。请注意,我已将大部分代码移到 Finder 告诉代码块之外。Finder 不知道“posix 文件”命令。那是一个 applescript 命令,而不是 Finder 命令。此外,您不需要 Finder 来设置变量并将字符串添加在一起。我们可以在 Finder 之外完成所有这些工作。

尽管它有时在 Finder 告诉代码块中有“posix 文件”命令时有效,但最好只告诉应用程序执行它们知道如何执行的操作。您可以通过查看应用程序的 applescript 字典来找到应用程序知道如何执行的操作。检查 Finder 字典,您会发现“posix 文件”不是它的命令之一。

无论如何,这将在您的桌面上创建一个文件夹。我希望这有帮助。

set x_san to "/Users/hmcshane/"
set client_code to "Desktop"
set temp_name to "test folder"

set x_sannewpath to x_san & client_code
set applescript_x_sannewpath to POSIX file x_sannewpath

tell application "Finder"
    set main_folder to (make new folder at applescript_x_sannewpath with properties {name:temp_name}) as alias
end tell
于 2013-07-10T13:05:18.923 回答
0

尝试:

set department to "Audio"
set client_code to "AAA"
set temp_name to "New Folder"
set x_san to "Volumes/WAM XSAN/"
set x_sannewpath to x_san & department & "/" & client_code
tell application "Finder" to set main_folder to (make new folder at POSIX file x_sannewpath with properties {name:temp_name})
于 2013-07-10T12:54:52.083 回答