filepro / enviroment variables / putenv

Wally Turnbull wally at tbull.com
Wed May 10 14:47:18 PDT 2006


I noticed that, in my email reader at least, the script lines did not
break properly.  Perhaps from replying to an HTML message and then
converting it to text.  In any case here it is again.  Hopefully it will
break correctly this time.

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 and 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 variable FPNAME.

While this will work and do what you requested it offers no security
since it does not prevent Joe from saying that he is Bill.  It 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 input into environment variable FPNAME
:: usage: input or input 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