AntiGuide: AutomateMeteociel2022



PagePrincipale :: DerniersChangements :: ParametresUtilisateur :: Vous êtes 216.73.216.198 :: Signaler un abus :: le: 20250730 03:08:13
remplace AutomateMeteociel2018,
20220117 suivre : AutomateMeteociel2023
suite à quelques modification du site
remplace le programme frère de la page: AutomateMeteociel, le reste inchangé


(ensuite, fusion avec fichier Klimaloggpro, lire: KlimaloggProFusionMeteoCiel)
nécessite Wget
se joue sur vostro xp dans dossier c:\users\adminpo\desktop\meteo accessible par un raccourci sur le bureau: "meteo et chauffage"

en détail
set stampdeb=aaaammdd
set stampfin=aaaammdd
rem 7040: dieppe, 7249: orleans (à découvrir en demandant tableau statistique sur le site MeteoCiel?)
set ville=7040
u 2022

fast:
an 2022 u
pour set dans u: an 2018



modif 20220210
en-tete sur fichier meteo
an.bat (fait set stampdeb et fin et lance u)
filtrer meteo 1023° (trouvé en 2021!)
corrigé bug si aucun klima

20220212
;
nettoyage meteo
an passe appel à u
remplce
par vide


gaffe pas d'archives antérieuresq à 2018

journal
parfois page décalée, (manque colonnes et le fitre se trompe de valeur ecempl 2018abant 20h
on pourrait bisser et comparer iudentiques

an.bat
del 7249_20180327-20180327.txt
set ville=7249
set a=0101
set stampdeb=%1%a%
rem set stampdeb=20180327
set a=1231
set stampfin=%1%a%
rem set stampfin=20180327
u %1


gr.bat
set ville=7249

set a=0101
set meteodeb=%1%a%
set a=1231
set meteofin=%1%a%
set a=0101
set stampdeb=%1%a%
set a=1231
set stampfin=%1%a%
set k=20220206-1100.csv
set k=20180120-0800.csv
rem 20190316-1730.csv
cscript andpart.vbs %k% 7249_%meteodeb%-%meteofin%.txt


u.bat (remplacer %!% par "% % sans espace")
@echo off
rem echo on
rem si premier parametre -: appel interne ne pas recalculer nomfi
rem prévoir sortie hiératchise selon ??????
rem envisager dates butoir et si %nomf > ne rien faire
rem en cours entete sur fichier meteo

if $%1 == $ goto doc
if $%1 == $- goto interne
if $%stampdeb% == $ goto setdeb
if $%stampfin% == $ goto setfin
if $%ville% == $ goto setville

set nomfi=%ville%_%stampdeb%-%stampfin%.txt
echo sortie vers %nomfi%
goto faire
:interne
shift
:faire
if $%2 == $ goto an
if $%3 == $ goto mois
rem
rem GAFFE: le deuxième est le mois 01-12 et le troisième le mois aussi mais de 00-11 qui est utilisé sur le site web
rem à créer par un .vbs
set stamp=%1%2%4
echo %stamp% %stampdeb% %stampfin%
if %stamp% LSS %stampdeb% goto done1
if %stamp% GTR %stampfin% goto done1
goto ouf
:done1 
rem pause
goto done
:ouf
echo -----------stamp: %stamp%
rem 7240 7040
"c:\Program Files\GnuWin32\bin\wget.exe" --no-check-certificate -o html\%stamp%.log -O html\%stamp%.html "http://www.meteociel.com/temps-reel/obs_villes.php?code2=%ville%&jour2=%4&mois2=%3&annee2=%1&envoyer=OK" 2>err.txt
cscript html2txt.vbs html\%stamp%.html 1> jour.txt 
rem pause
type jour.txt | find "%stamp%" >> %nomfi%
rem del html\%stamp%.html
rem del html\%stamp%.log
goto done

:done
rem pause
goto done

:mois
rem echo mois %2


if %2 == 01 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) do call u.bat - %1 %2 00 %!%j 31
rem annees bisextiles
if %1%2 == 200802 goto bi
if %1%2 == 201202 goto bi
if %1%2 == 201602 goto bi
if %1%2 == 202002 goto bi
if %1%2 == 202402 goto bi
rem année non bissecstile
if %2 == 02 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28) do call u.bat - %1 %2 01 %!%j 28
goto mars
:bi
rem année bissectile
if %2 == 02 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29) do call u.bat - %1 %2 01 %!%j 29
:mars
if %2 == 03 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) do call u.bat - %1 %2 02 %!%j 31
if %2 == 04 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) do call u.bat - %1 %2 03 %!%j 30
if %2 == 05 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) do call u.bat - %1 %2 04 %!%j 31
if %2 == 06 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) do call u.bat - %1 %2 05 %!%j 30
if %2 == 07 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) do call u.bat - %1 %2 06 %!%j 31
if %2 == 08 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) do call u.bat - %1 %2 07 %!%j 31
if %2 == 09 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) do call u.bat - %1 %2 08 %!%j 30
if %2 == 10 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) do call u.bat - %1 %2 09 %!%j 31
if %2 == 11 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) do call u.bat - %1 %2 10 %!%j 30
if %2 == 12 for %!%j in (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) do call u.bat - %1 %2 11 %!%j 31
goto done
:an
if exist %nomfi% goto fodel
echo>%nomfi% AAAAMMJJHH;temp;
rem 20220210 je ne sais pourquoi exception 2016
if %1==2016 goto an2016
for %!%m in (01 02 03 04 05 06 07 08 09 10 11 12) do call u.bat - %1 %!%m
goto done
:an2016
for %!%m in (01 02 03 04 05 06 07 08 09 10 11 12) do call u.bat - %1 %!%m
goto done
:fodel
echo fichier %nomfi% existe! try again.
goto done

:setdeb
echo set stampdeb=AAAAMMJJ 
goto done
:setfin
echo set stampfin=AAAAMMJJ 
goto done
:setville
echo set ville=nnnn 
goto done
:doc
echo set ville=nnnnn (7040: dieppe, 7240: orléans)
echo set stampdeb=aaaammjj
echo set stampfin=aaaammjj
echo U.BAT AAAA
echo U.BAT AAAA MM
echo U.BAT AAAA MM mm jj 
echo (MM est le mois de 01 à 12, mm de 00 à 11)
echo fusionner avec la sortie de  klimaloggpro pa la commande:
echo cscript and.vbs  klimalogpro.csv  %stampdeb%-%stampfin%.txt
:done


filtrage temperature dans page quotidienne
' extraction d'un .csv avec température d'une capture page meteociel
' bug si futur 
' butoir non utilisé!

butoir=now
butoir=mid(butoir,7,4) & mid(butoir,4,2) & mid(butoir,1,2)
'msgbox butoir ' pour ne pas dépasser heure actuelle
 Set Out = WScript.StdOut
out.writeline " en cours"
 Set WshShell = CreateObject("WScript.Shell")
set fso=createobject("scripting.filesystemobject")
if wscript.arguments.count=0 then 
  msgbox "appel  .html"
   wscript.quit
 end if
racine=wscript.arguments(0)
'if racine>="html\" & butoir then wscript.quit ' > au lieu de >= sinon pas 24 jeures!
set fi=fso.opentextfile(racine)
'msgbox racine
dim tot
vecteur="" ' racine ' mid(racine,1,len(racine)-len(".html"))

dim parheure(24)
' lire TOUT le fichier
while not fi.atendofstream
  tot=tot & fi.readline
wend
out.writeline "tot:"&len(tot)
j=1
' rechercher dernière heure
'allera "h00"
top=23
trouve=false
while top>0 and not trouve 
trouve= allera (">"&top&" h<")
if not trouve then
 ' msgbox "pas trouvé >"&top&" h<"
  top=top-1
end if
wend
out.writeline "top du haut = dernière heure :"&top
'prem=mid(tot,j+1,2)
prem=top
' msgbox tpof 
'msgbox "prem (debier:) "&prem
j=1

for x=0 to prem 
'20220211 se proteger contre ligne sans °C
if x<prem then 
  hlim=prem-x-1
     limite=">"&hlim&" h<"
     out.writeline "limite="&limite & " a " & instr(tot,limite)
 end if ' limite 
heure=prem -x
borne=j
out.writeline "exam heure " & heure & " h a partir de j:"&j

a1=allerah (heure & " h")
if not a1 then out.writeline "h pas trouve"
out.writeline heure & " h trouv& à j="&j
a2=alleraC (" °C")
if not a2 then out.writeline "C pas trouve"

' °C trouve a J global
out.writeline "avance °C  trouve a "&j&" ok si < a "&instr(tot,limite)& " " & limite
  if j>instr(tot,limite) and x<prem then
' BUG DSI PS DERNIER
  parheure (prem-x)= ""
   out.writeline "pas de °C avant limite:"&limite & " a " & instr(tot,limite)
   j=borne
  else
jj=j
' reculer a > ou ;
while (mid(tot,jj,1)<>">")and(mid(tot,jj+1,1) <>";")
jj=jj-1
wend

'if (mid(tot,jj+1,1) <>"<")and(mid(tot,jj+1,1) <>";") then parheure (prem-x)= mid(tot,jj+1,j-jj-1)
' si on a recule à ; avancer de 1
if mid(tot,jj+1,1)=";" then jj=jj+1
parheure (prem-x)= mid(tot,jj+1,j-jj-1)
out.writeline "parheure:"&mid(tot,jj+1,j-jj-1)
end if
next ' for heur peut-etre X

jour=mid(racine,1,instr(racine,".")-1)
jour=mid(jour, instr(jour,"\")+1)

for x=0 to prem 
x2="0" & x
if len(x2)=3 then x2=mid(x2,2)
rem out.writeline jour & x2  & " " & parheure(x)
out.writeline jour & x2  & ";" & parheure(x)&";"
next ' for heure 


function allera (aiguille)
out.writeline "aller a "&aiguille&" à partir de "&j
pastouch=j
' msgbox "allera " & aiguille
trouve=false
while (not trouve) and (j<len(tot)-len(aiguille))
  trouve= mid(tot,j,len(aiguille))=aiguille
  if not trouve then j=j+1
wend
' msgbox "aller a " & aiguille & vbcrlf & j & "/" & len(tot)
allera=trouve
if not trouve then 
   j=pastouch
   out.writeline "pas trouve a j restaure a "&pastouch
end if

end function

function alleraH (aiguille)
out.writeline "aller a "&aiguille&" à partir de "&j
pastouch=j
' msgbox "allera " & aiguille
trouve=false
while (not trouve) and (j<len(tot)-len(aiguille))
  trouve= mid(tot,j,len(aiguille))=aiguille
  if not trouve then j=j+1
wend
' msgbox "aller a " & aiguille & vbcrlf & j & "/" & len(tot)
alleraH=trouve
if not trouve then 
   j=pastouch
   out.writeline "pas trouve a j restaure a "&pastouch
end if

end function
function alleraC (aiguille)
out.writeline "aller a "&aiguille&" à partir de "&j
pastouch=j
' msgbox "allera " & aiguille
trouve=false
while (not trouve) and (j<len(tot)-len(aiguille))
  trouve= mid(tot,j,len(aiguille))=aiguille
  if not trouve then j=j+1
wend
' msgbox "aller a " & aiguille & vbcrlf & j & "/" & len(tot)
alleraC=trouve
if not trouve then 
   j=pastouch
   out.writeline "pas trouve a j restaure a "&pastouch
end if

end function
' extraction d'un .csv avec température d'une capture page meteociel
' bug si futur 
' butoir non utilisé!

butoir=now
butoir=mid(butoir,7,4) & mid(butoir,4,2) & mid(butoir,1,2)
'msgbox butoir ' pour ne pas dépasser heure actuelle
 Set Out = WScript.StdOut
out.writeline " en cours"
 Set WshShell = CreateObject("WScript.Shell")
set fso=createobject("scripting.filesystemobject")
if wscript.arguments.count=0 then 
  msgbox "appel  .html"
   wscript.quit
 end if
racine=wscript.arguments(0)
'if racine>="html\" & butoir then wscript.quit ' > au lieu de >= sinon pas 24 jeures!
set fi=fso.opentextfile(racine)
'msgbox racine
dim tot
vecteur="" ' racine ' mid(racine,1,len(racine)-len(".html"))

dim parheure(24)
' lire TOUT le fichier
while not fi.atendofstream
  tot=tot & fi.readline
wend
out.writeline "tot:"&len(tot)
j=1
' rechercher dernière heure
'allera "h00"
top=23
trouve=false
while top>0 and not trouve 
trouve= allera (">"&top&" h<")
if not trouve then
 ' msgbox "pas trouvé >"&top&" h<"
  top=top-1
end if
wend
out.writeline "top du haut = dernière heure :"&top
'prem=mid(tot,j+1,2)
prem=top
' msgbox tpof 
'msgbox "prem (debier:) "&prem
j=1

for x=0 to prem 
'20220211 se proteger contre ligne sans °C
if x<prem then 
  hlim=prem-x-1
     limite=">"&hlim&" h<"
     out.writeline "limite="&limite & " a " & instr(tot,limite)
 end if ' limite 
heure=prem -x
borne=j
out.writeline "exam heure " & heure & " h a partir de j:"&j

a1=allerah (heure & " h")
if not a1 then out.writeline "h pas trouve"
out.writeline heure & " h trouv& à j="&j
a2=alleraC (" °C")
if not a2 then out.writeline "C pas trouve"

' °C trouve a J global
out.writeline "avance °C  trouve a "&j&" ok si < a "&instr(tot,limite)& " " & limite
  if j>instr(tot,limite) and x<prem then
' BUG DSI PS DERNIER
  parheure (prem-x)= ""
   out.writeline "pas de °C avant limite:"&limite & " a " & instr(tot,limite)
   j=borne
  else
jj=j
' reculer a > ou ;
while (mid(tot,jj,1)<>">")and(mid(tot,jj+1,1) <>";")
jj=jj-1
wend

'if (mid(tot,jj+1,1) <>"<")and(mid(tot,jj+1,1) <>";") then parheure (prem-x)= mid(tot,jj+1,j-jj-1)
' si on a recule à ; avancer de 1
if mid(tot,jj+1,1)=";" then jj=jj+1
parheure (prem-x)= mid(tot,jj+1,j-jj-1)
out.writeline "parheure:"&mid(tot,jj+1,j-jj-1)
end if
next ' for heur peut-etre X

jour=mid(racine,1,instr(racine,".")-1)
jour=mid(jour, instr(jour,"\")+1)

for x=0 to prem 
x2="0" & x
if len(x2)=3 then x2=mid(x2,2)
rem out.writeline jour & x2  & " " & parheure(x)
out.writeline jour & x2  & ";" & parheure(x)&";"
next ' for heure 


function allera (aiguille)
out.writeline "aller a "&aiguille&" à partir de "&j
pastouch=j
' msgbox "allera " & aiguille
trouve=false
while (not trouve) and (j<len(tot)-len(aiguille))
  trouve= mid(tot,j,len(aiguille))=aiguille
  if not trouve then j=j+1
wend
' msgbox "aller a " & aiguille & vbcrlf & j & "/" & len(tot)
allera=trouve
if not trouve then 
   j=pastouch
   out.writeline "pas trouve a j restaure a "&pastouch
end if

end function

function alleraH (aiguille)
out.writeline "aller a "&aiguille&" à partir de "&j
pastouch=j
' msgbox "allera " & aiguille
trouve=false
while (not trouve) and (j<len(tot)-len(aiguille))
  trouve= mid(tot,j,len(aiguille))=aiguille
  if not trouve then j=j+1
wend
' msgbox "aller a " & aiguille & vbcrlf & j & "/" & len(tot)
alleraH=trouve
if not trouve then 
   j=pastouch
   out.writeline "pas trouve a j restaure a "&pastouch
end if

end function
function alleraC (aiguille)
out.writeline "aller a "&aiguille&" à partir de "&j
pastouch=j
' msgbox "allera " & aiguille
trouve=false
while (not trouve) and (j<len(tot)-len(aiguille))
  trouve= mid(tot,j,len(aiguille))=aiguille
  if not trouve then j=j+1
wend
' msgbox "aller a " & aiguille & vbcrlf & j & "/" & len(tot)
alleraC=trouve
if not trouve then 
   j=pastouch
   out.writeline "pas trouve a j restaure a "&pastouch
end if

end function




exemple
AAAAMMJJHH;temp;
2022010100;7.4;
2022010101;7.7;
2022010102;6.2;
2022010103;6.1;
2022010104;6.5;
2022010105;6.6;
2022010106;5.8;
2022010107;5.7;
2022010108;4.3;
2022010109;5.2;
2022010110;7.1;
2022010111;9.1;
2022010112;10.4;
2022010113;12.2;
2022010114;13.5;
2022010115;14.2;
2022010116;13.8;
2022010117;12.8;
2022010118;11.1;
2022010119;10.5;
2022010120;10;
2022010121;10.2;
2022010122;10;
2022010123;8.6;
2022010200;8.7;
2022010201;9.1;
2022010202;9.6;
2022010203;9.2;
2022010204;9.6;
2022010205;10.4;
2022010206;10.8;
2022010207;11.5;
2022010208;11.5;
2022010209;11.4;
2022010210;11.1;
2022010211;12;
2022010212;12.4;
2022010213;13.1;
2022010214;13;
2022010215;13.1;
2022010216;12.7;
2022010217;12.7;
2022010218;12.5;
2022010219;12.2;
2022010220;12;
2022010221;11.8;
2022010222;11.5;
2022010223;11.4;
2022010300;11.3;