@echo off
setlocal enableextensions enabledelayedexpansion

set wget=D:\Programs\wget\wget.exe -nd -O

set decoder=D:\Programs\UnixUtils\recode.exe  -q UTF-8:CP866

set DownloadTo=D:\tmp\currency.%date%.%random%

set outfile=D:\tmp\currency.%date%.%random%.tpl

set url=http://chbrr.crimea.com/

rem ˆ¬ï ¨á¯®«­ï¥¬®£® ä ©«  HPT.
rem Šà ©­¥ à¥ª®¬¥­¤®¢ ­® ãª §ë¢ âì ¯®«­®¥ ¨¬ï ä ©«  (¤¨áª, ¯ãâì ¨¬ï, à è¨à¥­¨¥).
set hptexe=D:\Fido\hpt\bin\hpt.exe

rem ˆ¬ï ä ©«  ª®­ë¨£ãà æ¨¨ HPT (fidoconfig).
rem Šà ©­¥ à¥ª®¬¥­¤®¢ ­® ãª §ë¢ âì ¯®«­®¥ ¨¬ï ä ©«  (¤¨áª, ¯ãâì ¨¬ï, à è¨à¥­¨¥).
set hptcfg=D:\Fido\hpt\hpt.cfg



%wget% %DownloadTo%.index.html %url%
if not %errorlevel%==0 goto End

 set /a xx=0

 FOR /F "skip=259 tokens=* delims=<> " %%a in (%DownloadTo%.index.html) do echo %%a>>%outfile%.tmp&set /a xx+=1&if !xx!==30 goto N1

:N1

 del /f/q %DownloadTo%.index.html

 %decoder%<%outfile%.tmp>%outfile%.tmp.866
 del /f/q %outfile%.tmp

 set /a xx=0
 set str= ³
 FOR /F "tokens=1,2,3,4,5,6* delims=<> " %%a in (%outfile%.tmp.866) do set /a xx+=1&Call :PareseStr !xx! %%a %%b %%c %%d %%e
 del /f/q %outfile%.tmp.866

 %hptexe% -c %hptcfg% post -s "Šãàáë ¢ «îâ ¢ ‘¨¬ä¥à®¯®«¥." -e "CRIMEA.BUSINESS" -z "%date% %time:~0,-6%" -o "Lame Users Breading, Crimea." -f loc,npd %outfile%
 del /f/q %outfile%

:End
exit

rem -----------------------------------------------------------

:PareseStr

   if %~1==1 (
      echo.>%outfile%&echo   %~2 %~3 %~4 %~5 %~6>>%outfile%
      echo  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>>%outfile%
      echo  ÚÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄ¿>>%outfile%
      exit /b
   )

   if %~1 gtr 4 (
   if %~1 lss 8 (
      set str=!str! %~6 ³
   )
   )

   if %~1==8 (
      echo !str!>>%outfile%
      echo  ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄ´>>%outfile%
      set str= ³
      exit /b
   )

   if %~1 gtr 11 (
   if %~1 lss 15 (
      set sss=        %~5 ³
      set str=!str!!sss:~-10!
   )
   )

   if %~1==15 (
      echo !str!>>%outfile%
      echo  ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄ´>>%outfile%
      set str= ³
      exit /b
   )

   if %~1 gtr 16 (
   if %~1 lss 20 (
      set sss=        %~5 ³
      set str=!str!!sss:~-10!
   )
   )

   if %~1==20 (
      echo !str!>>%outfile%
      echo  ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄ´>>%outfile%
      set str= ³
      exit /b
   )

   if %~1 gtr 21 (
   if %~1 lss 25 (
      set sss=        %~5 ³
      set str=!str!!sss:~-10!
   )
   )

   if %~1==25 (
      echo !str!>>%outfile%
      echo  ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄ´>>%outfile%
      set str= ³
      exit /b
   )

   if %~1 gtr 26 (
   if %~1 lss 30 (
      set sss=        %~5 ³
      set str=!str!!sss:~-10!
   )
   )

   if %~1==30 (
      echo !str!>>%outfile%
      echo  ÀÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÙ>>%outfile%
      echo.>>%outfile%&echo.>>%outfile%
      echo  ‚§ïâ® á "%url%".>>%outfile%&echo.>>%outfile%
      exit /b
   )


exit /b
