dcooman wrote: ↑October 18th, 2018, 12:05 pm
I have e problem:
if the regkey Test = ok then text has to be "ok"
if the regkey Test does not exist or 0 then tekst has te be "Nok"
Code: Select all
[Computer_zone]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\Example
RegValue=Test
IfCondition=(computer_zone = ok)
IfTrueAction=[!SetOption computer_text Text "OK"]
IfCondition2=(zenworks_zone = 0)
IfTrueAction2=[!SetOption computer_text Text "NOK"]
You do not define "zenworks_zone", so I am not sure what you are testing in IfCondition2
IfCondition can only test numeric values. In order to test character matches you need to use
IfMatch.
Try this code:
Code: Select all
[Computer_zone]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\Example
RegValue=Test
IfMatch=(?i).*ok.*
IfMatchAction=[!SetOption computer_text Text "OK"]
IfMatch2=^$
IfMatchAction2=[!SetOption computer_text Text "NOK"]
IfCondition=(Computer_zone = 0)
IfTrueAction=[!SetOption computer_text Text "NOK"]
[computer_text]
Meter=String
FontSize=12
FontColor=255,255,255
The
IfMatch=(?i).*ok.* will test the current measure string value for the letters "ok" (case insensitive) and set the text value to "OK" if there is a match.
The
IfMatch2=^$ will test the current measure string value for an empty string and set the text to "NOK" if the string is empty.
The IfCondition will test the number value of [Computer_zone] and set the text to "NOK" if the value is zero.
Note that IfMatch test the string value of the measure it is in, while the IfCondition can test ANY measure you specify no matter which measure it is coded in.
The code works on my PC, but as noted, I am not sure what 'zenworks_zone" is...