prems=true lastone="" delaicaractere=400 Set WshShell = WScript.CreateObject("WScript.Shell") Set oFSO = CreateObject("Scripting.FileSystemObject") prev="" 'msgbox Wscript.ScriptFullName curdir= Left(Wscript.ScriptFullName, InStrRev(Wscript.ScriptFullName, "\")) chantier=curdir & "\chantier.txt" If not oFSO.FileExists(chantier) Then msgbox "pas de fichier " & chantier wscript.quit End If dim fi set fi=oFso.opentextfile(chantier) coran=trim(fi.readline) attente=trim(fi.readline) lesuivant=trim(fi.readline) nbpa=trim(fi.readline) fi.close If not oFSO.FolderExists(coran & "-" & nbpa ) Then oFso.createfolder (coran & "-" & nbpa ) End If nbc=len(nbpa) nbc=len(nbpa) info "démarrage" wscript.sleep 1000 wshshell.appactivate "mets" rep=msgbox ("vous pouvez ajuster le dossier " & coran & vbcrlf & _ "(affichr mode document, et l'ouvrir ) " & vbcrlf & _ "(le positionner en bas d'écran, large, plus jeunes en haut) " & vbcrlf & _ "Placez le curseur sur l'image de la page " & lesuivant & vbcrlf & coran & vbcrlf & " (SANS Y FAIRE DE CLIC) " & vbcrlf & _ "frapper au clavier",1,"Automate d'aspiration d'images via Firefox") if rep<>1 then effacer 1' info "" wscript.quit end if while int(lesuivant) <= int(nbpa) if ofso.fileexists(curdir & "pause.txt") then msgbox "efacez le fiviheir pause.txt et frrappez entrer" end if nomfi=curdir & coran & "-" & nbpa & "\" &right("00000" & lesuivant,nbc) &".jpg" nomsent=nomfi if not prems then nomsent= right("00000" & lesuivant,nbc) &".jpg" prems=false if oFso.fileexists(nomfi) then ofso.deletefile( nomfi) end if if lesuivant>1 then lastone=curdir & coran & "-" & nbpa & "\" &right("00000" & lesuivant-1,nbc) & ".jpg" if len(lastone)>1 and not oFso.fileexists(lastone) then msgbox "GAFFE le précedent n'y est pas " & vbcrlf & lastone & "prochain " & vbcrlf & nomfi info "" wscript.quit end if wscript.sleep 1000 info "envoyer sauvegarde pour " & nomfi envoyer "²", 1000 envoyer "S",2000 texte nomsent wscript.sleep 5000 irep=0 while (irep<10) and not oFso.fileexists(nomfi) irep=irep+1 info "envoyer relance n " & irep & " sauvegarde pour " & nomfi' texte vbcr wscript.sleep 5000 wend trouve=true if not oFso.fileexists(nomfi) then 'info "pas retrouve: " & nomfi msgbox "PAS RETROUVE apres 5 secondes " & vbcrlf & nomfi wscript.quit trouve=false ' effacer 2' info "" ' wscript.quit end if if trouve then ' vérifier lastone <> nomfi if len(lastone)>0 then info "comparer precedent et " & nomfi id=true set f1=oFso.opentextfile(nomfi) set f2=oFso.opentextfile(lastone) while id and (not f1.atendofstream ) and (not f2.atendofstream) c1=f1.read(1) c2=f2.read(1) if c1<>c2 then id=false wend if id and f1.atendofstream and f2.atendofstream then msgbox "deux dernier identiques " & vbcrlf & lastone & vbcrlf & nomfi wscript.quit f1.close f2.close oFso.deletefile (nomfi) trouve=false end if f1.close f2.close end if end if ' trouve if trouve then lastone=nomfi lesuivant=lesuivant+1 if int(lesuivant) <= int(nbpa) then ' mettre à jour le chantier ofso.deletefile(chantier) set fi=oFso.createtextfile(chantier) fi.writeline coran fi.writeline attente fi.writeline lesuivant fi.writeline nbpa fi.close info "passer page suivante, doit etre " & lesuivant envoyer "%d" ,100 'haut de page for t=1 to 13 envoyer "{tab}",100 next 't wscript.sleep 1000 envoyer "{enter}",1000 info "page " & lesuivant & " demandée attendre " & attente & " secondes" else info "essai de relance de la sauvegarde dans " & attente & " secondes" end if ' trouve nbsectot=attente while nbsectot >0 info "page " & lesuivant & " demandée attendre " & attente & " secondes reste: " & nbsectot nbsectot=nbsectot-10 wscript.sleep 10000 wend end if wend 'lesuivant<=page msgbox "termine car " & (lesuivant) & ">" & (nbpa) effacer "3 au bout " & lesuivant & ">" & nbpa ' info "" sub texte (t ) nt="" for i=1 to len(t) q=mid(t,i,1) 'if instr("/\: =",q)>0 then q="_" if q=vbcr then q="%E" nt=nt & q next ' msgbox nt wshshell.sendkeys nt end sub sub envoyer (quoi,delai) q=quoi if q=vbcr then q="{enter}" wshshell.sendkeys q wscript.sleep delai end sub sub info (quoi) if len(prev)>0 then if oFso.fileexists(prev) then oFso.deletefile(prev) end if end if if len(quoi) >0 then stamp=now & "_" & quoi & ".info" tampon="" for i=1 to len(stamp) c=mid(stamp,i,1) if instr("/\: =",c)>0 then c="_" tampon=tampon & c next prev=curdir & coran & "-" & nbpa & "\Info_" & tampon ' msgbox prev ofso.createtextfile (prev) wscript.sleep 1000 ' msgbox "created" end if end sub sub effacer (n) 'msgbox "effacer " & n info "" end sub