How to write multiple condition branch using dopus standard function instead of js script

for example , i want to create a button that run different app depending on user's choices
the pseudo code is like below:

@Set var = {dlgchoose|choose a int :|2=2+3=3+4=4+5=5}
if ( {$var} == 2 ) {
    // run app2
} else if ( {$var} ==3 ) {
    // run app3
} else if ( {$var} == 4 ) {
    // run app4
}

i have tried these code, but not work

@if:=$var==2
// run app2
@if:common

and

=return $var==2 ? "@output:22" : ""

I also tried replace $var with {$var} and var, also not work

That seems to work:

@Set var = {dlgchoose|choose a int :|2=2+3=3+4=4+5=5}
{= if ($var == 2) $appToLaunch = "C:\Windows\System32\cmd.exe"; =}
{= if ($var == 3) $appToLaunch = "B:\Local Downloads\ReflectDLHF_7.3.5289.exe"; =}
{$appToLaunch}
2 Likes

wow,it works! thank you very very much :face_blowing_a_kiss:
Based on the code you provided, I wrote an example of multi-line commands with comments.
it means that I can write long code with {=xxx=}

{=
if($var==4){
// run app4;
$appToLaunch = "app4"
}elseif($var==5){
// run app5;
$appToLaunch="app5"
}else{
// run other app
$appToLaunch="otherApp"
}
=}

@output:{$appToLaunch}

thank you very much again :smiling_face_with_three_hearts:

2 Likes

thank you very very much :face_blowing_a_kiss: