【问题标题】:Applescript Posix files and pathsApplescript Posix 文件和路径
【发布时间】:2013-07-05 21:30:14
【问题描述】:

我正在尝试设置脚本以将模板文件复制到新创建的文件夹中。该文件是从 template_name 创建的变量。不幸的是,我是 posix 新手,似乎无法让脚本将模板文件复制到新文件夹。

返回的错误是 “无法将应用程序“Finder”的“/Volumes/Media/NewFolder”设置为应用程序“Finder”的文件“Volumes/Media/+A3Temp.ptx”

set temp_name to client_code & " " & brand_name & " " & job_name & " " & job_number & " " & creation_date
set media_folder to "/Volumes/Media/"
set new_folder to media_folder & temp_name
set template_name to ("+" & suite & "Temp.ptx") as string
set session_name to (client_code & " " & brand_name & " " & job_name & " " &     creation_date & ".ptx")
set template to (media_folder & template_name)



tell application "Finder"
    duplicate POSIX file template to POSIX file new_folder
end tell

我知道错误在于这些行

tell application "Finder"
    duplicate POSIX file template to POSIX file new_folder
end tell

但我不知道如何补救。谁能帮忙!?

【问题讨论】:

    标签: templates applescript duplicates posix


    【解决方案1】:

    我在运行此脚本时遇到了类似的错误:

    set f to "/usr/share/dict/connectives"
    set d to "/private/tmp/"
    tell application "Finder"
        duplicate POSIX file f to POSIX file d
    end tell
    

    Finder 出错:无法将 POSIX 文件“/private/tmp/”设置为 POSIX 文件“/usr/share/dict/connectives”。

    这些都有效:

    set f to POSIX file "/usr/share/dict/connectives"
    set d to POSIX file "/private/tmp/"
    tell application "Finder"
        duplicate f to d
    end tell
    
    tell application "Finder"
        duplicate POSIX file "/usr/share/dict/connectives" to POSIX file "/private/tmp/"
    end tell
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-09-11
      • 1970-01-01
      • 1970-01-01
      • 2014-07-31
      • 1970-01-01
      • 2015-12-30
      • 1970-01-01
      相关资源
      最近更新 更多