#Filenames with blanks
10 messages in this thread
I'm sure this subject has come up before, but are there any tips on working
with variables for filenames that might have a blank in them. These
filenames can really play havic with the 'statef', 'showdir' and related
functions. The obvious solution might be to dispose of the people that put
blanks in their filenames. 🙂
—Mike, Thanks
Mike,
I think the gun is the right approach. <grin>
Trying to parse lines that contain file names is sure a mess when the
names can include spaces. I seem to remember Bill adding a paramter to
some of the functions that return lists of names so that you can specify a
different separator, such as ';'. This makes the parsing a lot easier for
those commands. I don't remember the specifics – you should probably take
a look at the documentation updates that Bill ships on the ARexx
distribution disks.
One trick that I use alot for wild-card expansion is to issue a "list
pat xxxx quick nohead" CLI command from my ARexx script, and pipe the
output from list to "execio stem foo." – this only works if you have WShell
as well as ARexx. What this does is to take the standard-output from the
list command and place the lines into the stem variable foo – foo.0 will
contain the number of lines of text contained, and foo.1 thru foo.n will
contain the lines of the command output. In this case (the list command),
each line will be a single file name (and the included space is no longer a
problem).
Hope this helps….
…BobR
Thanks, Bob. To cover all my bases I traded Email with Eric Giguere on the
subject also. He also mentioned the extra option on showdir() and statef(),
but I don't think statef would handle this character delimitor. I would
think that word() and words() would benefit from this option but it doesn't
look like they have it. Unfortunately I don't have his most recent release
v1.15 on my 2000, But fortunately I've got a new 3000 with it, but not much
specific documentation to go with it.
Bill, if you see this: Can I still upgrade to the v1.15 or whatever is
current? Do you have a recent manual in stock also? Are the prices still
current on the last notice I got – $10 for disk, $15 for manual and $5 for
shipping? Thanks.
—Mike, [D
If you're getting a list of files from showdir(), you can use the separator
character for convenience in parsing. Specify the separator as a string
pattern with the PARSE instruction and the filenames will be split apart at
the separators.
The word functions only use spaces as separators, but it's easy to map a
list of other separators to spaces with the translate function.
ARexx update disks are still available to registered users, but note that
the manual has not been revised. There's an update.doc file with
cumulative changes on the disk.
-Bill
Bill, on a slightly unrelated subject, what's the latest version of WShell
? I seem to be running V1.2 and it has a few minor problems under 2.0 (one
off hand is that it's 'zipped' size is too small)… did I miss something
in the manual? or is there a later version?
Thanks,
Keith <long time no see> Young
Keith,
There will be a new version of WShell (WShell 2.0) available shortly after
AmigaDOS 2.0 enhancer packages are released. It has many new features and
uses some of the new 2.0 facilities, but will also run under 1.3 at a
somewhat reduced level.
Registered users will be notified when the software is available.
-Bill
Thanks… looking forward to it!
Thanks, Bill. I've taken a different approach anyway now but I'll try your
suggestions also. I wrote a quick C program that returns the file names
deliminated with a line feed and return this list to the AREXX script with
execio except that I'm having problems getting the directory name variable
passed back to the command line. I'm doing this:
/* */
PARSE ARG dirname .
'dl dirname | execio stem D.'
and it looks like 'dirname' isn't recognized. This probably isn't the best
way to do it but it is all just a learning experience anyway (like life?)
so I'll do a few wrongs ways and then stumble on the right one.
Thanks for the help, Mike
Mike,
Because your variable name (dirname) is enclosed in the quotes, ARexx
won't process it as a variable reference, but will simply pass it as part
of the literal string. What you'd need to do is as follows:
'dl' dirname '| execio stem D.'
This way, the dirname is not within the quoted strings, and hence will be
"processed" by ARexx, with it's value substituted. This is then
concatenated to the preceeding string (the 'dl'), and then the remaining
string is concatenated to that. (Note that this "implied" concatenation
will place a single space character between the strings as it concatenates
them).
Hope this helps….
…BobR
Bob, it seems like I tried "dirname" outside the quotes with no luck, but
I'll try it again. Thanks,
—Mike,