PDA

Показать полную графическую версию : [решено] использование данных из Combobox


VNRed_OK
11-02-2013, 20:37
Извиняюсь ,возможно, за простой вопрос. Только начинаю. Как бы подставить данные из Combo в место ХХ в скрипт:

#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Example()
Func Example()
Local $tab, $tab0, $tab0OK, $tab0input,$msg
Local $tab1, $tab1combo, $tab1OK,$tab11K

GUICreate("My GUI Tab",300,150) ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100)

$tab0 = GUICtrlCreateTabItem("Connect")
$tab0OK = GUICtrlCreateButton("Connect", 20, 50, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 80, 50,80,120)
GUICtrlSetData(-1, "73|74|75|", "SIEMENS")
Case $tab0OK
WinActivate ("Patty")
Send ("Telnet 10.10.10.XX")

$tab1 = GUICtrlCreateTabItem("DATA")
GUICtrlCreateLabel("Плата-Порт", 30, 80, 80, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 50, 40, 120)
GUICtrlSetData(-1, "1|2|3|4|5", "")
$tab1combo = GUICtrlCreateCombo("", 70, 50, 40, 120)
GUICtrlSetData(-1, "1|2|3|4|5", "")
$tab1OK = GUICtrlCreateButton("SNR", 120, 50, 50, 20)
$tab11K = GUICtrlCreateButton("SPEED", 120,80, 60, 20)

GUISetState()

While 1
$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
EndFunc

Creat0R
12-02-2013, 02:51
VNRed_OK, Код принято заключать в соответствующий тег (http://forum.oszone.net/misc.php?do=bbcode#code).

Возможно это нужно:

#include (http://autoit-script.ru/autoit3_docs/keywords.htm##include) <GUIConstantsEx.au3>

Opt (http://autoit-script.ru/autoit3_docs/functions/Opt.htm)('MustDeclareVars', 1)

Example()

Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) Example()
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $tab, $tab0, $tab0OK, $tab0input, $msg
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $tab1, $tab1combo, $tab1OK, $tab11K

GUICreate (http://autoit-script.ru/autoit3_docs/functions/GUICreate.htm)("My GUI Tab", 300, 150) ; will create a dialog box that when displayed is centered

GUISetBkColor (http://autoit-script.ru/autoit3_docs/functions/GUISetBkColor.htm)(0x00E0FFFF)
GUISetFont (http://autoit-script.ru/autoit3_docs/functions/GUISetFont.htm)(9, 300)

$tab = GUICtrlCreateTab (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateTab.htm)(10, 10, 200, 100)

$tab0 = GUICtrlCreateTabItem (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateTabItem.htm)("Connect")
$tab0OK = GUICtrlCreateButton (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateButton.htm)("Connect", 20, 50, 50, 20)
$tab1combo = GUICtrlCreateCombo (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateCombo.htm)("", 80, 50, 80, 120)
GUICtrlSetData (http://autoit-script.ru/autoit3_docs/functions/GUICtrlSetData.htm)(-1, "73|74|75|", "SIEMENS")

GUISetState (http://autoit-script.ru/autoit3_docs/functions/GUISetState.htm)()

While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) GUIGetMsg (http://autoit-script.ru/autoit3_docs/functions/GUIGetMsg.htm)()
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $GUI_EVENT_CLOSE
ExitLoop (http://www.autoitscript.com/autoit3/docs/keywords.htm#ExitLoop)
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $tab0OK
WinActivate (http://autoit-script.ru/autoit3_docs/functions/WinActivate.htm)("Patty")
Send (http://autoit-script.ru/autoit3_docs/functions/Send.htm)("Telnet 10.10.10." & GUICtrlRead (http://autoit-script.ru/autoit3_docs/functions/GUICtrlRead.htm)($tab1combo))

$tab1 = GUICtrlCreateTabItem (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateTabItem.htm)("DATA")
GUICtrlCreateLabel (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateLabel.htm)("Плата-Порт", 30, 80, 80, 20)
$tab1combo = GUICtrlCreateCombo (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateCombo.htm)("", 20, 50, 40, 120)
GUICtrlSetData (http://autoit-script.ru/autoit3_docs/functions/GUICtrlSetData.htm)(-1, "1|2|3|4|5", "")
$tab1combo = GUICtrlCreateCombo (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateCombo.htm)("", 70, 50, 40, 120)
GUICtrlSetData (http://autoit-script.ru/autoit3_docs/functions/GUICtrlSetData.htm)(-1, "1|2|3|4|5", "")
$tab1OK = GUICtrlCreateButton (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateButton.htm)("SNR", 120, 50, 50, 20)
$tab11K = GUICtrlCreateButton (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateButton.htm)("SPEED", 120, 80, 60, 20)
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc)

VNRed_OK
12-02-2013, 19:15
Извиняюсь за долгий ответ и за "не покраску"кода, всё замечательно работает. Creat0R спасибо!!! Тема решена, можно закрыть

Creat0R
12-02-2013, 22:43
Тема решена »
Не видно.

VNRed_OK
13-02-2013, 18:18
На рабочей программе не проверял - сейчас нахожусь в командировке, а в тестовом режиме работает как надо:

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
Local $msg,$tab0input
Local $tab, $tab0, $tab1, $tab2
Local $tab3OK,$tab2OK,$tab0OK,$tab4OK,$tab5OK
Local $tab2combo,$tab3combo,$tab1combo,$tab4combo,$tab5combo,$tab6combo

GUICreate("ИЗМЕРЕНИЯ", 220, 130)

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 105)

$tab0 = GUICtrlCreateTabItem("Connect")
$tab0OK = GUICtrlCreateButton("Connect", 20, 50, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 80, 50, 50, 120)
GUICtrlSetData(-1, "73|74|75|", "SIEMENS")

$tab1 = GUICtrlCreateTabItem("DATA")
GUICtrlCreateLabel("Плата-Порт", 30, 80, 80, 20)
$tab2combo = GUICtrlCreateCombo("", 20, 50, 40, 120)
GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16", "")
$tab3combo = GUICtrlCreateCombo("", 70, 50, 50, 120)
GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24", "")
$tab2OK = GUICtrlCreateButton("SNR", 140, 50, 50, 20)
$tab3OK = GUICtrlCreateButton("SPEED", 140, 80, 60, 20)

$tab2 = GUICtrlCreateTabItem("SetUp")
;GUICtrlCreateLabel("Плата-Порт", 30, 80, 80, 20)
$tab4combo = GUICtrlCreateCombo("", 20, 35, 70, 90)
GUICtrlSetData(-1, "плата|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|", "плата")
$tab5combo = GUICtrlCreateCombo("", 20, 60, 70, 90)
GUICtrlSetData(-1, "порт|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|", "порт")
$tab6combo = GUICtrlCreateCombo("", 20, 85, 110, 90)
GUICtrlSetData(-1, "профиль|xsdl 2048/512|xsdl 4096/1024|xsdl 6144/1024|xsdl 10240/1024|", "профиль")
$tab4OK = GUICtrlCreateButton("SHOW", 140, 40, 60, 20)
$tab5OK = GUICtrlCreateButton("SET", 150, 65, 50, 20)

GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $tab0OK
WinActivate("TEMP - Блокнот")
Send("Telnet 10.10.75." & GUICtrlRead($tab1combo))
Send("{ENTER}")
Case $tab2OK
WinActivate("TEMP - Блокнот")
Send("show lre xdsl " & GUICtrlRead($tab2combo))
Send("/" & GUICtrlRead($tab3combo))
Send(" band-table" )
Send("{ENTER}")
Case $tab3OK
WinActivate("TEMP - Блокнот")
Send("show lre xdsl " & GUICtrlRead($tab2combo))
Send("/" & GUICtrlRead($tab3combo))
Send(" phisycal table linerates" )
Send("{ENTER}")


EndSwitch
WEnd
EndFunc




© OSzone.net 2001-2012