再一次被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“和”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错误返回"Can't get "Volumes/WAM XSAN/Audio/AAA“of Application Finder”
在设置POSIX路径时,我哪里出错了?
请帮帮我!
发布于 2013-07-10 21:05:19
试一下这个例子。我试着模仿你想做的事情。请注意,我已经将大部分代码移出了Finder tell代码块。Finder不知道"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发布于 2013-07-10 20:54:52
尝试:
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})https://stackoverflow.com/questions/17570838
复制相似问题