Jump to content

Can't get combobox value


Recommended Posts

I'm building a autoskill script for a game online, script will use(click) a skill then delay serveral seconds...

But i'm troubling with get the value of combobox, it's only return the default value :) , Plz help ^_^

you can see my script below, in current script, you can test it by selecting at combobox number 4(Use skill # line 4), then press Save button

#include <GuiConstants.au3>
; GUI
GuiCreate("AutoSkill 1.0", 190, 244)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)
; start button
$btnStart = GUICtrlCreateButton("&Start", 15, 190, 73, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetTip(-1, "Start AutoSkill")
; vertical line
GUICtrlCreateLabel('', 93, 193, 2, 20, $SS_SUNKEN)
; save button
$btnSave = GUICtrlCreateButton("S&ave", 100, 190, 73, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetTip(-1, "Save your settings")
; horizontal line
GUICtrlCreateLabel('', 8, 220, 176, 2, $SS_SUNKEN)
; copyright infomation
; TAB
; attack tab
GuiCtrlCreateTab(0, 0, 200, 185)
$attTab = GuiCtrlCreateTabItem("Attack")
; items
GUICtrlCreateLabel("Use skill #", 3, 32, 53, 17)
$cboSk1 = GUICtrlCreateCombo("", 60, 28, 41, 18,$CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "1")

GUICtrlCreateLabel("Delay", 110, 32, 53, 17)
$txt1 = GUICtrlCreateInput("1", 150, 28, 20, 18)
GUICtrlCreateLabel("s", 178, 32, 53, 17)
; paragraph 2
GUICtrlCreateLabel("Use skill #", 3, 62, 53, 17)

$cboSk2 = GUICtrlCreateCombo("", 60, 58, 41, 18,$CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "2")

GUICtrlCreateLabel("Delay", 110, 62, 53, 17)
$txt2 = GUICtrlCreateInput("1", 150, 58, 20, 18)
GUICtrlCreateLabel("s", 178, 62, 53, 17)
; paragraph 3
GUICtrlCreateLabel("Use skill #", 3, 92, 53, 17)

$cboSk3 = GUICtrlCreateCombo("", 60, 88, 41, 18,$CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "3")

GUICtrlCreateLabel("Delay", 110, 92, 53, 17)
$txt3 = GUICtrlCreateInput("1", 150, 88, 20, 18)
GUICtrlCreateLabel("s", 178, 92, 53, 17)
; paragraph 4
GUICtrlCreateLabel("Use skill #", 3, 122, 53, 17)

$cboSk4 = GUICtrlCreateCombo("", 60, 118, 41, 18,$CBS_DROPDOWNLIST)
GUICtrlSetData($cboSk4, "0|1|2|3|4|5", "4")

GUICtrlCreateLabel("Delay", 110, 122, 53, 17)
$txt4 = GUICtrlCreateInput("1", 150, 118, 20, 18)
GUICtrlCreateLabel("s", 178, 122, 53, 17)
; paragraph 5
GUICtrlCreateLabel("Use skill #", 3, 152, 53, 17)

$cboSk5 = GUICtrlCreateCombo("", 60, 148, 41, 18,$CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "5")

GUICtrlCreateLabel("Delay", 110, 152, 53, 17)
$txt5 = GUICtrlCreateInput("1", 150, 148, 20, 18)
GUICtrlCreateLabel("s", 178, 152, 53, 17)


; end attack tab
$buffTab = GuiCtrlCreateTabItem("Buff")
$otherTab = GuiCtrlCreateTabItem("Other")

; GUI MESSAGE LOOP
GuiSetState()
$cboVal1 = GUICtrlRead($cboSk4, 1)
While 1
    $guiEvent = GuiGetMsg()
    Select
        Case $guiEvent = $GUI_EVENT_CLOSE
        ExitLoop
        Case $guiEvent = $btnSave
        MsgBox(0,"Result","Value of combobox 4 => " & $cboVal1)
    EndSelect
WEnd
Link to comment
Share on other sites

This should work..

#include <GuiConstants.au3>
; GUI
GuiCreate("AutoSkill 1.0", 190, 244)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)
; start button
$btnStart = GUICtrlCreateButton("&Start", 15, 190, 73, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetTip(-1, "Start AutoSkill")
; vertical line
GUICtrlCreateLabel('', 93, 193, 2, 20, $SS_SUNKEN)
; save button
$btnSave = GUICtrlCreateButton("S&ave", 100, 190, 73, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetTip(-1, "Save your settings")
; horizontal line
GUICtrlCreateLabel('', 8, 220, 176, 2, $SS_SUNKEN)
; copyright infomation
; TAB
; attack tab
GuiCtrlCreateTab(0, 0, 200, 185)
$attTab = GuiCtrlCreateTabItem("Attack")
; items
GUICtrlCreateLabel("Use skill #", 3, 32, 53, 17)
$cboSk1 = GUICtrlCreateCombo("", 60, 28, 41, 18,$CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "1")

GUICtrlCreateLabel("Delay", 110, 32, 53, 17)
$txt1 = GUICtrlCreateInput("1", 150, 28, 20, 18)
GUICtrlCreateLabel("s", 178, 32, 53, 17)
; paragraph 2
GUICtrlCreateLabel("Use skill #", 3, 62, 53, 17)

$cboSk2 = GUICtrlCreateCombo("", 60, 58, 41, 18,$CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "2")

GUICtrlCreateLabel("Delay", 110, 62, 53, 17)
$txt2 = GUICtrlCreateInput("1", 150, 58, 20, 18)
GUICtrlCreateLabel("s", 178, 62, 53, 17)
; paragraph 3
GUICtrlCreateLabel("Use skill #", 3, 92, 53, 17)

$cboSk3 = GUICtrlCreateCombo("", 60, 88, 41, 18,$CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "3")

GUICtrlCreateLabel("Delay", 110, 92, 53, 17)
$txt3 = GUICtrlCreateInput("1", 150, 88, 20, 18)
GUICtrlCreateLabel("s", 178, 92, 53, 17)
; paragraph 4
GUICtrlCreateLabel("Use skill #", 3, 122, 53, 17)

$cboSk4 = GUICtrlCreateCombo("", 60, 118, 41, 18,$CBS_DROPDOWNLIST)
GUICtrlSetData($cboSk4, "0|1|2|3|4|5", "4")

GUICtrlCreateLabel("Delay", 110, 122, 53, 17)
$txt4 = GUICtrlCreateInput("1", 150, 118, 20, 18)
GUICtrlCreateLabel("s", 178, 122, 53, 17)
; paragraph 5
GUICtrlCreateLabel("Use skill #", 3, 152, 53, 17)

$cboSk5 = GUICtrlCreateCombo("", 60, 148, 41, 18,$CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "5")

GUICtrlCreateLabel("Delay", 110, 152, 53, 17)
$txt5 = GUICtrlCreateInput("1", 150, 148, 20, 18)
GUICtrlCreateLabel("s", 178, 152, 53, 17)


; end attack tab
$buffTab = GuiCtrlCreateTabItem("Buff")
$otherTab = GuiCtrlCreateTabItem("Other")

; GUI MESSAGE LOOP
GuiSetState()
While 1
    $guiEvent = GuiGetMsg()
    Select
        Case $guiEvent = $GUI_EVENT_CLOSE
        ExitLoop
    Case $guiEvent = $btnSave
        $cboVal1 = GUICtrlRead($cboSk4, GUICtrlRead($cboSk4))
        MsgBox(0,"Result","Value of combobox 4 => " & $cboVal1)
    EndSelect
WEnd
Link to comment
Share on other sites

#include <GuiConstants.au3>
; GUI
GUICreate("AutoSkill 1.0", 190, 244)
GUISetIcon(@SystemDir & "\mspaint.exe", 0)
; start button
$btnStart = GUICtrlCreateButton("&Start", 15, 190, 73, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetTip(-1, "Start AutoSkill")
; vertical line
GUICtrlCreateLabel('', 93, 193, 2, 20, $SS_SUNKEN)
; save button
$btnSave = GUICtrlCreateButton("S&ave", 100, 190, 73, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetTip(-1, "Save your settings")
; horizontal line
GUICtrlCreateLabel('', 8, 220, 176, 2, $SS_SUNKEN)
; copyright infomation
; TAB
; attack tab
GUICtrlCreateTab(0, 0, 200, 185)
$attTab = GUICtrlCreateTabItem("Attack")
; items
GUICtrlCreateLabel("Use skill #", 3, 32, 53, 17)
$cboSk1 = GUICtrlCreateCombo("", 60, 28, 41, 18, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "1")

GUICtrlCreateLabel("Delay", 110, 32, 53, 17)
$txt1 = GUICtrlCreateInput("1", 150, 28, 20, 18)
GUICtrlCreateLabel("s", 178, 32, 53, 17)
; paragraph 2
GUICtrlCreateLabel("Use skill #", 3, 62, 53, 17)

$cboSk2 = GUICtrlCreateCombo("", 60, 58, 41, 18, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "2")

GUICtrlCreateLabel("Delay", 110, 62, 53, 17)
$txt2 = GUICtrlCreateInput("1", 150, 58, 20, 18)
GUICtrlCreateLabel("s", 178, 62, 53, 17)
; paragraph 3
GUICtrlCreateLabel("Use skill #", 3, 92, 53, 17)

$cboSk3 = GUICtrlCreateCombo("", 60, 88, 41, 18, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "3")

GUICtrlCreateLabel("Delay", 110, 92, 53, 17)
$txt3 = GUICtrlCreateInput("1", 150, 88, 20, 18)
GUICtrlCreateLabel("s", 178, 92, 53, 17)
; paragraph 4
GUICtrlCreateLabel("Use skill #", 3, 122, 53, 17)

$cboSk4 = GUICtrlCreateCombo("", 60, 118, 41, 18, $CBS_DROPDOWNLIST)
GUICtrlSetData($cboSk4, "0|1|2|3|4|5", "4")

GUICtrlCreateLabel("Delay", 110, 122, 53, 17)
$txt4 = GUICtrlCreateInput("1", 150, 118, 20, 18)
GUICtrlCreateLabel("s", 178, 122, 53, 17)
; paragraph 5
GUICtrlCreateLabel("Use skill #", 3, 152, 53, 17)

$cboSk5 = GUICtrlCreateCombo("", 60, 148, 41, 18, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "0|1|2|3|4|5", "5")

GUICtrlCreateLabel("Delay", 110, 152, 53, 17)
$txt5 = GUICtrlCreateInput("1", 150, 148, 20, 18)
GUICtrlCreateLabel("s", 178, 152, 53, 17)


; end attack tab
$buffTab = GUICtrlCreateTabItem("Buff")
$otherTab = GUICtrlCreateTabItem("Other")

; GUI MESSAGE LOOP
GUISetState()

While 1
    $guiEvent = GUIGetMsg()
    Select
        Case $guiEvent = $GUI_EVENT_CLOSE
            ExitLoop
        Case $guiEvent = $btnSave
            $cboVal1 = GUICtrlRead($cboSk4, 1)
            MsgBox(0, "Result", "Value of combobox 4 => " & $cboVal1)
    EndSelect
WEnd

8)

NEWHeader1.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...