Re: read write basics
Re: read write basics
- Subject: Re: read write basics
- From: monk <email@hidden>
- Date: Thu, 05 Jul 2001 11:26:08 -0400
-- 7/5/01 06:47 am: email@hidden said:
>
Looks to me like you just need to use the "open for access" command...
>
ok, i had also read through references and tried that, but when i realized
the file would need to be chosen, ie using a variable file name i got rid of
'open for access', since it called for a specific file name every time, but
if as you are saying i can create the generic output file in the begining,
that would be fine to - thanks for clearing this up!
a few ?s
>
open for access file "myhd:desktop folder:new source" with write permission
how do i call any user's hd (a variably named hd), as in myhd above then?
>
copy (choose file) to _source
>
read _source as list using delimiter space
>
write result to file "myhd:desktop folder:new source"
>
close access file "myhd:desktop folder:new source"
>
i am unclear from the ref, if i should 'close for access' the variable
'_source' as well, or is it always the file? also, when i 'choose file', i
get the contents available, is that in a way like 'open', if so do i have to
call a 'close' on the file chosen?
>
"Open for access" will create the specified file if it doesn't already
>
exist.
>
>
You might also find this useful later:
>
>
set DesktopPath to path to desktop as string
>
open for access file (DesktopPath & "new source") with write permission
>
ok, i'll study this out - many thanks for your human intervention
>
>
Guy
>
>
> hi list
>
>
>
> at a loss as to how to write a text file, just trying to get my i/o
>
> framework going on a newbie script i'm throwing together
>
>
>
> here's what i have so far, and i always end up with an 'execution error'
>
> that the file i'm trying to write "wasn't found"
>
>
>
> i expect there is some command that i need prior to writing the file, and
>
> when i try 'create file . . . ' i get a 'syntax error' 'expected end of
>
> line, etc. but found class name' (so it's a bad command i suppose), anyway:
>
>
>
> copy (choose file) to _source
>
>
>
> read _source as list using delimiter space
>
>
>
> write result to file "myhd:desktop folder:new source"
>
>
>
> thanks,
h 'monk' elmer
--
http://www.assemblage.org