Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling info from envoirnment variables in Pdox 4.x

Status
Not open for further replies.

bx1423

Programmer
May 8, 2001
14
US
I was hoping that someone could tell me that there is a way to pull data from variables set in the autoexec.bat? Specifically I want to pull the username instead of using the Username function. The reason being a problem using paradox with Novell 5.1. It likes to pull the whole user context rather than just the name.

Any help is much appreciated.


T
 
I don't know if it will be much help, but I would just read the file into the editor, zoom to the common phrase that sets the variable, parse the line with shift-select.
 
I concur. There are no PAL functions for this kind of thing, so you are restricted to either trimming out the unwanted stuff from the return of USERNAME() or alternatively put a value in each users Paradox.cfg, so that will be used as the return of USERNAME() (only valid if each user has a unique Paradox.CFG.

The suggestion to reading the autoexec.bat and using paradox commands to read info is a valid approach. You are going to have to write your own functions. See EDITOR commands in the PAL reference.

Phil
 
I have used a roundabout means by writing a batch file that creates a script which I then PLAY. If there are alot of variables that can be set by various sources, this method gets the current values. May be some issues with Win2000 or NT if you have issues shelling to DOS.

Example:
This sets 2 PARADOX variables, one named uNm to the value of the DOS environment variable called NM, the second named pcNm to a DOS variable called MACHNM. Both are converted to UPPERcase

Code:
PRINT FILE "C:\\zztemp.bat" "@echo uNm=UPPER(" + CHR(34) + "%NM%" + CHR(34) +") > C:\\zztemp.sc"

PRINT FILE "C:\\zztemp.bat" "@echo pcNm=UPPER(" + CHR(34) + "%MACHNM%" + CHR(34) +") >> C:\\zztemp.sc" ; repeat for more variables using >>

PRINT FILE "C:NUL" "" ; close the bat file

RUN NOREFRESH "C:\\zztemp.bat" ; create the zztemp.sc file

PLAY "C:\\zztemp" ; this sets uNm

RUN NOREFRESH "DEL C:\\zztemp.* > C:NUL" ; cleanup
Nathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top