filepro / enviroment variables / putenv

Wally Turnbull wally at tbull.com
Wed May 10 14:35:39 PDT 2006


Rick Mitchell asked:

<<I would like to have a login processing that asks the person for their
name and passes it to the environment variable on the pc.  I am
successful in passing it and reading it in the same table, but once I
exit that filepro dclerk session the variable seems to be lost.>>

1. copy save the cmd script below as fpname.cmd

2. insert the line fpname [ucase] into the batch file you use to start
filePro to put the user's response into the varilable FPNAME.

While this will work and do what you reqested it offers no security
since it does not prevent Joe from saying that he is Bill.  I would be
better to use Windows profiles and pick up the Windows Username.

Nevertheless this does have the value of demonstrating a way to set
environment variables from a batch file.

Best,
Wally Turnbull


:: FPName.cmd - Put user response into environment variable FPNAME
:: usage: fpname or fpname ucase for uppercase
@ECHO off
SETLOCAL
SET v_vbs=%TEMP%\~tmp.VBS
SET v_cmd=%TEMP%\~tmp.cmd
ECHO Set oFS=CreateObject("Scripting.FileSystemObject")>%v_vbs%
ECHO oFS.OpenTextFile("CON",2).Write "Login Name: ">>%v_vbs%
ECHO S=%1(Trim(oFS.OpenTextFile("CON",1).Readline))>>%v_vbs%
ECHO oFS.CreateTextFile("%v_cmd%",2).Write "set uinput=">>%v_vbs%
ECHO oFS.OpenTextFile("%v_cmd%",8).Write S>>%v_vbs%
cscript.exe //nologo %v_vbs%
CALL %v_cmd%
DEL %v_vbs%
DEL %v_cmd%
SET uinput
ENDLOCAL & SET FPNAME=%uinput%




More information about the Filepro-list mailing list