Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: to-string do question?

From: bry:itnisk at: 22-Jul-2003 14:58

[ I'm not sure what the... [if/else error? try[do f1/text][returnstring: "False"] block is for, as I can't see that it'd ever be evaluated. Blocks within a block being evaluated are not evaluated in REBOL unless forced to by a do or other means. ie... If you want to capture true or false as well as returnstring (when there's no error), I'd use something like this... err: error? try[returnstring: to-string do f1/text] err would then contain true or false and returnstring whatever the result of the do is if there wasn't an error. ] okay I've tried that, seems to have a problem though, if what is being done is write %newfile.txt read %rlt.txt and rlt.txt does not exist then err does not have a value. Gabriele asked what I was trying to do, this goes back to my discussion a long time ago about asynchronous pluggable protocols(windows) and using them from rebol. I'm implementing and writing a little article on such a protocol, so what happens is that one calls the protocol from a link on a html page, for example <a href="reb://write %newfile.txt read %result.txt/">read local file</a> the protocol gets passed to a rebol script loaded by rebol.exe for evaluation, the script has a view layout and an area(f1) in it for display of the protocol body, if you click a do button I want the following sequence to happen: the result of doing f1/text is written to the field f2. If the protocol is reb://1 + 7 then what gets written to field f2 is 8. So if f1/text = read dsisdfa that should raise an error because dsisdfa is not a file url object or block, and of course dsisdfa has no value whatsoever, not having been declared anywhere. If on the other hand the string I have is doable but the output from it is not something that can be written to f2 then I need to return the string true, i.e we did the script but there is no output. I have most of this implemented, just not the proper error handling for the case if someone sends nonsense such as read dsisdfa in the protocol. Using the above err seems to return true for read dsisdfa.