First off, thanks to Alan Stenhouse for zeroing in on my filter-related mistake. Any number fo people *could* have done so, but it was Alan who actually did the deed. So, yay Alan!
Second: I discovered something odd as a result of another mistake I made. My mistake:
ask file "What do you want to read?"
put it into DisFile
read from file DisFile until EOF
put it into fld "This Field"
What went into field "This Field" was the contents of the *variable* DisFile, *not* the contents of the *file* whose name is stored in the variable DisFile. This is because of how the pseudo-variable "it" behaves, i suspect.
My mistake was that I didn't *open* file DisFile before reading it, of course. And once I did open the file, the reading went on normally, and the contents of the field did indeed end up in the field "This Field". So, bad on me for not opening the file first, good on me for recognizing & fixing that lapse without external assistance. But I do have a question:
Why didn't I get an error message when I tried to read from a file that hadn't been opened yet? Shouldn't LiveCode have gotten fussy about that?
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
On 2017-04-26 08:35, Quentin Long via use-livecode wrote:
> ask file "What do you want to read?"
> put it into DisFile
> read from file DisFile until EOF
> put it into fld "This Field"
> Why didn't I get an error message when I tried to read from a file
> that hadn't been opened yet? Shouldn't LiveCode have gotten fussy
> about that?
The read / write file commands both set 'the result' if there is an
error with the operation requested - in this case it would be set to
something like 'file not open'.