当输出设置为桌面时,Applescript可以工作,需要将输出设置为Team Drive文件夹

时间:2019-05-17 15:56:12

标签: applescript

我有一个Applescript将XLSX转换为XLS。我可以从Google Team Drive获取文件(通过Drive File Stream),将其转换并保存到我的桌面上。当我尝试将其保存到Google Team Drive上的“ Out”文件夹时,出现错误。

我认为我的输出路径不正确。我尝试过其他方法来达到目标​​,但是没有运气。

将工作代码保存到桌面:

    set {year:y, month:m, day:d, time:t} to (current date)
    set today to (m as number) & d & y
    set TSCfilein to "Volumes:GoogleDrive:Team Drives:Sales:Customer Service:Inventory Feeds:TSC:In:TSC_Master.xlsx"
    set TSCfileout to (path to desktop as text) & "TSC" & today & ".xls" as string

    tell application "Microsoft Excel"
        activate
        open file TSCfilein
        tell workbook 1
            tell sheet 1
            save active workbook in TSCfileout as Excel98to2004 file format


        end tell

        close without saving
        end tell
    end tell

将TSCfileout设置更改为以下会导致错误:

    set TSCfileout to "Volumes:Google Drive:⁨Team Drives⁩:Sales:Customer Service⁩:Inventory Feeds:TSC:Out" & "TSC" & today & ".xls" as string

预期结果是保存文件Google Team Drive文件夹。

错误:

“ Microsoft Excel出现错误:工作簿1的工作表1的活动工作簿无法理解“保存”消息。”当我尝试指向输出文件的位置时。

1 个答案:

答案 0 :(得分:0)

有一个普遍的误解:HFS路径总是以磁盘名称开始,而始终,但从不以Volumes开头。

请勿将其与POSIX路径混淆。

  • 启动卷“ Macintosh HD”作为POSIX路径是/作为HFS路径Macintosh HD
  • 作为POSIX路径的外部卷“ Google Drive”作为HFS路径/Volumes/Google Drive的{​​{1}}

Google Drive

之后有一个冒号

您通往外部卷的路径是

Out

尾随强制set TSCfileout to "Google Drive:⁨Team Drives⁩:Sales:Customer Service⁩:Inventory Feeds:TSC:Out:" & "TSC" & today & ".xls" 是多余的。根据规则,最左边的类型是连接的结果类型。