I am currently writing a script that is utilizing the "ListBox" function. The problem I am having is that I have more than one item in my list box. I want to have each item do its own function while you choose it and click the button to make it execute. I wrote an example below, its not the best but it gives a better idea on what I am trying to accomplish.
Thank you!
Code: Select all
#SingleInstance, Force
LBContents =
( Join|
Trench Coat Soilder
)
LBContents1 =
( Join|
XOF Soilder
)
;size and lbcontents code blow
Gui, Add, ListBox, vMyListBox gMyListBox w350 r15 x10 y90, %LBContents%|%LBContents1%
;button to execute command
Gui, Add, Button, gHALButton2 x10 y300 w350 h30, Copy Contents to Clipboard
;random box
Gui, Add, Edit, x10 y350 w350 h30
Gui, Show
return
; end of auto-execute section
MyListBox:
{
if A_GuiEvent <> DoubleClick
return
return
; end of MyListBox subroutine
}
; THIS IS WHERE I WANT THE EXECUTION TO START WHEN YOU PRESS THE BUTTON
;
HALButton2:
{
Gui, Submit, NoHide
ControlGet, List1, List, , ListBox1
}
ControlGet, ChooseString, %LBContents% = 1
;then
MsgBox, okay
{
; AFTER THIS , IF I WANT TO CHOOSE ITEM NUMBER TWO PREFORM ITS OWN FUNCTION.
; HOWEVER IT WILL GO TO TWO MESSAGES IN STEAD OF ONE.
ControlGet, ChooseString, %LBContents1% = 1
;IF I CHOOSE SECOND OPTION THEN BEGIN SCRIPT BELOW FOR THAT OPTION
MsgBox, okay 2
}
return
Guiclose:
exitapp