Ich habe leider auch keiner leid Vorkenntnisse von Script Sprachen. Dennoch hat es mir AHK angetan und ich habe richtig spass dabei. Vor 5 Tagen hab ich nun angefangen eine Hardware Inventarisierung Skript um zu setzen.
Ich benötige Hilfe bei dem Problem, wenn ich über die ComboBox vAbteilungen die Auswahl z.B. Marketing wähle. Möchte ich erreichen dass genau dieser Wert an das Ende Von Iniread als variables Gesetz wird. IniRead, SoftZuweisung, UserVerwaltung.ini, Settings, %Abteilungen% und diese Werte daraus dann an die Software ListBox übergeben.
Ich habe festgestellt dass wenn ich normale v Variable nehme werden mir alle Angaben aus der ini Gelistet und nicht nur Marketing.
Über die Globale Variable schaffe ich es nicht die Variabel zu übergeben und das GUI zu aktualisieren damit die neuen werte geladen werden.
Ich Hoffe dass versteht was ich möchte und mir helfen kann.
Danke schon einmal gruss JoKu
Code: Select all
#SingleInstance force ; Bei Neustart des Scriptes die alte Instanz ohne Nachfrage ersetzen
MyXML:=new XML("Hardware","lib\PC-Server.xml")
GUI:
;############################### GUI ############################################
Gui, Color,
gui, font, s10 w700 q5, HandelGotDLig
Gui +LastFound
Gui, Add, Tab3, x10 y10 w600 h372 , PC|Drucker|Server|Eticketten-Drucker
IniRead, Betrieb, HardwareVerwaltung.ini, Settings, Betriebssystem
IniRead, Mdl, HardwareVerwaltung.ini, Settings, ModellTyp
IniRead, Her, HardwareVerwaltung.ini, Settings, Hersteller
IniRead, Disp, HardwareVerwaltung.ini, Settings, Displayanschluss
IniRead, DDRRAM, HardwareVerwaltung.ini, Settings, RAM
IniRead, HDD, HardwareVerwaltung.ini, Settings, Speicher
IniRead, Proz, HardwareVerwaltung.ini, Settings, Prozessor
IniRead, Abt, UserVerwaltung.ini, Settings, Abteilung
IniRead, SoftZuweisung, UserVerwaltung.ini, Settings, %Abteilungen% [color=#0000BF] ;Mit diesem IniRead versuchte die Auswahl Von vAbteilungen aus der ComboBox zu erhalten oder aus dem Label Abteilung:[/color]
{
Gui, Tab, PC
gui, font, s9 w600 q5, HandelGotDLig
Gui, Add, Text, x20 y50 w100 h25 ,PcName
Gui, Add, ComboBox, x20 y65 w100 h20 gPcName,
Gui, Add, Text, x130 y50 w100 h25 ,Kaufdatum
Gui, Add, DateTime, x130 y65 w100 h20 gKaufdatum ChooseNone, dd.mm.yyyy
Gui, Add, Text, x260 y50 w100 h25 ,Hersteller
Gui, Add, ComboBox, X260 y65 w100 h15 r5 gHersteller, %Her%
Gui, Add, Text, X390 y50 w100 h25, Model-Typ
Gui, Add, ComboBox, X390 y65 w100 h15 r10 gModellTyp, %Mdl%
Gui, Add, Text, x20 y135 w100 h25 ,Prozessor
Gui, Add, ComboBox, x20 y150 w100 h20 r5 gProzessor, %Proz%
Gui, Add, Text, x130 y135 w50 h25 ,RAM
Gui, Add, ComboBox, x130 y150 w100 h20 r10 gRAM, %DDRRAM%
Gui, Add, Text, x260 y135 w100 h25 ,HDD/SSD
Gui, Add, ComboBox, x260 y150 w100 h20 r10 gHDDSSD, %HDD%
Gui, Add, Text, x390 y135 w100 h25 ,Betriebssystem
Gui, Add, ComboBox, X390 y150 w100 h15 r5 gBetriebssystem, %Betrieb%
Gui, Add, CheckBox, x30 y195 w100 h20 vWANModul,WAN Modul
Gui, Add, Text, x20 y235 w100 h25, Displayanschluss
Gui, Add, ComboBox, x20 y250 w100 h15 gDisplayAnschluss, %Disp%
Gui, Add, Text, X200 y280 W100 h25 ,Serien Nr.
Gui, Add, Edit, X200 y300 w200 h25 ,
Gui, Add, Button, x20 y350 w125 h20 gAuswahlHinzufuegen, HardwareHinzufügen
}
Gui, Add, Tab3, x630 y10 w600 h372 , Benutzer|Software|Zubehör
Gui, Tab, Benutzer
gui, font, s9, HandelGotDLig
Gui, Add, Text, x650 y50 w100 h25 ,Benuzerzuweisen
Gui, Add, Edit, x650 y65 w100 h20
Gui, Add, Text, X760 y50 w100 h25, Geräte Abgabe
Gui, Add, DateTime, x760 y65 w100 h20 vAbgabedatum ChooseNone,dd.mm.yyyy
Gui, Add, Text, X870 y50 w100 h25, Rückgabe
Gui, Add, DateTime, X870 Y65 w100 h20 vRückgabedatum ChooseNone,dd.mm.yyyy
Gui, Add, Text, X650 y135 w100 h25,
Gui, Add, ComboBox, X650 y150 w100 h15 r5 vAbteilungen gAbteilung ChooseNone , %Abt% [color=#0000FF] ;In der ComboBox wird die auswahl getroffen für die weitergabe an das IniRead[/color]
Gui, Add, Text, x760 y135 w120 h25, Telefon Nr.
Gui, Add, Edit, x760 y150 w120 h20 vTelefonNr,
Gui, Tab, Software
Gui, Add, ListBox, x650 y40 w350 h350 gSofwareListe 8,%AktuelleStdSW% [color=#0000FF];End ziel hier sollte das resultat von der auswahl VAbteilungen ComboBox angezeigt werden[/color]
Gui, Add, Tab3, x10 y390 w1220 h372 , Verlauf|Statistik
Gui, Tab, Verlauf
Gui, Show, w1240 h768, Hardware Verwaltung
;############################### Labels #########################################
Abteilung:
GuiControlGet, Abteilung,,
Msgbox, %Abteilung%
IniRead, AktuelleStdSW, UserVerwaltung.ini, Settings, %Abteilung%
GuiControl,, SoftwareListe, %AktuelleStdSW%
MsgBox, %AktuelleStdSW%
return
SofwareListe:
return
AuswahlHinzufuegen:
{
run, AuswahlHinzufuegen.ahk
return
}
PcName:
{
AutoComplete(A_GuiControl)
;ode:=MyXML.Add("Hardware",{Attribute:"ComputerName"},"%PcName%",0) ;Create a new Node Element
Return
}
Kaufdatum:
{
AutoComplete(A_GuiControl)
Return
}
Hersteller:
{
AutoComplete(A_GuiControl)
Return
}
ModellTyp:
{
AutoComplete(A_GuiControl)
Return
}
Prozessor:
{
AutoComplete(A_GuiControl)
Return
}
RAM:
{
AutoComplete(A_GuiControl)
Return
}
HDDSSD:
{
AutoComplete(A_GuiControl)
Return
}
Betriebssystem:
{
AutoComplete(A_GuiControl)
Return
}
DisplayAnschluss:
{
AutoComplete(A_GuiControl)
Return
}
;############################### Autovervollständigen #####################################
AutoComplete(ctrl)
{
static lf = "`n"
If GetKeyState("Delete") or GetKeyState("Backspace")
Return
SetControlDelay, -1
SetWinDelay, -1
GuiControlGet, h, Hwnd, %ctrl%
ControlGet, haystack, List, , , ahk_id %h%
GuiControlGet, needle, , %ctrl%
StringMid, text, haystack, pos := InStr(lf . haystack, lf . needle)
, InStr(haystack . lf, lf, false, pos) - pos
If text !=
{
if pos != 0
{
ControlSetText, , %text%, ahk_id %h%
ControlSend, , % "{Right " . StrLen(needle) . "}+^{End}", ahk_id %h%
}
}
}
Return
GuiClose:
;MyXML.Transform() ;Makes the XML Pretty
;MyXML.Transform() ;Sometimes needed.
;mMyXML[] ;Shows a MsgBox with the contents of the new node
; 1 is to "Make the XML pretty"
;MyXML.Save(1) ;Saves the xml
ExitApp