Re: Almost! to the end
John Love <[email protected]>
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
I tracked down NSException. Appscript posts a "NSRangeException" Exception which applies in my case. So, a simple @try .. @catch pair around each row does the trick. Thanks again and again .. John Love ===== On Jan 12, 10, at 10:33 AM, John Love wrote: > Thanks to many, many folk, I am at the very end of my project .. calculating an Excel spreadsheet, cell by cell .. with the calculations done in a background thread .. using either +detachNewThreadSelector and/or NSPorts with NSPortMessages, or even a NSOperationQueue. Tried all 3 approaches just for the sake of learning, and they all work. > > It's definitely been quite an education for me and quite an exercise in patience for all you folks. > > Oh, one more thing .. I use HAS's appscript application, ASTranslate, to convert my previous! AppleScript Studio code to Cocoa .. and it really works. > > After completing each row's worth of calculations, I test for the existence of both Excel and the spreadsheet .. in case the user prematurely quits the app or closes the spreadsheet .. and it works like a charm .. if quitting or closing, a message appears in my doc window. > > EXCEPT, if the user quits the app or closes the spreadsheet in the middle of completing the calculations for each row before I have a chance to do the appropriate testing. Even if I burden my code by testing before each cell in the entire row, I still (theoretically) could encounter a quit or a close in the middle of a cell's calculation. Clearly, getting or setting the value in a cell of a spreadsheet doc that is closed crashes my app. > > My very initial thoughts focus on NSError, except HAS's ASTranslate app does not seem to include a built in NSError object, such as is passed to NSDocument's -readFromURL. > > Any help out there for this worst-case scenario? Thanks in advance. > > John Love > Touch the Future! Teach! > John Love Touch the Future! Teach!