Home   Archive   Permalink



Quotes or Curly Brackets - depends on file extension - Really?

OK, I am trying to replace in a block some text with a filename loaded into a field. When I choose a filename ending with .zip, when replaced, it is great, it has quotes around it, which I DO need. When I select a filename with a .mkv, which is what I will actually use in this script, I get curly brackets around the replaced filename. I don't get it. Try it out here -
    
R E B O L []
    
avsfile: ["resizeTOx = 1280.0"
"resizeTOy = 720"
"directshowsource(moviepath,fps=23.976,audio=false)"
]
    
gui: layout [
size 600x300
    
     across
    
label black "Path to movie:" tab f4: field 300 "Select File" btn "Load" [f4/text: to-local-file to-file request-file show f4] return
    
    
btn "Start" [avsfile2: copy avsfile
replace avsfile2 "directshowsource(moviepath,fps=23.976,audio=false)" rejoin ["directshowsource(" remold f4/text ",fps=23.976,audio=false)"]
write/lines %movie.avs avsfile2
]
    
]
    
view center-face gui
    
    
    
    


posted by:   tony       21-Jan-2012/18:49:21-8:00



It seems if the width of the field is shorter than the file path rebol puts curly brackets around it instead of quotes???

posted by:   tony       21-Jan-2012/20:36:01-8:00



Quotes are used for single-line strings shorter than 50 characters. Curly brackets are used for strings of more than 50 characters and for multi-line strings.
    
There is no internal difference between them and you can ignore this, when probing strings. They are the same type: string!.
    
When entering strings, the only time you are required to use curly brackets, is when entering multi-line strings, but you can use them at any time, short or long. Attempting to use quotes on creating a multi-line string will result in a syntax error.
    
When using curly brackets, you also no longer have to escape quotes and can type:
    
{"}
    
instead of:
    
"^""

posted by:   Henrik       22-Jan-2012/4:49:17-8:00



Henrik
    Yes, that probably the reason I'm getting the curly brackets when I select a file name longer than 50 characters, but how do I change them back to quotes, as you can see in my script when the movie.avs file is written, rebol uses the curly brackets around the filepath which an external application will access. It needs quotes to understand the filepath, not curly brackets. Is there a command I can use to change the curly brackets to quotes?

posted by:   tony       22-Jan-2012/12:41:34-8:00



solved by doing this with the rejoin command
    
rejoin [{directshowsource("} f4/text {",fps=} fps {,audio=false)}]


posted by:   tony       22-Jan-2012/14:53:45-8:00



Right, that's exactly the best way to do it.

posted by:   Kaj       22-Jan-2012/16:21:55-8:00