【发布时间】:2019-02-13 02:20:27
【问题描述】:
我正在使用代码为实验室数据格式化文本编辑文件。
我目前正在使用 AppleScript 在 TextEdit 中创建一个文档并向其中添加文本,但是当我尝试保存它时,TextEdit 给我一个错误“您无权另存为 blahblahblah”。我已经尝试更改保存它的文件夹的权限,但我认为这可能与它是 AppleScript 创建的文件有关。
确切的错误输出是来自 TextEdit 的对话框
文档“1.txt”无法保存为“1”。你没有权限。
要查看或更改权限,请在 Finder 中选择项目,然后选择“文件”>“获取信息”。
我的代码中不起作用的部分是
tell application "TextEdit"
make new document with properties {name:("1.txt")}
end tell
--data formatting code here (n is set here)
tell application "TextEdit"
delay 1
close document 1 saving in ("/Users/bo/Desktop/Script Doc/" & (n as string))
set n to n + 1
make new document with properties {name:((n as string) & ".txt")}
delay 1
end tell
我搜索了其他问题并找到了代码段
open for access document 1
close access document 1
但我不确定如何实施这些/如果我应该实施,如果没有,我不确定如何解决这个问题。
提前致谢
【问题讨论】:
标签: applescript