Permissions AppleScript没有保存文件的权限

Permissions AppleScript没有保存文件的权限,permissions,applescript,Permissions,Applescript,使用Applescript将文件写入我的外部硬盘时,会显示以下错误: 文档“Untitled 2”无法导出为“test.txt”。您没有权限。 我的代码应该使用TextEdit编写一个文件,并将其保存为.txt文件。我的代码: tell application "TextEdit" activate make new document set theDate to current date set text of document 1 to do shell script "curl 'www.

使用Applescript将文件写入我的外部硬盘时,会显示以下错误:
文档“Untitled 2”无法导出为“test.txt”。您没有权限。
我的代码应该使用TextEdit编写一个文件,并将其保存为
.txt
文件。我的代码:

tell application "TextEdit"
activate
make new document
set theDate to current date
set text of document 1 to do shell script "curl 'www.google.com'"
tell application "System Events" to tell process "TextEdit"
    if menu item "Make Plain Text" of menu 1 of menu bar item "Format" of menu bar 1 exists then
        keystroke "t" using {shift down, command down}
        keystroke return
    end if
end tell
save document 1 in "HARDRIVE:test.txt"
end tell
(HARDRIVE是我的外部硬盘驱动器)。 为什么会导致这个错误?我能做些什么来修复它


谢谢

使用文件对象作为路径-->文件“一些HFS路径”

save document 1 in file "HARDRIVE:test.txt"