Hallo
ich stehe auf dem Schlauch.
Ich möchte mit Empirum eine Textdatei zeilenweise auslesen und jede Zeile im Paket weiter verwenden.
Beispiel:
Textdatei Source.txt:
Eins
Zwei
Drei
Im Paket:
Wenn in der Datei Muster.txt die "Zeile1" (Eins) aus Source.txt enthalten ist dann gehe zu set:go
Das Ganze soll dann so oft durchlaufen bis die Source.txt durchlaufen ist.
Textdatei zeilenweise auswerten
Moderator: hdroege
-
Frank Dethlefsen
- Posts: 558
- Joined: 06. Apr 2006, 22:01
- Location: Bochum
- Contact:
Re: Textdatei zeilenweise auswerten
Moin!
Geht, glaube ich, so mit Bordmitteln out of the box nicht.
Muss es denn unbedingt eine Source.txt sein?
Könnte es ggf. auch eine Source.ini sein?
[Source]
1=eins
2=zwei
3=drei
usw.
Das bekommt man hin mit der Setup.inf ...
Geht, glaube ich, so mit Bordmitteln out of the box nicht.
Muss es denn unbedingt eine Source.txt sein?
Könnte es ggf. auch eine Source.ini sein?
[Source]
1=eins
2=zwei
3=drei
usw.
Das bekommt man hin mit der Setup.inf ...
Code: Select all
For LOOP,1,99,1,ReadIni
[ReadIni]
Set LoopLine=%%%Src%\Source.ini,Source,%LOOP%%%
ReplaceEnv LoopLine
If "%LoopLine%" != "" Then "DoWhatYouWant" EndIf
[DoWhatYouWant]
ECHO %LOOP% = %LoopLine%
Last edited by Frank Dethlefsen on 30. Jan 2026, 14:01, edited 1 time in total.
Frank Dethlefsen
Consultant und Coach
UPDATENOW GmbH
Frank.Dethlefsen@updatenow.de
https://empirum.blogspot.de/
Consultant und Coach
UPDATENOW GmbH
Frank.Dethlefsen@updatenow.de
https://empirum.blogspot.de/
-
Hendrik_Ambrosius
- Moderator

- Posts: 8098
- Joined: 13. Dec 2004, 23:10
- Location: Adendorf/Lüneburg
Re: Textdatei zeilenweise auswerten
Idee dazu aus einem alten KB-Eintrag von mir:
The commands built into the Empirum script interpreter (setup.exe) do not allow reading a specific line from a text file.
Solution:
Convert the TXT-file to an INI-file and read the line using the built-in INI-commands:
Sourcefile TEXT.TXT:
A
B
C
D
E
F
G
Destinationfile INI.INI:
[Section]
line1=A
line2=B
line3=C
line4=D
line5=E
line6=F
line7=G
Batch that must be called from the setup.inf:
@echo off
echo [Section] >INI.INI
set counter=1
for /f %%d in (text.txt) do (
set string=%%d
call :count
)
goto END
:count
echo line%counter%=%STRING% >>INI.INI
set /a counter=counter+1
:END
The commands built into the Empirum script interpreter (setup.exe) do not allow reading a specific line from a text file.
Solution:
Convert the TXT-file to an INI-file and read the line using the built-in INI-commands:
Sourcefile TEXT.TXT:
A
B
C
D
E
F
G
Destinationfile INI.INI:
[Section]
line1=A
line2=B
line3=C
line4=D
line5=E
line6=F
line7=G
Batch that must be called from the setup.inf:
@echo off
echo [Section] >INI.INI
set counter=1
for /f %%d in (text.txt) do (
set string=%%d
call :count
)
goto END
:count
echo line%counter%=%STRING% >>INI.INI
set /a counter=counter+1
:END
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com
Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com
Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.
-
Hendrik_Ambrosius
- Moderator

- Posts: 8098
- Joined: 13. Dec 2004, 23:10
- Location: Adendorf/Lüneburg
Re: Textdatei zeilenweise auswerten
Andere Idee: Wenn es nur darauf ankommt ob ein String IRGENDWO in der Textdatei ist kann man auch auf die Existenz abprüfen:
If DoesTextInFileExist ("ObjectNotFound", "%temp%\KB123456.txt") == "1" Then "Set:Installation" Else "Exit" EndIf
If DoesTextInFileExist ("ObjectNotFound", "%temp%\KB123456.txt") == "1" Then "Set:Installation" Else "Exit" EndIf
Hendrik Ambrosius / Senior Presales Consultant
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com
Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.
Mobile: +49 172 408 4447 | hendrik.ambrosius@matrix42.com
Matrix42 GmbH | Elbinger Straße 7 | 60487 Frankfurt am Main | Germany | www.matrix42.com
Disclaimer: I participate in this forum on a voluntary basis. Views expressed are not necessarily those of Matrix42 or of the support team.
Re: Textdatei zeilenweise auswerten
Vielen Dank für die Anregungen und Hilfen.
Nein, es geht mir nicht um das vorhanden sein eines Textes in einer Datei.
Ich will wirklich zeilenweise den Inhalt auslesen und den Wert weiterverarbeiten.
Die Lösung mit der Ini Datei sieht gut aus da ich die "Textdatei" selber anlege und pflege.
Nein, es geht mir nicht um das vorhanden sein eines Textes in einer Datei.
Ich will wirklich zeilenweise den Inhalt auslesen und den Wert weiterverarbeiten.
Die Lösung mit der Ini Datei sieht gut aus da ich die "Textdatei" selber anlege und pflege.
Who is online
Users browsing this forum: No registered users and 0 guests