Re: Behavior change in "open for access" from AS 1.6 to 1.8.3?
Re: Behavior change in "open for access" from AS 1.6 to 1.8.3?
- Subject: Re: Behavior change in "open for access" from AS 1.6 to 1.8.3?
- From: "Daniel A. Shockley" <email@hidden>
- Date: Sun, 7 Jul 2002 17:47:57 -0400
In the script handler listed earlier, you'll get success if the
string is empty, which may not be what you want, as Richard Morton
pointed out. Here's some code he suggested:
on testPathExists(inputPath)
-- version 1.4
-- from Richard Morton, on email@hidden
if inputPath is not equal to "" then try
get alias inputPath as string
return true
end try
return false
end testPathExists
Date: Fri, 05 Jul 2002 16:28:08 +1000
Subject: Re: Behavior change in "open for access" from AS 1.6 to 1.8.3?
From: Timothy Bates <email@hidden>
To: AppleScriptUsers List <email@hidden>
[in AS 1.6 open for access thPath returned -43 is the file did not exist
in 1.8.3 I get a -39 error (End of file)
and it creates an empty file!
Is this a known (and intended) change?
Form the dictionary for open for access we learn "If the file does not
exist, a new file is created", so you are getting the expected behavior.
AppleScrtipt has changed its behavior regarding reading files with no
content, and setting the eof in files with no content, but that is another
issue.
To check if a file exists, you could use something like
on FileExists(thePath) --check if a file exists
try
alias (thePath as string)
return true
on error
return false
end try
end FileExists
--__--__--
--
----
Daniel A. Shockley
email@hidden
email@hidden
http://www.danshockley.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.