Re: applescript-users digest, Vol 3 #1219 - 15 msgs
Re: applescript-users digest, Vol 3 #1219 - 15 msgs
- Subject: Re: applescript-users digest, Vol 3 #1219 - 15 msgs
- From: julifos <email@hidden>
- Date: Thu, 09 Jan 2003 10:19:32 +0100
>
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
>
>
repeat with x from 1 thru (length of sourceList)
>
set eachSource to item x of sourceList as string
>
-- do stuff with eachSource.
>
end repeat
>
>
close access theSource
>
-- End code
>
>
I'm getting a "Can't get every text item of ..." error.
>
Is there a better way to go about this? Some kind of
>
set eachSource to paragraph x of theSource?
Not sure what are you doing, but I'd reset AppleScript's text item
delimiters before operate with strings...
set AppleScript's text item delimiters to (ASCII character 13)
set sourceList to text items of theSource
set AppleScript's text item delimiters to {""}
>
Right now, each paragraph is only one word, so there's not a problem
>
loading the whole file into memory. I would like to also see a nice clean
>
handler that works if the source file is too long to load all at once.
Increasing your applet/droplet's memory should handle big strings. The
problem is with the number of paragraphs. I believe that applescript can not
handle lists up to (4000+ items?). If this is the situation, you must set a
counter then create a repeat loop and so on...
JJ
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.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.