SetConsole('HIDE')
; Declaring Global variables
;
Dim $PZB ; defines what PZB path will be set within CER.ini
Dim $Path ; User path string
Dim $CER1 ; defines where the CER.ini base file is stored
Dim $CER2 ; defines the environment folder
Dim $CER3 ; defines the environment folder for the CER.ini
Dim $CER4 ; defines where the CER.ini file is saved to, and looked for
Dim $PFX ; defines the value for PFX for claimsview
Dim $MENU ; defines the value for Menu for claimsview
Dim $MaxSession ; Maximum number of allowed sessions
Dim $App ; defines the EXE to be Run
Dim $Message ; message header
Dim $TaskList ; command to return list of user tasks
Dim $aResult ; array containing STDOUT and STDERR arrays
Dim $Rc ; Return code catcher
;
Call 'c:\scripts\WshPipe.udf' ; Places a call to a script that helps identify running user EXE's.
;
$Rc = SetOption('NoVarsInString', 'On')
$Rc = SetOption('NoMacrosInString', 'On')
;
$pzb = '\\root\Production$'
$Path = '\\root\userconfigs$\' + @Userid
$cer1 = '\\root\cer$'
$cer2 = '\Production'
$cer3 = $Path + $cer2
$cer4 = $cer3 + '\cer.ini'
$pfx = '0001'
$Menu = 'Y'
$MaxSession = 2
$App = 'c:\appname\app\app.exe'
$Message = ' You are not allowed to run more than two copies of OurApp. '
$Tasklist='tasklist /FI "Username eq %USERDOMAIN%\%USERNAME%" /FI "Imagename eq App.exe"'
$aResult=WshPipe($Tasklist)
;
; Checking for Cer.ini, copy it if it's not there
;
IF NOT Exist ($Path)
MD $Path
EndIf
;
If NOT Exist ($cer4)
MD $cer3
copy $cer1 + '\cer.ini' $cer3
WriteProfileString($cer4, 'System', 'PzbPath', $pzb)
WriteProfileString($cer4, 'CLAIMVIEW', 'PFX', $pfx)
writeProfileString($cer4, 'CLAIMVIEW', 'MENU', $Menu)
EndIf
;
;
If UBound($aResult[0]) < ($MaxSession +3)
Run "$App $cer4"
Else
MessageBox ("$Message"," ***You are not allowed to run more than two App sessions*** ",0,10)
EndIf
;
;
Exit 0