Nils_Berns
(Nils Berns)
January 24, 2021, 12:13pm
1
Hello
I have a Folder with txts named 1.txt ,2.txt,… and so on. Sorted in the way I want.
23 Files, created from a pdf with 23 pages.
Workflow: For each file in Folder ->Read text file → append line
The created txt has the pages sorted wrong. 1,10,11,12,…19,2,20,21,22,23,3,4,5,6,7,8,9
Ideas why this is messed up ?
I didn’t know the studiox but I can tell the logic.
Count the no of pages in PDF
Loop through each pages and take the data from there and write in a text file with name as pagenumber of pdf file through which it is iterating.
I think u should use write text file there.
Regards
Nived N
Happy Automation
Nils_Berns
(Nils Berns)
January 24, 2021, 12:36pm
3
doesn´t write text file delete all previous data ?
I will try it out.
edit: doesn´t work because it deletes the previos content
maybe I should get the files in order without numbers, but I will have documents with hundreds of pages
nv08
(Nilay Varshney)
January 24, 2021, 12:40pm
4
Are these files arranged in order. Just check once if the files named and page numbers matches
Nils_Berns
(Nils Berns)
January 24, 2021, 12:46pm
5
The files in the folder are in order , thats why i dont understand why they are not in order in the final file.
Thinking about rennaming them a,b,c,…,aa,ab like in EXCEL and try if this works.
nv08
(Nilay Varshney)
January 24, 2021, 12:52pm
6
Use assign activity in that assign directory.getfiles(“path of files”) to a variable.
Then use append text and take path from above variables
1 Like
Nils_Berns
(Nils Berns)
January 24, 2021, 1:19pm
7
I`ll try to use word files, maybe this works.
edit: will try your solution if the word one doesn´t work
Nils_Berns
(Nils Berns)
January 24, 2021, 2:16pm
8
I tried to use a freeware tool on the txts and it produced the same error , really strange.
ppr
(Peter Preuss)
January 24, 2021, 3:28pm
9
@Nils_Berns
the files are ordered in that way as it is lexically ordered (Line 1)
when we sort string numbers by a conversion to e.g. Int then the sort order is as expected 1<2<10
(Line 2)
Another way to handle a lexically ordered sequence is to left pad it (line3)
2 Likes
Hi @Nils_Berns … Please try with order by “Created Date oldest first” … I recently faced this error in Studio where I fixed this using order by create time and it solved. But in StudioX I do not see the create time. So please try this.
Are you trying to merging the file after you append the text?
In the mean time, I will check something here.
1 Like
ppr
(Peter Preuss)
January 24, 2021, 4:22pm
11
@Nils_Berns
Another way to handle a lexically ordered sequence is to left pad it. have a look here:
maybe you can incorporate it by the editing / creating the filenames
1 Like
Nils_Berns
(Nils Berns)
January 24, 2021, 4:24pm
12
I treid that, but unfortunately it didn´t work.
Link to the prgramm: Dropbox - AddText_PDFv2.rar - Simplify your life
Nils_Berns
(Nils Berns)
January 24, 2021, 4:39pm
13
I think that could work but I´m not experienced enough for this way.
I´ll try to go page by page now.
I have put all the actions in the first for every file in folder action , now I must find a way to delete the split pdfs and txts after creation so they didn´t get added up to often.
Nils_Berns:
The created txt has the pages sorted wrong. 1,10,11,12,…19,2,20,21,22,23,3,4,5,6,7,8,9
I checked your zip file and the output…everything has been matching with your pdf content…i checked page by page…I am still not sure, what is the problem here?
I also sent a private message , please check your notifications.
Nils_Berns
(Nils Berns)
January 24, 2021, 4:52pm
15
the order in the fodlers is correct but the final txt has a messed up order of pages
@Nils_Berns … Oh ok. got it now… what activity you used to combined the text files??
Nils_Berns
(Nils Berns)
January 24, 2021, 4:55pm
17
I solved it now!
switched to step by step process and deleting the split parts worked.
I used append line for all files in the folder with the txts
link solution: Dropbox - AddText_PDFv3.rar - Simplify your life
1 Like