Home   Archive   Permalink



Question about 'call' function

I was looking at parse examples from one of Nick's documents and came across the one shown below. The parsing I understand, but I am confused about the "call" function. If that "call" function is taken out, then every time a field is validated I get the standard REBOL security question. I suppose that is because the script is trying to access a folder outside of where it is running, which makes sense, but what I don't understand is why the "call" function stops that from happening.
    
Thank you.
    
R E B O L []
    
nums: charset "0123456789"
alfs: charset [#"a" - #"z" #"A" - #"Z"]
    
call "" ;; Without this we get the security alert.
    
validate: func [
     f
     rule
] [
     if not parse f/text rule [
         attempt [
             insert s: open sound:// load %/c/windows/media/chord.wav
             wait s
             close s
         ]
     ]
]
    
view layout [
    f1: field "12345678" [validate face [8 nums]]
    field "1234" [validate face [4 nums]]
    field "(555)123-2345" [validate face ["(" 3 nums ")" 3 nums "-" 4 nums]]
    field "me@url.com" [validate face [some alfs "@" some alfs "." 3 alfs]]
    do [focus f1]
]
    


posted by:   Steven White       13-May-2019/14:42:24-7:00



That was a little hack. The 'call function simply requires the user to respond to the security requestor immediately when the app starts. That way, when the sound is played, the app has already been given the security permission it needs to continue, without having to pause at that point. The 'call function doesn't perform any action - it's just a dummy forcing Rebol to raise the security dialogue (any other function which raises the security dialogue could be use in its place). You could also choose to run Rebol from the command line with the -s option, to provide the same permission without any user interaction.

posted by:   Nick       15-May-2019/7:43:06-7:00



Name:


Message:


Type the reverse of this captcha text: "r e t n u o c"



Home