[EMAIL PROTECTED] wrote:
>
> Please explain this error I get:
>
> ** Script Error: val needs a value.
> ** Where: val: first params switch/default type?/word
Do this -
val: print ""
You get the same error, because print doesn't return a value, and Rebol
needs a value to set val with.
>> type? print ""
== unset!
So when layout parses your code, when it reaches 'area print data', it
sees that 'print data' is a function, tries to evaluate it and get the
result. But print returns no result, so it bombs. The second problem
is that the data variable is a block, and you want it in string form.
So replace print with form -
view layout [
text "Directory contents:"
area form data
]
That's very basic, and puts everything on one line. So lets use a
function that will put each entry in the block on a seperate line, and
this is what you end up with -
REBOL []
block-to-lines: func [blk /local result] [
result: copy ""
foreach line blk [
repend result [line newline]
]
result
]
ftpaccess: layout [
backdrop 0.128.0 title "Pauls FTP Access" 255.255.0
text "Enter Host Address/Directory" hr: field "127.0.0.1"
text "Login Name" ln: field "administrator"
text "Password" Pw: field "testpwd"
button "FTP Access" [
ftpurl: join ftp:// [ln/text ":" pw/text "@" hr/text]
data: read ftpurl
view layout [
text "Directory contents:"
area block-to-lines data
]
]
]
view ftpaccess
If you ever do need to set a value as unset, do this -
>> set/any 'val print ""
>> value? 'val
== false
Julian Kinraid
> I get the above error when executing this script I created:
>
> REBOL []
>
> ftpaccess: layout [
>
> backdrop 0.128.0 title "Pauls FTP Access" 255.255.0
>
> text "Enter Host Address/Directory" hr: field "127.0.0.1"
> text "Login Name" ln: field "administrator"
> text "Password" Pw: field "testpwd"
>
> button "FTP Access" [
> ftpurl: join ftp:// [ln/text ":" pw/text "@" hr/text]
> data: read ftpurl
> view layout [
> text "Directory contents:"
> area print data
> ]
> ]
>
> view ftpaccess