1
wrting数据转换成文件正在使用下面的脚本编写的文件,但有时会收到错误类似下面,请建议..错误而使用AppleScript
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"
当我试图关闭OFILE正在此eror:
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
是他们解决网络文件权限错误的方法吗? –