From: "Chris Antos (Exchange)"
right. so if you're not using environment variables, then try the other
thing i suggested. write your own routine to parse the user's string and
replace things in it. there has never been any other way to do such things.
obviously, a string will not magically get updated with correct values
replacing STATION because this is an invented semantic. so psuedo code for
a routine would be something like:
string stUser
string stTemp
prompt user, put user's response in stUser.
loop thru files, for each file:
stTemp = stUser
walk thru stTemp looking for the replacement character you define
when found, take the word following it and look it up
(to find end of word, save off the index where
the word begins, then walk forward some more
looking for whatever you define as end of word)
replace the word in stTemp with the looked-up value
eg, use DelStr and InsStr
Dos(stTemp)
endloop
//chris
-----Original Message-----
From: Ciccotto, Domenick (Exchange) [mailto:DCICCOTTO@Bear.COM]
Sent: Thursday, March 26, 1998 2:16 PM
To: Chris Antos (Exchange); 'Dom Ciccotto'; Semware
Subject: RE: UPDATING variables within a ASK() String
STATION is NOT an environment variable it is simply one line from
a List of stations (Text File) as shown below.
proc main
EditFile() <--- Loads the list of stations
end
The idea is to load a text file with station names then Hit a key
to pop-up a list of tasks, pick the Task(s) to do.
Position your cursor on the list.
The second key (F5) says... Single station, Next x stations, rest of
list.
This works perfectly for about 25 of the most boring tasks.
But when I tried to get fancy and made an entry of
"RUN A Command Line Util Against the List."
I found my self with the problem originally stated.
If I go into the macro and "Hard code" the DOS() command with a string
and my variable station.....
DOS("DIR "+ rSTATION + "C$\*.*")
NO PROBLEM.
But when I try to do a "ON THE FLY" ASK("ENTER Command : ", myCOMMAND)
and try to do a DOS(myCOMMAND) the "STATION" within the string
myCOMMAND never gets updated (as it goes down the list of stations).
How can I reEval / Freshen a string ???
String = "DIR "+ rSTATION + "C$\*.*"
Thanks
Dom Ciccotto
> -----Original Message-----
> From: Chris Antos (Exchange) [SMTP:chrisant@Exchange.MICROSOFT.com]
> Sent: Thursday, March 26, 1998 4:38 PM
> To: 'Dom Ciccotto'; Semware
> Subject: RE: UPDATING variables within a ASK() String
>
> i think you mean "%" not "&". if "STATION" is an environment variable
> set
> to "foo", then DOS("dir %STATION\*.*") would be executed as "dir
> foo\*.*".
> is that what you mean?
>
> or you can write a routine that goes thru your string and looks for
> "&"
> and replaces it with the value of GetGlobalStr("") or with
> GetEnvVar("")? then the user could generically enter any command
> such
> as "dir &WHIFFO &JACKO &PLUGH" and each of those would be replaced
> with the
> appropriate thing. but i think simplest is to simply use the built-in
> DOS
> functionality of replacing %FOO with the value of the environment
> variable
> FOO.
>
> //chris
>
>
>
>
> -----Original Message-----
> From: Dom Ciccotto [mailto:dciccotto@worldnet.att.net]
> Sent: Thursday, March 26, 1998 4:10 AM
> To: Semware
> Subject: UPDATING variables within a ASK() String
>
>
> The following has been a nagging problem.
>
> How to update a string (taken from the ASK function) which has
> variables built into it.
>
> I hope the following makes sense.
> It is the outline of a macro which I use to perform many tasks against
> a list of NT workstations/servers.
> ============================================
>
> proc main
>
>
> EditFile() <--- a Load the list of stations
> end
>
> What I do
> =======
> I get a station name and store it to STATION and rSTATION
> (rSTATION= "\\"+STATION+"\")
> The Task Menu is then used to Turn on/off things like:
> Check Backup Logs, Check Time/Date on "Key" files,
> Running command line utils substituting in the station name ....etc.
>
> What I have not been able to do.
> ======================
> If I Hit and choose "Run a DOS Command Line Against
> the Station List. The only way I've been able to do it is.
>
> ASK( "Enter Your PRE-Station Command : ", PreStationCommand )
> ASK( "Enter Your Post-Station Command : ", PostStationCommand )
>
> Then when I Hit it loops the list running
> DOS( PreStationCommand+" " + rSTATION + PostStationCommand)
> Simple example:
> PreStationCommand="DIR" PostStationCommand= "C$\*.*"
>
> HOW CAN I TYPE SOMETHING IN ASK() AND HAVE IT UPDATE
>
> In early DOS programs it was called Macro Substitution and used a "&".
>
> The command string would be Command="DIR &STATION\C$\*.*"
> and then the program would run DOS(Command)
>
>
> Dom Ciccotto
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
--
****************************************************************************
***
Bear Stearns is not responsible for any recommendation, solicitation, offer
or
agreement or any information about any transaction, customer account or
account
activity contained in this communication.
****************************************************************************
***
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|