Ich bin zurzeit dabei ein kleines Tool zu schreiben, mit dem ich später verschiedene Artikel(derzeit Tabak) aufnehmen kann und später dann via Barcode wieder aufrufen will.
Aufgebaut hab ich das ganze, dass in einen seperaten Einstellungsfenster(Gui,3) alle relevanten Daten(EAN, Bezeichnung, Geschmacksrichtung, Preis, Menge) eingegeben werden und dann mit einen "Save"-Button die Informationen in einer Ini Datei abgespeichert werden. Der Name der Ini Datei soll jedoch die eingegebene EAN-Nummer sein.
Auf der Hauptseite befindet sich eine Editbox und Textfelder, dort will ich meine EAN Nummer eingeben/einscannen und durch anschließendes Drücken von "Load" sollen alle eingebene Informationen zu der EAN-Nummer angezeigt werden.
Das Abspeichern funktioniert tadellos, jedoch wenn ich auf der Hauptseite meine EAN-Nummer eingebe, und auf Load drücke, passiert leider nichts.
Und wie schreibe ich das genau, dass der Cursor zum schreiben immer in der Editbox ist? Bzw dass nach Einscannen via Barcodescanner sofort gesucht wird.
Danke im vorraus!
Hier mein Code:
Code: Select all
#NoEnv
#SingleInstance force
Gui, -Caption +AlwaysOnTop
Gui, Add, Picture, x0 y0, XXXXXX
Gui, Font, cblack bold s12
Gui, Add, Text, x552 y49 w420 h50 vText6, EAN-Nummer:
Gui, Add, edit, x792 y49 w120 h25 vbarcode,
Gui, Add, Text, x552 y109 w420 h50 vText2, %Info%
Gui, Add, Text, x552 y169 w420 h50 vText3, %Flavour%
Gui, Add, Text, x552 y239 w180 h30 vText4, %Amount% Gramm
Gui, Add, Text, x792 y239 w180 h30 vText5, %Price% €
GuiControl +BackgroundTrans, Text1
GuiControl +BackgroundTrans, Text2
GuiControl +BackgroundTrans, Text3
GuiControl +BackgroundTrans, Text4
GuiControl +BackgroundTrans, Text5
GuiControl +BackgroundTrans, Text6
Gui, Add, Button, x552 y309 w360 h200 gLoad , Laden
Gui, Add, Button, x552 y599 w130 h50 gClose , Beenden
Gui, Add, Button, x792 y599 w120 h50 gSetup , Einstellungen
Gui, Show, Maximize , Scanner
return
Close:
ExitApp
return
Close2:
Gui,2: Destroy
Return
Close3:
Gui,3: Destroy
Return
Setup:
Gui,2: -Caption +AlwaysOnTop
Gui,2: Show, h800 w600, Zusatzfunktionen
Gui,2: Font, cblack bold, techno hideo
Gui,2: Add, Button, x122 y500 w370 h50 gAddtabak , Neuer Tabak
Gui,2: Add, Button, x122 y589 w130 h50 gSave , Speichern
Gui,2: Add, Button, x362 y589 w130 h50 gClose2 , Beenden
return
Save:
gui,3: Submit, NoHide
if StrLen(barcode)
{
IniWrite, %barcode%,%a_scriptdir%\%barcode%.ini,%barcode%,barcode
IniWrite, %info%,%a_scriptdir%\%barcode%.ini,%barcode%,info
IniWrite, %flavour%,%a_scriptdir%\%barcode%.ini,%barcode%,flavour
IniWrite, %price%,%a_scriptdir%\%barcode%.ini,%barcode%,price
IniWrite, %amount%,%a_scriptdir%\%barcode%.ini,%barcode%,amount
}
reload
return
Load:
gui, Submit, NoHide
configfile = %a_scriptdir%\%barcode%.ini
if StrLen(barcode) and !FileExist(configfile)
{
IniWrite, %barcode%,%configfile%,%barcode%,barcode
IniWrite, %info%,%configfile%,%barcode%,info
IniWrite, %flavour%,%configfile%,%barcode%,flavour
IniWrite, %price%,%configfile%,%barcode%,price
IniWrite, %amount%,%configfile%,%barcode%,amount
}
IniRead, val,%configFile%,%barcode%, barcode, %A_Space%
GuiControl,, barcode, %val%
IniRead, val,%configFile%,%barcode%, info, %A_Space%
GuiControl,, text2, %info%
IniRead, val,%configFile%,%barcode%, flavour, %A_Space%
GuiControl,, flavour, %val%
IniRead, val,%configFile%,%barcode%, price, %A_Space%
GuiControl,, price, %val%
IniRead, val,%configFile%,%barcode%, amount, %A_Space%
GuiControl,, amount, %val%
return
Addtabak:
Gui,3: -Caption +AlwaysOnTop
Gui,3: Show, h800 w600, Zusatzfunktionen
Gui,3: Font, cblack bold, techno hideo
Gui,3: Add, Text, x135 y109 w420 h50 , EAN-Code
Gui,3: Add, Edit, x265 y109 w220 h20 vBarcode, %Barcode%
Gui,3: Add, Text, x135 y159 w420 h50 , Bezeichnung
Gui,3: Add, Edit, x265 y159 w220 h20 vInfo, %Info%
Gui,3: Add, Text, x135 y209 w420 h50 , Geschmacksrichtung
Gui,3: Add, Edit, x265 y209 w220 h20 vFlavour, %Flavour%
Gui,3: Add, Text, x135 y259 w420 h50 , Preis
Gui,3: Add, Edit, x265 y259 w220 h20 vPrice, %Price%
Gui,3: Add, Text, x135 y309 w420 h50 , Menge
Gui,3: Add, Edit, x265 y309 w220 h20 vAmount, %Amount%
Gui,3: Add, Button, x122 y589 w130 h50 gSave , Speichern
Gui,3: Add, Button, x362 y589 w130 h50 gClose3 , Beenden
return