Hi Leute,
ich habe mir ein Programm geschrieben welches mir aus einer Excel datei Werte ausliest und diese dann in der GUI Anzeigt. Nun habe ich in dem Excel File eine Spalte mit Statuswerten (Nr.1-4). Das Programm soll diesen Wert auslesen und je nach Wert Buttons Aktivieren/Deaktivieren. Das Programm funktioniert zwar aber das ganze flackert beim ändern der combo.
Spoiler anzeigen
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <Excel.au3>
#include <array.au3>
#include <FF.au3>
#include <CommMG.au3>
#Include <File.au3>
Opt("GUIDataSeparatorChar","|")
Dim $val[31][18], $test[20], $realm="", $temp[10], $password="", $tempchr[10], $bolink=""
Dim $getlinks[256], $winposstart[5], $winposrun[5]
$confdir=@ScriptDir & "\conflogs\"
$date=@MDAY&"-"&@MON&"-"&@YEAR
$title='Beraterconfig'
$titlecmd='COM capture'
$oExcel = _ExcelBookOpen(@ScriptDir & "\IPListe.xls",0)
for $i = 1 to 30 Step 1
For $j = 1 to 17 Step 1
$val[$i][$j] = _ExcelReadCell($oExcel,$i,$j)
$val[$i][1] = _ExcelReadCell($oExcel,$i,1)
Next
Next
_ExcelBookClose($oExcel,0,0)
$erstes=GUICreate($title, 1030,500)
[/autoit] [autoit][/autoit] [autoit]$strasse_combo = GUICtrlCreateCombo("",20,20,200,20)
$typ_input = GUICtrlCreateInput("",240,20,80,20)
GUICtrlCreateLabel("Standort",20,50,80)
$standort_input = GUICtrlCreateInput("",120,48.5,200)
GUICtrlCreateLabel("PLZ",20,75,80)
$plz_input = GUICtrlCreateInput("",120,75)
GUICtrlCreateLabel("Straße",20,105,80)
$strasse_input = GUICtrlCreateInput("",120,100,200)
GUICtrlCreateLabel("Statische IP",20,130,80)
$statip_input = GUICtrlCreateInput("",20,150,80)
GUICtrlCreateLabel("Netz-1",130,130,80)
$netzadd1_input = GUICtrlCreateInput("",130,150)
$gateway1_input = GUICtrlCreateInput("",130,172)
$subnet1_input = GUICtrlCreateInput("",130,194)
GUICtrlCreateLabel("Netz-2",240,130,80)
$netzadd2_input = GUICtrlCreateInput("",240,150)
$gateway2_input = GUICtrlCreateInput("",240,172)
$subnet2_input = GUICtrlCreateInput("",240,194)
GUICtrlCreateLabel("Username",20,220,80)
$username_input = GUICtrlCreateInput("",120,220,200)
GUICtrlCreateLabel("Password",20,245,80)
$password_input = GUICtrlCreateInput("",120,245)
$backoffice_button = GUICtrlCreateButton("BO-config",20,290,80)
$router_button = GUICtrlCreateButton("Router-config",115,290,80)
$journal_button = GUICtrlCreateButton("Journal eintragen",210,290,100)
$zweites_edit=GUICtrlCreateEdit ("",340,10,680,480, $WS_VSCROLL)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]For $a=2 to 30 Step 1
GUICtrlSetData($strasse_combo,$val[$a][5])
Next
For $a=2 to 30 Step 1
If GUICtrlRead($typ_input) == "xDSL-asym" Then
$realm = "work"
Else
$username =""
EndIf
If GUICtrlRead($typ_input) == "aDSL" Then
$realm = "inode-vpn.at"
Else
$username=""
Endif
Next
GuiSetState()
while 1
$msg = GuiGetMsg()
For $b=2 to 30 Step 1
If GUICtrlRead($strasse_combo) == $val[$b][5] Then
If GUICtrlRead($typ_input) == "xDSL-asym" Then
$realm = "work"
GUICtrlSetData($username_input,StringLeft($val[$b][16],8)&"#berater@"&$realm)
ElseIf GUICtrlRead($typ_input) == "aDSL" Then
$realm = "inode-vpn.at"
GUICtrlSetData($username_input,StringLeft($val[$b][16],8)&"#berater@"&$realm)
Else
GUICtrlSetData($username_input," ")
Endif
If $val[$b][1] = "1" Then
GUICtrlSetBkColor($typ_input,0xFF0000)
GUICtrlSetState ($backoffice_button,$GUI_ENABLE)
GUICtrlSetState ($router_button,$GUI_ENABLE)
GUICtrlSetState ($journal_button,$GUI_DISABLE)
Endif
If $val[$b][1] = "2" Then
GUICtrlSetBkColor($typ_input,0xFFC000)
GUICtrlSetState ($backoffice_button,$GUI_DISABLE)
GUICtrlSetState ($router_button,$GUI_ENABLE)
GUICtrlSetState ($journal_button,$GUI_DISABLE)
EndIf
If $val[$b][1] = "3" Then
GUICtrlSetBkColor($typ_input,0xFFFF00)
GUICtrlSetState ($backoffice_button,$GUI_DISABLE)
GUICtrlSetState ($router_button,$GUI_DISABLE)
GUICtrlSetState ($journal_button,$GUI_ENABLE)
EndIf
If $val[$b][1] = "4" Then
GUICtrlSetBkColor($typ_input,0x92D050)
GUICtrlSetState ($backoffice_button,$GUI_DISABLE)
GUICtrlSetState ($router_button,$GUI_DISABLE)
GUICtrlSetState ($journal_button,$GUI_DISABLE)
EndIf
GUICtrlSetData($typ_input,$val[$b][6])
GUICtrlSetData($standort_input,$val[$b][3])
GUICtrlSetData($plz_input,$val[$b][4])
GUICtrlSetData($strasse_input,$val[$b][5])
GUICtrlSetData($statip_input,$val[$b][7])
GUICtrlSetData($netzadd1_input,$val[$b][8])
GUICtrlSetData($gateway1_input,$val[$b][9])
GUICtrlSetData($subnet1_input,$val[$b][10])
GUICtrlSetData($netzadd2_input,$val[$b][11])
GUICtrlSetData($gateway2_input,$val[$b][12])
GUICtrlSetData($subnet2_input,$val[$b][13])
GUICtrlSetData($password_input,$val[$b][17])
$bolink=$val[$b][14]
$cid=StringRight ($bolink,6)
$hostname=StringLeft($val[$b][16],8)
EndIf
next
Select
Case $msg=$backoffice_button
boconfig()
aktualisieren()
Case $msg=$router_button
routerconfig()
aktualisieren()
Case $msg=$journal_button
createjournal()
aktualisieren()
EndSelect
If $msg= $GUI_EVENT_CLOSE Then Exit
Wend
Mehr kann ich euch leider nicht geben da auch schon empfindliche Daten in einige Func eingebaut sind. Und es ist noch ein Rohbau somit sind einige Funktionen noch ohne Sinn.
Danke
Magicmercury