Jump to content
Sign in to follow this  
MartinSchmidt

combo Box Abfrage

Recommended Posts

MartinSchmidt

Hallo zusammen,

ich brauche eure Hilfe. Ich habe vor von WakeOnLanGui.exe eine Oberfläche zu bauen das mann nur den Rechner Namen auswählen muss.

das Script sieht so aus:

#include <File.au3>

#include <GUIConstants.au3>

#include <GuiCombo.au3>

Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.

Opt("TrayOnEventMode", 1)

Dim $StartColor = 0x6ca6cd ;Color GUI

Dim $EndColor = 0xD4D0C8 ;Color GUI

Dim $config_ini = "./config.ini"

Dim $filew1 = "[netz-bereich]"

Dim $filew2 = 'netz="255.255.255.0|255.192.0.0|255.224.0.0|255.240.0.0|255.248.0.0|255.252.0.0|255.254.0.0|255.255.0

.0|255.255.128.0|255.255.192.0|255.255.224.0|255.255.240.0|255.255.252.0|255.255.248.0|255.255.254.0

|255.255.255.128|255.255.255.192|255.255.255.224|255.255.255.240|255.255.255.248|255.255.255.252"'

If FileExists ($config_ini) Then

;MsgBox(4096, "C:\autoexec.bat File", "Exists")

Else

;MsgBox(4096, "C:\ File", "Does NOT exists")

;Run("dir")

;_FileCreate(@scriptdir & $config_ini)

FileOpen($config_ini, 1)

FileWrite($config_ini,$filew1 & @CRLF & $filew2 & @CRLF )

FileClose($config_ini)

EndIf

#Region ### START Koda GUI section ### Form=d:\dokumente und einstellungen\administrator\desktop\wol\wol-gui../autoit3/docs/intro/lang_variables.htm.kxf

$Form1_1 = GUICreate("WOL-GUI", 416, 380, 323, 170)

$Button = GUICtrlCreateButton("Start", 96, 288, 75, 25, 0)

$Button2 = GUICtrlCreateButton("Exit", 216, 288, 75, 25, 0)

$Button3 = GUICtrlCreateButton("Neue Mac-Adresse", 296, 16, 107, 25, 0)

$Combo1 = GUICtrlCreateCombo("Rechner", 88, 80, 241, 25)

$Group1 = GUICtrlCreateGroup("Group1", 88, 112, 225, 169)

$Label1 = GUICtrlCreateLabel("Label1", 104, 152, 196, 17)

$Label2 = GUICtrlCreateLabel("Label2", 104, 184, 196, 25)

$Label3 = GUICtrlCreateLabel("Label3", 104, 232, 188, 33)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

;GUICtrlSetData(-1,$netz)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button

Case $Button2

GUIDelete($Form1_1)

Exit

Case $Button3

;Opt("OnExitFunc", "endscript")

dim $netz_default = "255.255.255.0"

dim $netz = IniRead($config_ini, "netz-bereich","netz",$netz_default)

#region --- GuiBuilder code Start ---

; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

;GuiCreate("WOL-GUI Eingabe Neuer Clients", 402, 320,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$OpenGui = GuiCreate("WOL-GUI Eingabe Neuer Clients", 402, 320,-1, -1)

$Input_6 = GuiCtrlCreateInput("Name", 200, 25, 110, 20)

$Input_3 = GuiCtrlCreateInput("Mac", 200, 70, 110, 20)

$Input_4 = GuiCtrlCreateInput("IP", 200, 120, 110, 20)

$Input_5 = GUICtrlCreateCombo("Netz", 200, 170, 110, 20)

GUICtrlSetData(-1,$netz)

$Label_9 = GuiCtrlCreateLabel("Rechner Name", 100, 30, 80, 20)

$Label_10 = GuiCtrlCreateLabel("Mac Adresse", 100, 80, 80, 20)

$Label_7 = GuiCtrlCreateLabel("IP-Adresse", 100, 130, 80, 20)

$Label_8 = GuiCtrlCreateLabel("Subnetz Mask", 100, 180, 80, 20)

$Button_1 = GuiCtrlCreateButton("SAVE", 100, 240, 90, 30)

$Button_2 = GuiCtrlCreateButton("Exit", 220, 240, 90, 30)

GuiSetState()

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Input_6

$Input_name_write = GUICtrlRead($Input_6)

;MsgBox(0,$Input_name_write,$Input_name_write)

;IniWrite($config_ini, $Input_name_write,$Input_name_write,$Input_name_write)

Case $Input_3

$Input_mac_write = GUICtrlRead($Input_3)

; MsgBox(0,$Input_mac_write,$Input_mac_write)

; IniWrite($config_ini, $Input_name_write,"mac",$Input_mac_write)

Case $Input_4

$Input_ip_write = GUICtrlRead($Input_4)

; MsgBox(0,$Input_ip_write,$Input_ip_write)

; IniWrite($config_ini, "Rechner","mac",$Input_ip_write)

Case $Input_5

$Input_netz_write = GUICtrlRead($Input_5)

;MsgBox(0,$Input_netz_write,$Input_netz_write)

; IniWrite($config_ini, "Rechner","mac",$Input_netz_write)

Case $Button_1

If GUICtrlRead($Input_6) = "" ../autoit3/docs/keywords.htmOr GUICtrlRead($Input_6) = "Name" Then

MsgBox(48,"Error, fehlende Eingabe","Bitte geben sie den Rechner Namen ein")

ElseIf GUICtrlRead($Input_3) = "" ../autoit3/docs/keywords.htmOr GUICtrlRead($Input_3) = "Mac" Then

MsgBox(48,"Error, fehlende Eingabe","Bitte geben sie die Mac Adresse ein")

ElseIf GUICtrlRead($Input_4) = "" ../autoit3/docs/keywords.htmOr GUICtrlRead($Input_4) = "IP" Then

MsgBox(48,"Error, fehlende Eingabe","Bitte geben sie den IP Adresse ein")

ElseIf GUICtrlRead($Input_5) = "" ../autoit3/docs/keywords.htmOr GUICtrlRead($Input_5) = "Netz" Then

MsgBox(48,"Error, fehlende Eingabe","Bitte geben sie den Netzmaske ein")

Else

iniwrite($config_ini, $input_name_write,"mac",$input_mac_write)

iniwrite($config_ini, $input_name_write,"ip",$input_ip_write)

iniwrite($config_ini, $input_name_write,"netz",$input_netz_write)

MsgBox(0,$Input_Name_write," Es wurde der Rechner "&$Input_Name_write&" mit der IP "&$Input_IP_write&" und Netzmaske "&$Input_netz_write&" und MAC "&$Input_MAC_write&" angelegt",20)

EndIf

;EndIf

Case $Button_2

GUIDelete($OpenGui)

;Exit

GuiSetState()

EndSwitch

WEnd

#endregion --- GuiBuilder generated code End ---

Case $Combo1

EndSwitch

WEnd

; -----------------------------------

ich stehe vor dem Problem wie ich jetzt in der combo Auswahl die Rechner aus der config.ini bekomme.

Und das die Mac, ip, und netmask als Label bekomme Posted Image Posted Image Posted Image

(config.ini

[netz-bereich]

netz="255.255.255.0|255.192.0.0|255.224.0.0|255.240.0.0|255.248.0.0|255.252.0.0|255.254.0.0|255.255.0

.0|255.255.128.0|255.255.192.0|255.255.224.0|255.255.240.0|255.255.252.0|255.255.248.0|255.255.254.0

|255.255.255.12|255.255.255.192|255.255.255.224|255.255.255.240|255.255.255.240|255.255.255.252"

[08cad-01]

mac=0021457458

ip=10.1.1.12

netz=255.255.255.0

[08cad-02]

mac=0021457458

ip=10.1.1.12

netz=255.255.255.0

[08cad-03]

mac=0021457458

ip=10.1.1.12

netz=255.255.255.0

und was ich auch komisch finde ist wenn ich in die Eingabe Maske gehe, und bin dann Fertig mache ich ein Ende mit Posted Image

AutoIt-Quellcode

GUIDelete($OpenGui)

das Fenster geht auch zu aber dann kann ich das Haupt Fenster nicht mehr zumachen Posted Image Posted Image Posted Image

Könnt ihr mir Helfen

Ich wäre euch dankbar

Gruß Martin

Share this post


Link to post
Share on other sites
martin

Ich verstehe nicht Deutsch, so ist dies nur eine kleine Änderung an Ihr Skript, damit die $opengui Fenster zu schließen.

#include <File.au3>
#include <GUIConstants.au3>
#include <GuiCombobox.au3>
Opt("TrayMenuMode", 1); Default tray menu items (Script Paused/Exit) will not be shown.
Opt("TrayOnEventMode", 1)
Dim $StartColor = 0x6ca6cd;Color GUI
Dim $EndColor = 0xD4D0C8;Color GUI
Dim $config_ini = "./config.ini"
Dim $filew1 = "[netz-bereich]"
Dim $filew2 = 'netz="255.255.255.0|255.192.0.0|255.224.0.0|255.240.0.0|255.248.0.0|255.252.0.0|255.254.0.0|255.255.0.

0|255.255.128.0|255.255.192.0|255.255.224.0|255.255.240.0|255.255.252.0|255.255.248.0|255.255.254.0|

255.255.255.128|255.255.255.192|255.255.255.224|255.255.255.240|255.255.255.248|255.255.255.252"'
If FileExists ($config_ini) Then
;MsgBox(4096, "C:\autoexec.bat File", "Exists")
Else
;MsgBox(4096, "C:\ File", "Does NOT exists")
;Run("dir")
;_FileCreate(@scriptdir & $config_ini)
FileOpen($config_ini, 1)
FileWrite($config_ini,$filew1 & @CRLF & $filew2 & @CRLF )
FileClose($config_ini)

EndIf
#Region ### START Koda GUI section ### Form=d:\dokumente und einstellungen\administrator\desktop\wol\wol-gui../autoit3/docs/intro/lang_variables.htm.kxf
$Form1_1 = GUICreate("WOL-GUI", 416, 380, 323, 170)
$Button = GUICtrlCreateButton("Start", 96, 288, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Exit", 216, 288, 75, 25, 0)
$Button3 = GUICtrlCreateButton("Neue Mac-Adresse", 296, 16, 107, 25, 0)
$Combo1 = GUICtrlCreateCombo("Rechner", 88, 80, 241, 25)
$Group1 = GUICtrlCreateGroup("Group1", 88, 112, 225, 169)
$Label1 = GUICtrlCreateLabel("Label1", 104, 152, 196, 17)
$Label2 = GUICtrlCreateLabel("Label2", 104, 184, 196, 25)
$Label3 = GUICtrlCreateLabel("Label3", 104, 232, 188, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)


;GUICtrlSetData(-1,$netz)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit



Case $Button


Case $Button2
GUIDelete($Form1_1)
Exit

Case $Button3
;Opt("OnExitFunc", "endscript")


dim $netz_default = "255.255.255.0"
dim $netz = IniRead($config_ini, "netz-bereich","netz",$netz_default)


#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype
#include <GuiConstants.au3>
;GuiCreate("WOL-GUI Eingabe Neuer Clients", 402, 320,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$OpenGui = GuiCreate("WOL-GUI Eingabe Neuer Clients", 402, 320,-1, -1)


$Input_6 = GuiCtrlCreateInput("Name", 200, 25, 110, 20)
$Input_3 = GuiCtrlCreateInput("Mac", 200, 70, 110, 20)
$Input_4 = GuiCtrlCreateInput("IP", 200, 120, 110, 20)
$Input_5 = GUICtrlCreateCombo("Netz", 200, 170, 110, 20)
GUICtrlSetData(-1,$netz)

$Label_9 = GuiCtrlCreateLabel("Rechner Name", 100, 30, 80, 20)
$Label_10 = GuiCtrlCreateLabel("Mac Adresse", 100, 80, 80, 20)
$Label_7 = GuiCtrlCreateLabel("IP-Adresse", 100, 130, 80, 20)
$Label_8 = GuiCtrlCreateLabel("Subnetz Mask", 100, 180, 80, 20)

$Button_1 = GuiCtrlCreateButton("SAVE", 100, 240, 90, 30)
$Button_2 = GuiCtrlCreateButton("Exit", 220, 240, 90, 30)




GuiSetState()
$stayhere = True
While $stayhere
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Input_6
$Input_name_write = GUICtrlRead($Input_6)
;MsgBox(0,$Input_name_write,$Input_name_write)
;IniWrite($config_ini, $Input_name_write,$Input_name_write,$Input_name_write)

Case $Input_3
$Input_mac_write = GUICtrlRead($Input_3)
; MsgBox(0,$Input_mac_write,$Input_mac_write)
; IniWrite($config_ini, $Input_name_write,"mac",$Input_mac_write)

Case $Input_4
$Input_ip_write = GUICtrlRead($Input_4)
; MsgBox(0,$Input_ip_write,$Input_ip_write)
; IniWrite($config_ini, "Rechner","mac",$Input_ip_write)

Case $Input_5
$Input_netz_write = GUICtrlRead($Input_5)
;MsgBox(0,$Input_netz_write,$Input_netz_write)
; IniWrite($config_ini, "Rechner","mac",$Input_netz_write)


Case $Button_1
    GUIDelete($OpenGui)
    $stayhere = False
#cs
If GUICtrlRead($Input_6) = "" ../autoit3/docs/keywords.htm Or GUICtrlRead($Input_6) = "Name" Then
MsgBox(48,"Error, fehlende Eingabe","Bitte geben sie den Rechner Namen ein")
ElseIf GUICtrlRead($Input_3) = "" ../autoit3/docs/keywords.htm Or GUICtrlRead($Input_3) = "Mac" Then
MsgBox(48,"Error, fehlende Eingabe","Bitte geben sie die Mac Adresse ein")
ElseIf GUICtrlRead($Input_4) = "" ../autoit3/docs/keywords.htm Or GUICtrlRead($Input_4) = "IP" Then
MsgBox(48,"Error, fehlende Eingabe","Bitte geben sie den IP Adresse ein")
ElseIf GUICtrlRead($Input_5) = "" ../autoit3/docs/keywords.htm Or GUICtrlRead($Input_5) = "Netz" Then
MsgBox(48,"Error, fehlende Eingabe","Bitte geben sie den Netzmaske ein")

Else
iniwrite($config_ini, $input_name_write,"mac",$input_mac_write)
iniwrite($config_ini, $input_name_write,"ip",$input_ip_write)
iniwrite($config_ini, $input_name_write,"netz",$input_netz_write)
MsgBox(0,$Input_Name_write," Es wurde der Rechner "&$Input_Name_write&" mit der IP "&$Input_IP_write&" und Netzmaske "&$Input_netz_write&" und MAC "&$Input_MAC_write&" angelegt",20)

EndIf
#ce

;EndIf
Case $Button_2
GUIDelete($OpenGui)
 $stayhere = False
;Exit
;GuiSetState()



EndSwitch
WEnd

#endregion --- GuiBuilder generated code End ---



Case $Combo1
ConsoleWrite("combo1 changed" & @CRLF)


EndSwitch
WEnd

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
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
Sign in to follow this  

×