I have been attempting to create a drop down with a list of names. When I select a name, I want to store it to a variable, rearrange the drop down list beginning with my stored name as the first choice.
The problem is whenever I select the name from the list and submit, the list becomes redundant. In other words I see the names appear more than once.
I can't seem to figure out why. It must be something basic I need to change. Also I may not be doing this in the most efficient manner to begin with. If there is a completely better way to do this, I would appreciate your input. Thanks again.
Code: Select all
#SingleInstance, force
names_list =
(
missy
alex
michelle
cleo
jason
)
gosub GetMyList
gui, add, DropDownList, sort vName w155, %List1%
gui, add, button, default gGo, Go
gui, show,AutoSize
return
GetMyList:
if (Name = "")
Name = alex
loop, parse, names_list, `n
{
;MsgBox % A_LoopField
if Not instr(A_LoopField, Name)
list .= A_LoopField "|"
}
List1 = %Name%||%list%
msgbox The Drop Down List order is:`n%List1%
return
Go:
gui, submit, nohide
gosub GetMyList
;GuiControl,,?
return
GuiClose:
ExitApp