我正在尝试将Google团队驱动器上的文件夹复制到其他位置,但我的脚本一直出错。完整的脚本如下。
我基本上想将Excel文件“Google Drive:Team Drives:Company -Sync Folder:0000-1_E.xlsx”复制到脚本定义的位置。
违规行是:
duplicate file "Google Drive:Team Drives:Company -Sync Folder:0000-1_E.xlsx" of startup disk to folder (jobNum & " Documents") of newJobFolder
任何帮助?
global jobNum
global newJobFolder
set jobNum to text returned of (display dialog "Enter a job number:" default answer "")
set jobName to text returned of (display dialog "Enter a job name:" default answer "")
set jobMgr to text returned of (display dialog "Enter account manager email:" default answer "")
set folderpath to (choose folder with prompt "Select client folder")
set newJobFolder to my newFold(jobNum, jobName, folderpath, jobMgr)
on newFold(theNumber, theName, thefolder, jobMgr)
set emailAddress to jobMgr
set emailSubject to theNumber & " -" & theName
set bodyText to ""
set emailLinkFileName to theNumber & " -" & theName
set subNameList to {"Designs", "Documents", "Received"}
set itemCount to count of subNameList
set linkBody to "mailto:" & emailAddress & "?subject=" & my replace_chars(emailSubject, " ", "%20") & "&body=" & my replace_chars(bodyText, " ", "%20")
tell application "Finder"
set newJobFolder to (make new folder at thefolder with properties ¬
{name:theNumber & " " & theName})
repeat with i from 1 to itemCount
set aSubFolder to make new folder at newJobFolder with properties {name:jobNum & " " & item i of subNameList}
set theMailto to make new internet location file to linkBody at aSubFolder with properties {name:emailLinkFileName, name extension:"mailloc"}
set the name extension of theMailto to "mailloc"
end repeat
duplicate file "Google Drive:Team Drives:Company -Sync Folder:0000-1_E.xlsx" of startup disk to folder (jobNum & " Documents") of newJobFolder
set name of the result to jobNum & " E.xlsx"
set theMailto to make new internet location file to linkBody at newJobFolder with properties {name:emailLinkFileName, name extension:"mailloc"}
set the name extension of theMailto to "mailloc"
end tell
end newFold
-- Generic find and replace functionality
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
答案 0 :(得分:0)
假设您的“Google云端硬盘”文件夹直接驻留在您的主文件夹中......
尝试更改此内容......
set theFile to (path to home folder as text) & "Google Drive:Team Drives:Company -Sync Folder:0000-1_E.xlsx"
duplicate file theFile to folder (jobNum & " Documents") of newJobFolder
对此...
set theFile to (choose file) as alias as text
duplicate file theFile to folder (jobNum & " Documents") of newJobFolder
如果这不起作用,你可以尝试这种方法......
{{1}}
然后在运行一次之后,注释掉choose file命令。
答案 1 :(得分:0)
如果您使用的是企业专用的Google Drive File Stream,则可以通过用户文件夹访问已安装的驱动器,路径如下所示:
“ /用户/ <用户名> / Google云端硬盘文件流/我的云端硬盘/ 公司文件夹”
使用这种格式访问文件夹,它应该可以工作,这就是我要做的。