Absent Member.. Absent Member..
Absent Member..
841 views

VBS in OMi - How to get parameters?

Hello,

I got some problems running perl on Windows, so I decided to translate to VBS.

the problem is that I didn't found documentation how to use VBS in OMi.

In perl I use:

To set Session variable:

$Session->Value(errors, $errors);

 

To get Source value:

my $ResGroupName2 = $Policy->Source("ResGroupName")->Value();

 

To get parameters and set to Session:

my $PolicyRegex;
$PolicyRegex = $OVOSystem->ParameterGetString("PolicyRegex","%%PolicyRegex%%");
$Session->Value("PolicyRegex", $PolicyRegex);

 

In VBS I know:

To set Session variable:

Session ("FSDrive") = drive

 

To get Source value:

Policy.Source("ResGroupName")

 

To get parameters

????

 

Someon could help me?

Regards,

Diego Pereira

Labels (1)
0 Likes
6 Replies
Micro Focus Expert
Micro Focus Expert

In OMi policies, you should just be able to use %%parameter_name%%.  Eg, in Perl:

my $minorThreshold = %%My_Minor_Threshold%%;

$Session->Value('minorThreshold', $minorThreshold);

Sorry I don't remember how to do VBScript.

CP.

0 Likes
Fleet Admiral Fleet Admiral
Fleet Admiral

Hello @Diego_Pereira

I believe you don't need $OVOSystem->ParameterGetString or equivalent VBScript syntax at all to read the parameters.

What you can do is export policy from OMW/U/L which uses $OVOSystem->ParameterGetString in it, import it to OMi and figure out the difference. i doubt that conversion will show $OVOSystem->ParameterGetString at all as parameter handing differ in OMi in compare to OMW/U/L.

I don't know if %% will cover both VBScript and perl parameter? if not then use "@@"  instead %%. i have a tool created which uses vbscript and in this i faced similar problem and it was solved by using "@@" so may work in policy too.

HTH
-KAKA-

0 Likes
Absent Member.. Absent Member..
Absent Member..

Hi KAKA_2,

Thanks for the help, but I didn't have OMW/U/L, I have only OMi.

The problem is in perl on Windows sometimes doesn't work properly, so I decided to translate the logic to VBS, but the problem is that I can get the parameters in OMi besides I don't know the sintax to use as I mentioned in the topic.

So I need to know how to get the parameters using VBS.

0 Likes
Fleet Admiral Fleet Admiral
Fleet Admiral

Hello Diego,

have you tried what Carol proposed? OMi just replaces the parameter if you embedd it via %%.

E.g. in vbs
ParameterValue = "%%PARA1%%"

Kind regards,
Harald

0 Likes
Fleet Admiral Fleet Admiral
Fleet Admiral

@Diego_Pereira
use

Session("PolicyRegex") = %%PolicyRegex%%

for your VB Script.

 

another option you have is to create the parameter using GUI available in policy editor and then you can drag and drop in your policy as per your need. GUI provide other advance option like setting up the data type and so.

VBS_parm.PNG

Hope this helps.
-KAKA-

0 Likes
Absent Member.. Absent Member..
Absent Member..

I tried using what you said, but I think I got other problem, I will try using a simple example to test and I will let you know and accept as solution if worked.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.