Hallo,
versuche mal wieder was zusammen zu basteln aber an ein paar Sachen hängts halt...
Spoiler anzeigen
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <Array.au3>
#include <ProgressConstants.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <GuiComboBox.au3>
#Region ### START Koda GUI section ### Form=
$Form2_1 = GUICreate("Oberflaeche", 274, 230, 348, 249)
$Button1 = GUICtrlCreateButton("Erstelle txt", 54, 197, 80, 25)
$Button2 = GUICtrlCreateButton("Beenden", 139, 197, 80, 25)
$Label1 = GUICtrlCreateLabel("1. Wert", 8, 16, 40, 25)
$Label2 = GUICtrlCreateLabel("2. Wert", 8, 46, 40, 25)
$Label3 = GUICtrlCreateLabel("3. Wert", 8, 76, 40, 25)
$Label4 = GUICtrlCreateLabel("4. Wert", 8, 106, 40, 25)
$Label5 = GUICtrlCreateLabel("5. Wert", 8, 136, 40, 25)
$Label6 = GUICtrlCreateLabel("6. Wert", 8, 166, 40, 25)
$Input1 = GUICtrlCreateInput("", 56, 10, 200, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_UPPERCASE))
GUICtrlSetLimit(-1, 17, 17)
$Input2 = GUICtrlCreateCombo("", 106, 40, 150, 21, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Input3 = GUICtrlCreateInput("", 56, 70, 200, 21, $ES_UPPERCASE)
GUICtrlSetLimit(-1, 6, 6)
$Input4 = GUICtrlCreateInput("", 56, 100, 200, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_UPPERCASE))
GUICtrlSetLimit(-1, 6, 6)
$Input5 = GUICtrlCreateInput("", 56, 130, 200, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_UPPERCASE))
GUICtrlSetLimit(-1, 6, 6)
$Input6 = GUICtrlCreateInput("", 56, 160, 200, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_MULTILINE,$ES_UPPERCASE,$ES_AUTOVSCROLL,$ES_WANTRETURN))
$Input7 = GUICtrlCreateInput("", 56, 40, 45, 21, BitOR($ES_READONLY, $SS_Center))
GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUISetState ()
[/autoit] [autoit][/autoit] [autoit]Func _save()
Global $Dir = @ScriptDir
global $sIni = @ScriptDir & "\meine.ini"
Global $data[6]
$data[0] = GUICtrlRead($Input1)
$data[1] = GUICtrlRead($Input2)
$data[2] = GUICtrlRead($Input3)
$data[3] = GUICtrlRead($Input4)
$data[4] = GUICtrlRead($Input5)
$data[5] = GUICtrlRead($Input6)
global $wert[5]
$wert[0] = StringMid($data[0], 7, 2)
$wert[1] = StringMid($data[0], 10,
$wert[2] = StringLeft($data[0], 6)
$wert[3] = StringMid($data[0], 9,1)
$wert[4] = StringLeft($data[5], 3)
Global $ausgabe[3]
$ausgabe[0] = StringTrimLeft($data[5],3)
$ausgabe[1] = StringRegExpReplace($ausgabe[0], '(.{3})', '$1X')
$ausgabe[2] = StringTrimRight($ausgabe[1], 1)
$save = FileSaveDialog("",$Dir ,"Textdatei (*.txt)",16 , $data[0])
If $save Then $save &= ".txt"
FileWrite($save, $wert[0] & $wert[1] & ";" & $wert[2] & $wert[3] & ";" & $data[1] & ";" & $data[2] & ";" & $wert[4] & "/;" & $data[3] & ";" & $data[4] & ";X" & $ausgabe[2])
EndFunc
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_save()
Case $Button2
Exit
Case _input7()
;Case _input2()
;Case _input3()
EndSwitch
WEnd
Func _input7()
Global $x = GUICtrlRead($Input1)
$y = StringMid($x, 10, 1)
GUICtrlSetData($Input7, $y)
EndFunc
#cs
Func _input2()
Local $var = IniRead("meine.ini", "wert", $x, "")
GUICtrlSetData($Input2, $var)
EndFunc
Func _input3()
$d = StringMid($x, 7, 2) & StringMid($x, 12, 1)
GUICtrlSetData($Input3, $d)
EndFunc
#ce
Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
Local $nNotifyCode, $nID
$nNotifyCode = BitShift($wParam, 16)
$nID = BitAND($wParam, 0x0000FFFF)
If $nID = $Input2 And $nNotifyCode = 5 Then _GUICtrlComboBox_SetEditText($Input2, StringRegExpReplace(StringLeft(GUICtrlRead($Input2), 4), '[^0-9]', ''))
Return $GUI_RUNDEFMSG
EndFunc
1. Wert: z.B. ABCDEFGHIJKLMNOPQ (-> das soll dann auch der Dateiname werden)
2. Wert: erscheint dann J ($Input7; aus dem 1. Wert) und in der ComboBox nebenan sollen dann die Vorschläge aus der INI kommen oder selbst eine Zahl eingetragen werden kann/soll.
3. Wert: da sollten 3 Zeichen (Stelle 7, 8 und 12) aus dem 1. Wert als Vorschlag erscheinen, die aber auch änderbar sein sollen
4. Wert: so wie er ist
5. Wert: so wie er ist
6. Wert: z.B. 123456789101112 die ersten 3 Stellen werden an anderer Stelle gespeichert, der Rest wird alle 3 Zeichen mit einem X versehen
Die INI dazu soll so ausschauen:
Spoiler anzeigen
Am Ende soll die Datei so aussehen:
Die Ansätze habe ich so beim durchsuchen des Boards gefunden. Funktionieren aber mehr schlecht als recht
Ausserdem haut irgendwas beim Speichern nicht so recht hin. Beim ersten mal auf den Erstelle txt Button gehts eigentlich ganz normal. Wenn man noch einmal drauf drückt oder eine gleichnamige Datei existiert, dann wird alles nocheinmal angefügt bzw. eine Datei Namens Datei.txt.txt erstellt
Danke euch schonmal...