boldly creating files where no file has been created before (or not...)
boldly creating files where no file has been created before (or not...)
- Subject: boldly creating files where no file has been created before (or not...)
- From: has <email@hidden>
- Date: Fri, 25 Jan 2002 01:25:45 +0000
Hi,
My brain is pretty much toast at this point, so for once I'm going to take
the easy (if shameful and embarrassing) option and just ask the list
instead. (Even if it does make me look like an ignorant newbie.)
The following code works fine for me (AS 1.3.7, OS 8.6). My daring and
courageous tester, however, reports that it fails on their system (AS 1.6,
OS 9.1).
======================================================================
on saveScript(filePath, scriptObj)
try
store script scriptObj in filePath replacing yes
true
on error errormsg number errorNumber
error "Couldn't save script file " & filePath & " due to error:
" & errormsg number errorNumber
end try
end saveScript
======================================================================
The filePath parameter is a string: "Saphir:Desktop
Folder:AWPS:TemplateObjFolder:test TemplateObj"
The scriptObj parameter is, not surprisingly, a script object.
On my system, a new script object is created at the given location, and
everything is peachy. On theirs, they get an error:
"Couldn't save script file Saphir:Desktop
Folder:AWPS:TemplateObjFolder:test TemplateObj due to error: File wasn't
found. : -43"
They report the same sort of problem with:
======================================================================
on writeLogFile(theString)
open for access logFilePath with write permission
(get eof logFilePath) + 1
write theString to alias logFilePath starting at result
close access logFilePath
end writeLogFile
======================================================================
(where logFilePath is, again, a string similar to the previous example).
Bang - won't work unless a file is already there. Needless to say, it works
faultlessly for me.
So:
a) Am I a fool who can't write even simple AS correctly?
b) Has AS 1.6 got it in for me?
c) Is every version of AS other than 1.3.7 irredeemably crap/broken/crap
AND broken?
d) Should I find something more worthwhile to do with my life instead?
e) All of the above.
Comments, solutions, and maybe even code that works are all most gratefully
received.
has (Oh, the ignominy...)