sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #21977
Re: [Question #237635]: Use clients info from txt
Question #237635 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/237635
Status: Open => Answered
RaiMan proposed the following answer:
-- I already figured out a way to do this with keyboard emulation
This means, you are using an editor in parallel to delete the used lines and then save the modified file in place.
To simulate this with file read/write is very complex, since we use sequential read, which means, what is already read is no longer accessible, only the stuff that is left to be read.
--1. solution
So simulating the behavior of the editor, you have to do this:
- open the input and read the first block
- open an output file and read every remaining line and write to the output file
- close the files
without backup:
- delete the input file
- rename the output file to the name of the now deleted input file
with backup:
- rename the input file to some backup name before renaming the outputfile to the input file
Now you may go to the top and repeat the same with the next block.
--2. solution (how I would do it)
Another option might be to append each read line to a log file and when opening the input file to process the next block skip as many lines as the log file has (means for every line in the log file read one line in input and ignore)
This has the advantage, that you are not deleting anything and have a file, that contains the processed stuff (log file)
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.