Seems I don't understand "load"
[1/6] from: swhite:ci:bloomington:mn:us at: 26-Feb-2008 9:38
I know this is a dumb question, but I just don't see it.
I am trying to make a file transfer script. I want to put the names of
the files into another file, so the program can be more general. I make
a file like this:
—-
FILE-LIST: [
index.htm
index1.htm
logo150.gif
logo_fromJan.gif
WintixManual.pdf
]
—-
In my script, if I "load" this file, I get an error message "FILE-LIST
has no value."
If I put a REBOL header into the file and "do" the file, it works.
What is wrong with my understanding of "load"?
Thank you.
(The file names are strings instead of file names because I have to
append a directory name to each and then convert the final string to a
file. That is, I believe, a separate issue I am struggling with.)
Steven White
City of Bloomington
1800 W Old Shakopee Rd
Bloomington MN 55431-3096
USA
952-563-4882 (voice)
952-563-4672 (fax)
steven.white-ci.bloomington.mn.us
[2/6] from: brock:kalef:innovapost at: 26-Feb-2008 12:24
U3RldmVuLA0KSSB3b24ndCBwcmV0ZW5kIHRvIGtub3cgdGhlIGZpbmVyIHBvaW50cyBvZiBsb2Fk
LCBidXQgbXkgYmVsaWVmIGlzIGl0IGlzIGludGVuZGVkIGZvciBsb2FkaW5nIHNjcmlwdHMgaW50
byBtZW1vcnkgb3IgaW1hZ2UgZmlsZXMuICBTbyBvbmNlIHlvdSd2ZSAnbG9hZGVkJyB0aGlzIGZp
bGUsIHlvdSBoYXZlIHRoZSBGSUxFLUxJU1QgYmxvY2sgYXZhaWxhYmxlLg0KDQpJIHR5cGljYWxs
eSB1c2UgICAncmVhZC9saW5lcyAgIGZvciB0aGlzIHR5cGUgb2YgZnVuY3Rpb25hbGl0eSBhbmQg
dGhlIGJlbmVmaXQgaXMgeW91IGRvbid0IG5lZWQgdG8gcHJvdmlkZSB0aGUgYmxvY2sgbmFtZSBp
biB0aGUgZmlsZSBhbmQgZWFjaCBsaW5lIG9mIHRoZSBmaWxlIGlzIHJldHVybmVkIGFzIGEgc3Ry
aW5nLg0KDQpIZXJlIGlzIHRoZSBjb250ZW50cyBvZiBmaWxlLWxpc3QudHh0DQppbmRleC5odG0N
CmluZG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9uLm1uLnVzDQo+DQo+LS0NCj5UbyB1bnN1YnNjcmli
ZSBmcm9tIHRoZSBsaXN0LCBqdXN0IHNlbmQgYW4gZW1haWwgdG8gbGlzdHMgYXQgDQo+cmVib2wu
Y29tIHdpdGggdW5zdWJzY3JpYmUgYXMgdGhlIHN1YmplY3QuDQo+DQo+DQo=
[3/6] from: moliad::gmail at: 26-Feb-2008 13:01
I agree brock.... hehehe ;-)
-MAx
On Tue, Feb 26, 2008 at 12:24 PM, Brock Kalef <brock.kalef-innovapost.com>
wrote:
[4/6] from: moliad::gmail::com at: 26-Feb-2008 13:17
hi Steven,
Load only decodes strings converting them to rebol natives. it does not
evaluate the resulting block of rebol values and symbols.
which is why 'DO works, cause it loads AND evaluates the data.
the reason your are getting a "file-list has no value" error, is that
'file-list is never bound (given actual meaning within a context), since the
set-word isn't evaluated.
what you really want to do is this (I think):
in your file:
(note the comments are not needed, I put them here, just for clarity of the
mail.)
;------------------------------
%index.htm
%index1.htm
%logo150.gif
%logo_fromJan.gif
%WintixManual.pdf
;----------------------------------
and the script:
;----------------------------------
rebol [
title: "load file example"
]
dir: %/c/folder/
file-list: load %file-list.rdata ; the extension isn't important, I just use
this to separate scripts from data in my folders
foreach path file-list [
; use join, cause append will modify the dir itself
file-path: join dir path
?? file-path
]
ask "press enter to quit"
;----------------------------------
Note I use file! types directly and it works
hope this helps :-)
-MAx
On Tue, Feb 26, 2008 at 10:38 AM, Steven White <swhite-ci.bloomington.mn.us>
wrote:
[5/6] from: nick1::musiclessonz::com at: 26-Feb-2008 23:34
Hi Steven,
When you load that file, all the data gets enclosed a block. Assign a
label to that data, when you load it - _not_ within the saved block.
i.e., you could save your %file-list as:
index.htm
index1.htm
logo150.gif
logo_fromJan.gif
WintixManual.pdf
Load it:
file-list: load %file-list
If you loop through the block using "to-file":
foreach file file-list [probe to-file file]
You get:
%index.htm
%index1.htm
%logo150.gif
%logo_fromJan.gif
%WintixManual.pdf
== %WintixManual.pdf
If you wanted to print each file:
foreach file file-list [print read to-file file]
To append a directory:
foreach file file-list [print rejoin [%/mydir/ file]]
On Tue, Feb 26, 2008 at 10:38 AM, Steven White <swhite-ci.bloomington.mn.us>
wrote:
[6/6] from: moliad::gmail::com at: 27-Feb-2008 15:50
Nick,
I don't want to sound like an ass, but the file as you presetn it will load
back as a list of words:
== [index.htm
index1.htm
logo150.gif
logo_fromJan.gif
WintixManual.pdf
]
now in this example, it will work, cause by chance, all the files actually
can be valid word labels, and (re)joining a word to a file! will work.
Steven, really should put the % characters in front of his paths, just to
prevent from a stray path from being present in the list.
and steven, one little note outside of what has been discussed so far, if
you want a path with a space inside, just enclose the path within a string,
after the %, like so:
%"/c/program dir/music-application/my song name with spaces.mp3"
hope this helps
-MAx
On Wed, Feb 27, 2008 at 2:34 AM, Nick Antonaccio <nick1-musiclessonz.com>
wrote: