Loop untidy

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Nairolf76
Posts: 1
Joined: 27 Feb 2017 15:33

Loop untidy

#1 Post by Nairolf76 » 27 Feb 2017 16:00

Hi there,

I tore my hair out all day long with my loop.
You will find below a part of my code which is used to split a pdf according an information in each page of the pdf.
Everything is fine if in my pdf file the %%i are in the same order as my batch, but if they not (if the first page of my pdf is the last number "000000015"), the loop does not work - only this last number is done. It's like it reads the code without using the "call".
Coding is not my background (english language either), so please be indulgent :)

["skip" corresponds to the line before finding the information in each page]

Code: Select all

:Matricule
set for_parameters="skip=%1 delims= "
set first=1
for /f %for_parameters% %%i in (%Fichier%.txt) do (
   if !first! == 1 (
      set first=0
      %DirSejda% extractpages -f "%Fichier%.pdf" -o %DossierFin% -s !_page!
      if "%%i"=="000000001" call :App1 %%i
      if "%%i"=="000000003" call :App2 %%i
      if "%%i"=="000000004" call :App3 %%i
      if "%%i"=="000000005" call :App4 %%i
      if "%%i"=="000000008" call :App5 %%i
      if "%%i"=="000000009" call :App6 %%i
      if "%%i"=="000000010" call :App7 %%i
      if "%%i"=="000000011" call :App8 %%i
      if "%%i"=="000000012" call :App9 %%i
      if "%%i"=="000000013" call :App10 %%i
      if "%%i"=="000000014" call :App11 %%i
      if "%%i"=="000000015" call :App12 %%i
      set Matricule=%%i
   )
)
exit


Next to the call:AppXX, there is another call and then another call with a goto :EOF

I'm lost :/

Thanks for your help :)

Post Reply