Global Variable problem

The first time this button is run it works as expected. The problem is that on subsequent runs, the FIND command is using the value of $glob:MyVar from before the button is clicked (acting as if the @SET command had not been run), however the /ARGSMSGBOX command displays what I expect (whatever I just entered into the dialog for @SET).

@set $glob:MyVar="{dlgstringS|Enter search term}"
dopusrt /argsmsgbox {$glob:MyVar}
Find {$glob:MyVar} IN {sourcepath$} 

As a workaround, I put the FIND command into a new user-defined command, and call that command instead of FIND.

Here's a workaround that doesn't need anything in a separate command. Use a local variable for everything in the button itself, and set the global variable to the local one (assuming some other things needs the global variable; if not, you can skip that entirely).

@set MyVar="{dlgstringS|Enter search term}"
@set glob:MyVar={$MyVar}
dopusrt /argsmsgbox {$MyVar}
Go {$MyVar}
1 Like