Home   Archive   Permalink



Ignoring errors

I have this function called CLICK which just plays a short sound by inserting a loaded sound file into the sound port. It works fine. I want to use it on a VID window to make a click when I press a button. So I code this:
    
button 'FUNCTION-1' [CLICK FUNCTION-1]
    
which works fine IF there is a sound card. But if the computer has no sound, REBOL halts with an error.    
    
I see examples on the internet of how to capture an error and take action, but I am not quite clear on how to IGNORE an error. If my target computer has no sound capability and I try to make a sound, it's OK if I can't, let's just move on.
    
I tried '[disarm try [CLICK] FUNCTION-1]' but that is not right. I tried just '[try [CLICK] FUNCTION-1]' and that's not it. I'm sure it's something simple. Can someone tell me what it is?
    
Thank you.

posted by:   Steven White       2-Feb-2016/11:12:53-8:00



ATTEMPT is what you want:
    
     attempt [1 / 0]


posted by:   Sunanda       2-Feb-2016/11:53:45-8:00