2013-07-10 23 views
0

然而到一个AppleScript工作流程解决方案AppleScript的Posix的混乱

的语法和排序当我创建了下面的代码

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 

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

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

请帮忙!!!!

回答

0

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

即使它有时可以在Finder内部使用“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 
+0

非常好。谢谢轩辕! –

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

谢谢你,这也工作。所有关于POSIX的位置 –