I have the same problem, though I believe it is a bug.
First, what purpose does it server to assign a variable to the pathname of an icon or the caption on a button, especially if the variable was supplied as an index? If anything, the variable should be assigned the index seeing as it was specified as the index. Also, these variables are set even when the dialog is cancelled, not just when it is closed. Cancelling means nothing that was changed should be recorded. Thus, setting a variable on a cancel is totally innapropriate.
icon 362,45 120 19 19,$autodir(colors.icl),%auto.colors.back , noborder tab 350
sets %auto.colors.back to the index it already held AND the full path name as desrcibed by Infernal Demon above regardless of how the dialog box is closed.
I have a cancel button
button "&Cancel",61,187 413 60 25,cancel tab 201
and this is how I cancel the dialog.
Therefore, I believe this IS a bug because it happens when a cancel button is clicked. On a normal close, it is understandable that the data be saved, but not on a cancel.
The help file uses an edit as an example. I can specify an edit as such
edit %auto.base,66,67 78 260 20,autohs tab 201
and %auto.base is NOT altered when the dialog is closed.
If I add a variable to the end
edit %auto.base,66,67 78 260 20,autohs tab 201 %temp.var
%temp.var IS set to the alterred contents when the dialog is closed, but again, this is done EVEN when the dialog was cancelled.
I can understand why he would add this feature, it makes it easy to assign variables to input from the user, however, a user cannot change the caption on a button or the pathname of an icon file, therefore, it doesn't make sense that these elements would return values.
The method is also inconsistent. A variable can be supplied as a value to an edit element without it being assigned a new value (as seen above), however, when supplied to an icon as a value, it is altered anyway. I believe that variables only at the end of the element definition (as in the example in the help file) should be altered. Any variables taken in as values should not be altered. If a programmer passes a value and wants that variable changed at the end, the programmer could simply place the variable name again at the end of the definition.
Also, cancel should never alter anything implicitly. The user should decide what gets altered on a cancel, but mIRC should never change anything. Cancel's are used to close a dialog without making any alterations (just like a Windows' dialog).