Re: Reading input from a delimited source file
Re: Reading input from a delimited source file
- Subject: Re: Reading input from a delimited source file
- From: "Arthur J. Knapp" <email@hidden>
- Date: Thu, 09 Jan 2003 10:33:20 -0500
>
Date: Wed, 8 Jan 2003 13:10:58 -0600
>
Subject: Reading input from a delimited source file
>
From: Joseph Weaks <email@hidden>
>
What am I doing wrong? I have a text file that has paragraph delimited
>
data. Basically, I want to read the content of the first paragraph, do
>
stuff with it, then repeat with each paragraph. Here's what I've been
>
trying:
>
-- Begin code snippet
>
Property sourceFile : "Source.txt"
>
>
set theSource to (open for access file ((path to desktop as string) &
>
sourceFile as string)
>
>
set AppleScript's text item delimiters to (ASCII character 13)
>
set sourceList to text items of theSource
theSource is a file-reference number. You need to read the file, and
not simply open it for read-access.
>
Right now, each paragraph is only one word, so there's not a problem
>
loading the whole file into memory.
This this situation, it is not nessesary to use the "open for access"
command at all:
set str to read ( some-file )
both opens, reads, and closes a file if it has not previously been opened.
{ Arthur Knapp, of <
http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
"Safe the Nature" - political graffiti in Prague
}
_______________________________________________
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.