From: "Chris Antos (Exchange)"
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
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|