我正在使用以下脚本编写文件,但有时会出现如下所述的错误,请建议..
set filepath to POSIX path of "Macintosh HD:Library:Application Support:Macromedia:mms.cfg"
try
tell application "System Events"
if file filepath exists then
set myFile to open for access file filepath with write permission
set fileData to read myFile
set eof myFile to 0
write "blah blah" to myFile
close access myFile
else
return "File Not Found"
end if
end tell
on error
return false
end try
错误:
"Network file permission error." number -5000 from file "Macintosh HD:Library:Application Support:Macromedia:mms.cfg"
有时我会收到此错误,无法关闭打开的文件
"File file Macintosh HD:Library:Application Support:Macromedia:mms.cfg is already open." number -49 from file "Macintosh HD:Library:Application Support:Macromedia:mms.cfg"
当我尝试关闭 offile 时,出现此错误:
on openAFile(filepath)
try
set fp to open for access filepath with write permission
on error errstr number errNum
if errNum = -49 then
close access filepath
set fp to open for access filepath with write permission
else
display dialog errstr
return false
end if
end try
return fp
end openAFile
set pointer to openAFile("Macintosh HD:Library:Application Support:Macromedia:mms.cfg"
set fileContents to read pointer
错误
"Can’t make \"Macintosh HD:Library:Application Support:Macromedia:mms.cfg\" into type file." number -1700 from "Macintosh HD:Library:Application Support:Macromedia:mms.cfg" to file