我正在为列表中的每个项目运行一个脚本,
每次在文本文件的顶部添加一行,但实际上我需要更改该顺序,所以它写在最后一行(在底部)
这是我当前的脚本
et dataBackupFile to(桌面文件夹的路径为文本)& “支持Data.txt” insertOnTop from informationOnThisAccount into dataBackupFile
on insertOnTop from theData into theFile
try
set fileDescriptor to open for access file theFile with write permission
if (get eof fileDescriptor) > 0 then
set theContent to read fileDescriptor as «class utf8»
else
set theContent to ""
end if
set eof fileDescriptor to 0
write (theData & theContent) to fileDescriptor as «class utf8»
close access fileDescriptor
return true
on error
try
close access file theFile
end try
return false
end try
end insertOnTop
答案 0 :(得分:2)
替换
set eof fileDescriptor to 0
write (theData & theContent) to fileDescriptor as «class utf8»
与
write (theData & theContent) to fileDescriptor as «class utf8» starting at eof