On Sep 26, 2006, at 3:59 PM, Dar Scott wrote:
Try something like this when changing the default folder:
*************
try
put the defaultFolder into savedDefaultFolder
set the defaultfolder to defaultFolderForThisTask
... blah blah blah ...
catch e
finally
set the defaultFolder to savedDefaultFolder
end try
*************
Yikes. I should "try" to keep this simple. Do this:
put the defaultFolder into savedDefaultFolder
set the defaultfolder to defaultFolderForThisTask
... blah blah blah ...
set the defaultFolder to savedDefaultFolder
Then if you want to also set it back on errors, try 'try'. If you
don't want to tackle 'try', that is fine.
The problem with my simplified 'try' example above is that it ignores
any indication or handling of errors. It might be like this:
*************
try
put the defaultFolder into savedDefaultFolder
set the defaultfolder to defaultFolderForThisTask
... blah blah blah ...
catch e
error e
finally
set the defaultFolder to savedDefaultFolder
end try
*************
Except 'error e' is not a valid command. However, with recent change
in the IDE, this is not too bad:
*************
put false into bad
try
put the defaultFolder into savedDefaultFolder
set the defaultfolder to defaultFolderForThisTask
... blah blah blah ...
catch e
put true into bad -- throw is broken here
finally
set the defaultFolder to savedDefaultFolder
end try
if bad then throw "Error when loading external."
*************
It would be simpler if an error could reliably be thrown in the catch
section. Simpler yet if the catch could be optional:
*************
try
put the defaultFolder into savedDefaultFolder
set the defaultfolder to defaultFolderForThisTask
... blah blah blah ...
finally
set the defaultFolder to savedDefaultFolder
end try
*************
Now, that would be nice. (I'm assuming that hasn't been fixed when I
wasn't looking.)
Dar
--
**************************************
Dar Scott
Dar Scott Consulting and Dar's Lab
8637 Horacio Place NE
Albuquerque, NM 87111
Lab, office, home: +1 505 299 9497
Fax: call above first
Skype: ask
http://www.swcp.com/dsc
[EMAIL PROTECTED]
Computer programming
**************************************
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution