anchor.diff:  call:waitrandom 500
   goto:createthread
   
  +::%1 - png | jpg | gif
  +::%2 - thread number
   :typelog
   if %thread% equ 1 exit /b
   if not defined typenum%1%2 set "typenum%1%2=1"
  -call:typelogfile "%logfile%%1.%2" "typenum%1%2" %%typenum%1%2%% %1
  -exit /b
  -
  +call:typelogfile "%logfile%%1.%2" "typenum%1%2" %1
  +::call:typelogfile "%logfile%%1.%2" "typenum%1%2" %%typenum%1%2%% %1
  +exit /b
  +
  +::%1 - log file name (%logfile%)
  +::%2 - variable name - counter displayed files
  +::%3 - png | jpg | gif
   :typelogfile
   if not exist "%~1" exit /b
  -for /f "usebackq skip=%3 tokens=1-5 delims=;" %%b in ("%~1") do (
  +set "tmpnum=!%~2!"
  +for /f "usebackq skip=%tmpnum% tokens=1-5 delims=;" %%b in ("%~1") do (
   	if /i "%%d" equ "error" (
   		call:printfileerr "%%~b" "%%~c"
   	) else (
  -		call:printfileinfo "%%~b" %%c %%d %%e %%f
  +		call:printfileinfo "%%~b" %%c %%d %%e %%f %3
   	)
   	set /a "%~2+=1"
   )
   exit /b
   
  +::%1 - file name
  +::%2 - original size in byte
  +::%3 - optimize size in byte
  +::%4 - change (%2 - %3)
  +::%5 - percent change (%4*100/%2)
  +::%6 - png | jpg | gif
   :printfileinfo
   if "%~4" equ "0" (
   	>>"%filelisterr1%" echo.%~f1
   	exit /b
   )
   setlocal  
  -set "fn=%~nx1                                        "
  -set "xfnext=%~x1"
  -set "xfnlen=0"
  -set "xfnextlen=0"
  -call:strlen fn xfnlen
  -if %xfnlen% gtr 30 (
  -	call:strlen xfnext xfnextlen
  -	set /a "xfnextlen=30-!xfnextlen!-2"
  -	call set "fn=%%fn:~,%xfnextlen%%%..%xfnext%"
  -)
  +set "fn="
  +call:cropfilename fn %1 %TFN%
   set "origsize=%2"
   call:division origsize 1024 100
   set "origsize=          !origsize!"
  
positive.code: set "changePNG=0" & set "percPNG=0"
  set "changeJPG=0" & set "percJPG=0"
  set "changeGIF=0" & set "percGIF=0"
  set "TotalNumNOptJPG=0" & set "TotalNumNOptPNG=0" & set "TotalNumNOptGIF=0"
  set "stepJPG=0" & set "stepPNG=0" & set "stepGIF=0"
  if %jpeg% equ 0 if %png% equ 0 if %gif% equ 0 1>nul 2>&1 ping -n 1 -w 500 127.255.255.255 & goto:finmessage
  if %thread% gtr 1 (
  	for /f "tokens=1-5 delims=;" %%a in ('findstr /e /i /r /c:";ok" "%logfile%png*" ') do call:calcstep PNG %%b %%c
  	for /f "tokens=1-5 delims=;" %%a in ('findstr /e /i /r /c:";ok" "%logfile%jpg*" ') do call:calcstep JPG %%b %%c
  	for /f "tokens=1-5 delims=;" %%a in ('findstr /e /i /r /c:";ok" "%logfile%gif*" ') do call:calcstep GIF %%b %%c
  )
  for /f "tokens=1" %%a in ('findstr /e /i /r /c:";error" "%logfile%png*" 2^>nul ^| find /i /c ";error" 2^>nul') do (
  	set /a "TotalNumErrPNG+=%%a" & set /a "TotalNumPNG-=%%a"
  )
  
negative.code: ::%3 - thread number
  :savelog
  set /a "change=%~z1-%2"
  if %change% equ 0 call:saverrorlog %1 1
  set /a "perc=%change%*100/%2" 2>nul
  set /a "fract=%change%*100%%%2*100/%2" 2>nul
  set /a "perc=%perc%*100+%fract%"
  