DO12 - Test if option or argument enable

I try to understand what’s happen.
In script, I want to display something in log when TEST_OPTION is disable or TEST_ARG is missing.
I test a negative and positive condition and results are different.

Negative : If script.config.TEST_OPTION = false or funcData.func.args.got_arg.TEST_ARG = false Then… Positive : If script.config.TEST_OPTION = true or funcData.func.args.got_arg.TEST_ARG = true Then…
Now, please test command without argument with option enable.
And test command with argument but option disable.

Why results are different ?

[code]Option Explicit

Function OnInit(initData)
initData.name = "Command_Test"
initData.min_version = "12"
InitData.group = "++ Test ++"
initData.default_enable = True
initData.config.TEST_OPTION = True
End Function

Function OnAddCommands(addCmdData)
Dim cmd: Set cmd = addCmdData.AddCommand()
cmd.name = "Test"
cmd.method = "OnTest"
cmd.template = "TEST_ARG/S"
End Function

Function OnTest(funcData)

Dopus.clearOutput

Dopus.OutputString "-----------------------------------"	
Dopus.OutputString "Option : TEST_OPTION = " & script.config.TEST_OPTION
Dopus.OutputString "Argument : TEST_ARG/S = " & funcData.func.args.got_arg.TEST_ARG
Dopus.OutputString "-----------------------------------"	

' Test 1 : negative condition
If script.config.TEST_OPTION = false or funcData.func.args.got_arg.TEST_ARG = false Then
Dopus.OutputString "Test 1 : NO option NOR argument", true
Else
Dopus.OutputString "Test 1 : Option OR argument", true
end if

' Test 2 : positive condition
If script.config.TEST_OPTION = true Or funcData.func.args.got_arg.TEST_ARG = true Then
Dopus.OutputString "Test 2 : Option OR argument", true
Else
Dopus.OutputString "Test 2 : NO option NOR argument", true
end if

End Function[/code]

The results are different because of normal boolean logic, I think. Maybe I'm missing a detail.

What are you expecting the results to be?

If script.config.TEST_OPTION = false or funcData.func.args.got_arg.TEST_ARG = false Then Dopus.OutputString "Test 1 : NO option NOR argument", true

That tests if either or both are false. Did you want "and" instead of "or" so it only tests if both are false?

I want if option is false OR no argument.

It tests that correctly as far as I can tell.

Please give details of what you expect to see vs what you actually see.

Ok, I have this condition…

' Test 1 : negative condition If script.config.TEST_OPTION = false or funcData.func.args.got_arg.TEST_ARG = false Then Dopus.OutputString "Test 1 : NO option NOR argument", true Else Dopus.OutputString "Test 1 : Option OR argument", true end if

If option is set to Yes and I run command Test
=> NO option NOR argument. Option is enable, so why ?

If option is set to Yes and I run command Test TEST_ARG
=> Option OR argument. Ok for me.

If option is set to No and I run command Test
=> NO option NOR argument. Ok for me.

If option is set to No and I run command Test TEST_ARG
=> NO option NOR argument. Argument is presents, so why ?

Let's simplify things, and correct the output strings:

If A = false or B = false Then Dopus.OutputString "A is false or B is false. Possibly both A and B are false at once." Else Dopus.OutputString "A is not false. B is not false either. Neither A nor B are false. A and B must both be true." end if

Does it makes sense now?

I think you just want "and" instead of "or".