Hallo!
Ich habe Textdateien die mehrere 1000 Zeilen lang sind und möchte daraus bestimmte Bereiche rauskopieren
Die txt sieht ungefähr so aus:
Spoiler anzeigen
Timestamp Found GazepointX GazepointY
12 Both 635 435
32 Both 630 441
52 Both 612 382
72 Both 646 438
92 Both 615 428
111 Both 618 433
131 Both 616 403
151 Both 623 417
171 Both 634 471
191 Both 611 412
211 Both 635 455
231 Both 630 369
251 None -1280 -1024
271 None -1280 -1024
In der ersten Spalte ist immer ein Zeitstempel, und ich möchte jeweils 20 verschiedene Zeitbereiche rauskopieren. Dazu habe ich ein Skript, dass mal ein Kollege geschrieben hat. Ich möchte daran eine Kleinigkeit verändern, weis aber nicht wie. Mit dem bisherigen Skript sieht es so aus, dass alle Zeitbereiche untereinander in eine neue Textdatei geschrieben werden, da sehe ich aber nicht wann ein Zeitbereich aufhört und der nächste anfängt. Deswegen hätte ich da gerne eine Leerzeile oder irgendwas dazwischen, damit man auf den ersten Blick die einzelnen Bereiche findet.
Das Skript sieht so aus:
Spoiler anzeigen
Dim $Input_datei ="HT1_1EFD.txt"
Dim $Output_datei ="HT1_1_cut.txt"
;Datei öffnen
$Input = FileOpen($Input_datei, 0)
If FileExists($Output_datei) Then FileDelete($Output_datei)
$Output = FileOpen($Output_datei, 1)
; Check if file opened for writing OK
If $Output = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
;GUI_EINBINDEN
#include <GUIConstants.au3>
GUICreate("Daten filtern", 300, 50, 100, 100)
$Label_Zaehler=GUICtrlCreateLabel ("", 10, 30, 280, 20)
GUISetState()
;Schleife für Logfile einlesen
Dim $Begin_Zahlenwerte = 0
Dim $Zaehler = 0
While 1
$Zeile = FileReadLine($Input)
If @error = -1 Then ExitLoop
$Zaehler = $Zaehler +1
GUICtrlSetData($Label_Zaehler, $Zaehler)
Dim $Ausgeben = 1
Dim $Zeile_original = $Zeile
if ($Begin_Zahlenwerte == 1) then
[/autoit] [autoit][/autoit] [autoit];Zeile zerlegen
$pos = Stringinstr($Zeile, chr(9))
$timestamp = int (StringMid ( $Zeile, 1, $pos-1))
$Zeile = StringMid( $Zeile, $pos+1)
$pos = Stringinstr($Zeile, chr(9))
$found = StringMid ( $Zeile, 1, $pos-1)
$Zeile = StringMid( $Zeile, $pos+1)
; if ($found <> "both") then
; $Ausgeben = 0
; endif
if ($Ausgeben == 1) then
Dim $Anfangszeit = 0
Dim $Endszeit = 0
$Ausgeben = 0
$Anfangszeit = 80189
$Endzeit = 114555
if ( $timestamp >= $Anfangszeit and $timestamp <= $Endzeit) then $Ausgeben = 1
; hier soll Leerzeile dazwischen
$Anfangszeit = 164673
$Endzeit = 199040
if ( $timestamp >= $Anfangszeit and $timestamp <= $Endzeit) then $Ausgeben = 1
endif
endif
if ($Zeile == "Timestamp Found GazepointX GazepointY") then
$Begin_Zahlenwerte = 1
endif
if ($Ausgeben == 1) then
FileWriteLine($Output, $Zeile_original)
endif
Wend
GUIDelete()
msgbox(0,"Fertig","Bin fertig!")
Exit
Kann mir da jemand nen tipp geben?