The "choose file" window stays open way too long


on loadBOM()
set theTextFile to choose file as alias
read thetTextFile
        set theText to text of result as unicode text
        set paraCount to count the paragraphs of theText
--Code that parses the text and populates a table
end loadBOM

The problem I’m having is that it takes several seconds to parse the text file and populate the table and the “choose file” window stays open until the whole thing is done. It covers up my nice progress bar. How can I force the window to go away as soon as the user selects the file?

Thanks!
Greg

You can put all the code after the choose file statement in a separate handler, and call it using performSelector:withObject:afterDelay:, with a delay of 0.

I tried a delay of 0 but it still stayed open till the end but 0.1 worked nicely.
Thanks!