`@if:$foo` doesn't work? test if a variable called "foo" has been set

@set foo = 4
dopusrt /argsmsgbox {$foo}

@if:$foo				/  @if:{$foo}		/ @ifset:$foo		/ @ifset:{$foo}
dopusrt /argsmsgbox {$foo} done

@if:else							/ @ifset:else
dopusrt /argsmsgbox {$foo} nope

2 messagebox 4 and 4 nope


url said
@if:$foo test if a variable called "foo" has been set

i do some search and find out

no @if here, only @ifset:$foo - test if a variable called "foo" has been set

but still 4 nope

try more search

the global variable

@Set Glob!:rrrrandom = 4

dopusrt /argsmsgbox {$Glob!:rrrrandom}
dopusrt /argsmsgbox {$Glob!:rrrrandom} done

dopusrt /argsmsgbox {$Glob!:rrrrandom} nope


//@Set Glob!:rrrrandom
dopusrt /argsmsgbox {$Glob!:rrrrandom} end

1st time to run it, 4, 4 nope, 4 end.
and from 2nd time, it's all 4, 4 done, 4 end.

if i let @Set Glob!:rrrrandom work, and keep test, then 1st time 4, 4 done, end. after that, all 4, 4 nope, end.

also @ifset: works.

i'm not sure is @hideif the same? i do test @hideif:Set DUAL=toggle this could work, hide the button. but not sure how to use @hideif correctly.
mention this because one thread of Leo? said @hideif only test the variable exist or not. sounds like @if:$foo

all tested in standard funtion dopus
do i miss something or completely get it wrong?

os: win 7
dopus: 13.4

All the @if tests are evaluated before the button runs. It can be used to test variables set by something else but won’t work as flow control for things you’ve set in the same button. Use scripting if you want that; it’ll be much easier and more powerful.

(You’re looking at the Opus 11 manual, which is why @if isn’t documented there. It was probably added in Opus 12. The Opus 13 manual is linked at the top right of this forum, and available in the program via the F1 key and Help menus.)

1 Like

thanks Leo. :face_with_monocle:

1 Like