applescript Posix混沌

applescript Posix混沌,applescript,workflow,posix,Applescript,Workflow,Posix,再一次被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 一切正

再一次被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
一切正常。但是,我需要根据输入的“客户代码”和“部门”在不同的位置创建主文件夹,因此我尝试了以下方法:

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
错误返回到Application Finder的“无法获取”卷/WAM XSAN/Audio/AAA

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

请帮忙

试试看:

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})

试试这个例子。我试着模仿你所做的。请注意,我已将大部分代码移到Finder-tell代码块之外。查找程序不知道“posix文件”命令。这是applescript命令,不是Finder命令。此外,您不需要Finder来设置变量和添加字符串。我们可以在Finder之外完成所有这些

即使有时在Finder-tell代码块中包含“posix-file”命令时,它也会起作用,但最好只告诉应用程序做他们知道如何做的事情。通过查看应用程序的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

谢谢你,这也行得通。所有关于POSIX位置的信息都非常好。谢谢雷格斯!