This is what I normally do. This in an INCLUDE array. It lets you put in multiple start programs. It excludes V/I too unless you comment out the Optional line.
BadStart = 0
StartPAllowed = Array(UCase("SO_SalesOrder_UI"),UCase("SO_531SORRepriceOrders_UI")) 'only these 2 can run rest of script
StartPFilter = Filter(StartPAllowed, oSession.StartProgram)
StartPOK = 0 : For Each x in StartPFilter : StartPOK = 1 : Next
'Optional for allowing V/I instead of putting VIWIxx in Array: If Left(oSession.StartProgram,2) = "VI" Then StartPOK = 1
r=oScript.DebugPrint("StartPOK from Filter = " & StartPOK)
If StartPOK=0 Then BadStart=1
If BadStart = 0 Then 'continue rest of script.
------------------------------
Alnoor Cassim
Email:
alnoor.cassim@90minds.comPh:
------------------------------
Original Message:
Sent: 08-01-2022 15:26
From: Alnoor Cassim
Subject: Disable script for VI Imports
If Left(oSession.StartProgram,2) <> "VI" Then 'continue
OR
If Left(oSession.StartProgram,2) = "VI" Then Exit Sub 'will not work if re-using for a button script
You call also evaluate an array of possible Start Program's, and then if true continue with rest of script. This is what I do.
------------------------------
Alnoor Cassim
Email: alnoor.cassim@90minds.com
Ph:
------------------------------