Re: string count in log file
Re: string count in log file
- Subject: Re: string count in log file
- From: Greg Sutherland <email@hidden>
- Date: Mon, 24 Sep 2001 10:23:54 -0400 (EDT)
I downloaded Smile and have been trying to figure out what is happening.
When I set srchStrng rather than letting it get set by repeat then the
count works. With a display dialog in the loop srchStrng looks correct
when set by repeat, but the count is always 0.
I'm using a file with just two words in it. I use it for the file to
analyze as well as the file of search strings. It also gets counts of 0
when I'm using a real logfile and a list of search strings.
I'm using AS1.3.7 OS8.6 on a G3.
Here is my script. If you don't see my error, I would really appreciate
an alternate way to do this. greg
set theFile to (choose file with prompt "Pick the file to analyze:" of
type {"TEXT"})
set fileID to (open for access theFile)
try
set theText to (read fileID)
close access fileID
on error m number n
try
close access fileID
on error
end try
error m number n
end try
set theFile to (choose file with prompt "Pick the file of search strings:"
of type {"TEXT"})
set fileID to (open for access theFile)
try
set srchTbl to (read fileID as {text} using delimiter {return})
close access fileID
on error m number n
try
close access fileID
on error
end try
error m number n
end try
set rsltText to ""
set od to AppleScript's text item delimiters
repeat with srchStrng in srchTbl
set AppleScript's text item delimiters to srchStrng
set theCount to (count text items of theText) - 1
set rsltText to rsltText & srchStrng & tab & (theCount as text) &
return
end repeat
display dialog rsltText