I have a question about reading files in Lion vrs Tiger.
I have a script that is running very sluggishly under Lion on a Mac Mini. This same script ran much faster under Tiger, so I've been trying to figure out why.
The script is very long and involved so I'm breaking the testing up into pieces. The first thing it does is read several HTML files and strip out rows of a table from each file. Each HTML page is between 6 and 7 K in size.
So I timed this piece of the script.
Here's the main part of this piece of the script:
set theList to FileLib's GetFileListOfFolder(HTMLFolder, false) -- get files in HTML folder
set RowSearchStr to "<td class=\"lc1\">.*?</tr>"
set TitleSearchStr to "<title>.*?</title>"
set AllRows to {}
tell application "TextCommands" to set startTime to lowercase (time string of (current date))
repeat with eachFile in theList
tell application "Finder" to set nm to name of eachFile
tell application "Finder" to set knd to kind of eachFile as text
if not (nm begins with " ") then -- skip files beginning with a space
if (knd is "Document") or (knd is "HTML document") then
set fileCnt to fileCnt + 1
set theFile to eachFile as alias
-- read the file
set FileRef to open for access theFile
set DocumentText to read FileRef
close access FileRef
tell application "TextCommands" to set Rows to search DocumentText for RowSearchStr with regex
set AllRows to AllRows & Rows -- append
end if
end if
end repeat
tell application "TextCommands" to set StopTime to lowercase (time string of (current date)) -- debug
set totalCnt to count of AllRows
set mess to "Start: " & startTime & return & "Stop: " & StopTime & return & return -- debug
set mess to mess & "Possible files: " & (totalCnt as text) & " found in " & (fileCnt as text) & " files." -- debug
display dialog mess with title appTitle -- debug