| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: REXX - Light My String ? |
Don{ald} O. Woodall schrieb:
> Hello REXX Programmers
>
> Well, so far, I am not yet perceiving any ideas on how to do the
> latest programming project.
>
> /* The name of this file is: QSIDN.cmd
> */ /* Quote Space In Directory Name
> */ /*
> */
>
> /* This program reads in a file created by the command
> */ /* DIR H:\APPS\* /F/A:D/S
> */ /* and searches for directory names with spaces or other unusual
> */ /* characters that require the directory name to be in quotes so
> */ /* a REXX program can correctly create / write the directory name.
> */
>
> /* QSIDN.CMD is (C)copyright by Donald O. Woodall 2005
> */ /* all rights reserved */
> /* ---------------------------------------------------
> */
>
> SAMPLE SOURCE LINEIN
> --------------------
> 'md OS2\ARCHIVES\0X\DESKTOP\Local System\System Setup\Appearance\
> Extended Menu Options\~Command prompts'
>
> PROCESSED LINEOUT
> -----------------
> 'md OS2\ARCHIVES\0X\DESKTOP\"Local System"\"System
Setup"\Appearance\
> "Extended Menu Options"\"~Command prompts"'
>
> OH
> --
> I think i just had a revelation. ???
>
> Only the last directory name needs to be in quotes - IF it has spaces
> or unusual characters in its name: because it is the only directory being
> made!
>
> SOME PSEUDO CODE
> ----------------
>
> SELECT
> /* ---------------------------------------------------------------- */
> WHEN exists " " in dirname THEN dirname = "dirname"
>
> /* ---------------------------------------------------------------- */
> WHEN exists "'" in dirname THEN dirname = "dirname"
>
> /* ---------------------------------------------------------------- */
> WHEN exists "^" in dirname THEN dirname = "dirname"
>
> /* ---------------------------------------------------------------- */
> WHEN exists "&" in dirname THEN dirname = "dirname"
>
> /* ---------------------------------------------------------------- */
> WHEN exists "!!" in dirname THEN dirname = "dirname"
>
> /* ---------------------------------------------------------------- */
> OTHERWISE
> DO
> noquote = noquote + 1
> END /* OTHERWISE DO */
>
> Well, I got some movement writing the note, but I am not there yet.
>
> Thanks
>
Make things so simple as possible:
/* create given directory */
parse upper arg() path /* give the whole path */
/* may or may not contain spaces */
/* a b c.de . ext -on commandline gives */
/* A B C.DE . EXT in path */
/* left off upper when you likes to get */
/* the path as given */
cl = "" /* WARP4 or for eCS */
position = "" /* object ID or full qualified path */
/* of the folder the new folder should be created in */
option = "FAIL" /* do nothing when folder already exists */
/* "REPLACE" will the folder remove and then
create if it exists alread; "UPDATE" will create if it does NOT exist
or update its settings when it exists already */
rc = SysCreateObject(cl, path, position, option)
if rc = 1 then say "folder created"
else say "folder exists or create failed"
-+-+-+-
In contrast of typing a path on commandline this API accepts spaces
and other chars as a single path without quoting
When you have to create an object in a folder that does NOT exist you
would have to create that folder prior:
newpath = path
p = 0 /* init */
if substr(path, 2, 1) = ':' then do
/* handle drive (x:\.... *)
p = pos(substr(path, 4, length(path)-4)))
if p > 0 then
newpath = substr(path, 1, p-1)
end
rc = syscreateobject(cl, newpath, , "U")
p1 = p+1
do forever
pa = pos('\', substr(path, p1, length(path)-p1))
if (pa = 0) leave
newpath2 = substr(path, p1, pa-1)
rc = syscreateobject(ca, newpath2, newpath, 'U')
newpath = newpath2
end
attention: untested!
When you runs eCS you can look at the setting parameters of an object
by open settings swith to page titled "symbol" and click on details
there. This would help you to find the object ID of a folder you will
create an object in.
--
Tschau/Bye
Herbert Rosenau eCS 1.2 Deutsch bestellen bei
EDV Beratung & Programmierung http://pc-rosenau.de
Eichelsdorfer Str. 15 http://ecomstation.de
97461 Hofheim i.UFr.
Tel: 49-9523-502834
Fax: 49-9523-502823 http://www.dv-rosenau.de/
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/os2user/
To unsubscribe from this group, send an email to:
os2user-unsubscribe{at}yahoogroups.com
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
---
* Origin: Waldo's Place USA Internet Gateway (1:3634/1000)SEEN-BY: 633/267 270 5030/786 @PATH: 3634/1000 12 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.