Discussions related to Visual Prolog
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

Getting values of environment variables

Unread post by Ferenc Nagy »

Hi,
What is the counterpart of the envsymbol predicate of version 5.2 in the personal edition of version 7.4?
TIA, Regards,
Frank Nagy
User avatar
CalmoSoft
VIP Member
Posts: 73
Joined: 17 Oct 2006 5:49

envsymbol

Unread post by CalmoSoft »

Hi Ferenc,

Look at the 5xVIP/5xPlatformSupport/platformsupport5x/envsymbol/2.
envsymbol : (
string EnvId,
string SymbolStr)
determ (i,o).

Reads the value of an environment symbol.

Description

The envsymbol predicate searches for a symbol EnvId in the applications environment table.
If found, the value will be returned in SymbolStr; otherwise the predicate fails.
Preferably use environment::getVariable.

Regards,
Gal Zsolt
(~ CalmoSoft ~)
Attachments
envsymbol
envsymbol
envsymbol.png (85.53 KiB) Viewed 5823 times
Last edited by CalmoSoft on 1 Sep 2014 13:36, edited 7 times in total.
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

There is no environment support in the Personal Edition, only the Commercial Edition have environment support.

In the Commercial Edition the predicates to use are in the environment class.

The classes in 5xVip should only be used as "temporary migration support" for 5x projects, new code should never be based on these packages.
Regards Thomas Linder Puls
PDC
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

Workaround: check environment varaibales in batch command files

Unread post by Ferenc Nagy »

No problem. I can check existence of the environment variables in batch command files

Code: Select all

@echo Start of conpic.bat @echo Batch conversion of the given graphical file(s) @echo parameters @echo #1 input filename/mask = %1 @echo #2 output filename/mask = %2 @echo The batch file needs the environment variable @echo irfan_view showing the path to i_view32.exe.
@if "%irfan_view%" == "" goto err1

Code: Select all

@if "%1" == "%2" goto same @"%irfan_view%\i_view32.exe" "%1" /convert="%2" /cmdexit @if errorlevel 1 goto err2 pause File %1 has been successfully converted to %2. @goto fin :same pause File %1 has not been converted because input and output files are the same. @goto fin :err2 pause Conversion has failed because of "%irfan_view%\i_view32.exe" error. @goto fin
:err1
pause Conversion has failed because the environment variable "irfan_view" is undefined.

Code: Select all

:fin @echo End of conpic.bat
TIA, Regards,
Frank Nagy
Post Reply