Topic de megaler :

[HELP] Un Jean-batch pour m'aider en vitesse ?

  • 1

Salut les kheys :noel:

J'ai une rapide requête. Un khey m'a fait un batch pour délimiter des types de fichier d'après leur taille. Il m'a fait une version dont l'affichage des résultats dans le .txt est nickel comme je voulais pour l'intégrer à excel, mais a fait des modifs pour le rendre plus précis et n'a pas remis cet affichage final qui rendait sous forme de phrases les résultats, et malheureusement il doit être occupé donc pas dispo :hap: J'ai essayé de faire moi-même mais vraiment j'y connais quasi rien donc le programme se lance sans résultat. Je vous mets dans les messages suivants dans l'ordre les deux codes pour voir, mais pour résumer je voudrais savoir comment intégrer la partie suivante du premier code pour la faire fonctionner dans le deuxième :

if "%a4%"=="0" (goto a4skip)
if "%a4%"=="1" (set fichea4=fiche)

set "a=%a4% %fichea4% papier A4"
:a4skip

if "%a5%"=="0" (goto a5skip)
if "%a5%"=="1" (set fichea5=fiche)
if "%a6%"=="0" (set "a=%a% et %a5% %fichea5% papier A5" & goto a5skip)
if "%a4%"=="0" (set "a=%a5% %fichea5% papier A5" & goto a5skip)
if NOT "%a5%"=="0" (set "a=%a%, %a5% %fichea5% papier A5")

:a5skip

if "%a6%"=="0" (goto a6skip)
if "%a6%"=="1" (set fichea6=fiche)
if "%a5%"=="0" (set "a=%a6% %fichea6% papier A6")
if "%a7%"=="0" (set "a=%a% et %a6% %fichea6% papier A6" & goto a6skip)
if NOT "%a6%"=="0" (set "a=%a%, %a6% %fichea6% papier A6")

:a6skip

if "%a7%"=="0" (goto a7skip)
if "%a7%"=="1" (set fichea7=fiche)
if "%a6%"=="0" (set "a=%a7% %fichea7% papier A7")
if NOT "%a7%"=="0" (set "a=%a% et %a7% %fichea7% papier A7")
:a7skip

Du coup le premier code c'est ça (avec la présentation finale dont je parlais, l'extrait dans mon premier message) :

@echo off
cd %~p0
dir /a:d /b > list.txt
FOR %%A IN (list.txt) DO set size=%%~zA
IF "%size%"==0"" (
ECHO Aucun dossier trouver.
pause>nul
exit
)

echo Resultat : >a.txt
echo. >>a.txt
set a7=0
set a5=0
set a6=0
set a4=0
set fichea4=fiches
set fichea5=fiches
set fichea6=fiches
set fichea7=fiches
echo stop>>list.txt
for /f "tokens=2 delims=:" %%a in ('find /c /v "" list.txt') do set /a Lines=%%a
set /A Lines=%Lines%-1
echo Dossier trouver.
echo Nombre de dossier : %Lines%
echo Nom des dossier : 
set li=0
set li2=0
:retour

more +%li% list.txt>list2.txt
set /p string2=< list2.txt
set string3=%string2: =%
set /A li=%li%+1
if "%string3%"=="stop" (
goto all
)
dir /s /b %string3%\*.jpg >temp.txt
echo stop>>temp.txt
:retour2
more +%li2% temp.txt>temp2.txt
set /p string4=< temp2.txt

set string5=%string4: =%
set /a li2=%li2%+1

if "%string5%"=="stop" (goto oo)
goto else
:oo
set li2=0
echo Dossier : %string3% >> R.txt
if "%a4%"=="0" (goto a4skip)
if "%a4%"=="1" (set fichea4=fiche)

set "a=%a4% %fichea4% papier A4"
:a4skip

if "%a5%"=="0" (goto a5skip)
if "%a5%"=="1" (set fichea5=fiche)
if "%a6%"=="0" (set "a=%a% et %a5% %fichea5% papier A5" & goto a5skip)
if "%a4%"=="0" (set "a=%a5% %fichea5% papier A5" & goto a5skip)
if NOT "%a5%"=="0" (set "a=%a%, %a5% %fichea5% papier A5")

:a5skip

if "%a6%"=="0" (goto a6skip)
if "%a6%"=="1" (set fichea6=fiche)
if "%a5%"=="0" (set "a=%a6% %fichea6% papier A6")
if "%a7%"=="0" (set "a=%a% et %a6% %fichea6% papier A6" & goto a6skip)
if NOT "%a6%"=="0" (set "a=%a%, %a6% %fichea6% papier A6")

:a6skip

if "%a7%"=="0" (goto a7skip)
if "%a7%"=="1" (set fichea7=fiche)
if "%a6%"=="0" (set "a=%a7% %fichea7% papier A7")
if NOT "%a7%"=="0" (set "a=%a% et %a7% %fichea7% papier A7")
:a7skip

echo %a%>>R.txt
echo. >>R.txt

set a7=0
set a5=0
set a6=0
set a4=0
goto retour
:else
echo %string5%
FOR %%A IN (%string5%) DO set size5=%%~zA
set /a size5="%size5%/1000"
if %size5% LEQ 300 (
set /a a7="%a7%+1"
goto retour2
)
if %size5% LEQ 600 (
set /a a6="%a6%+1"
goto retour2
)

if %size5% LEQ 1200 (
set /a a5="%a5%+1"
goto retour2
)
if %size5% GEQ 1200 (
set /a a4="%a4%+1"
goto retour2
)
echo Possible error contact riyad.
pause>Nul


:all
timeout /t 2 >NUL
echo Fini
start R.txt
del Final.txt
del list.txt
del list2.txt
del temp.txt
del temp2.txt

bash ou rien

Mais sinon fait ça avec un langage lisible genre Python, là c'est une horreur, les goto j'ai vomi :(

C'est simple il suffit de backloop la variable d'ajustement structurel en combinant le facteur

Et le deuxième :

@echo off
cd %~p0
del error.txt
dir /a:d /b > list.txt
FOR %%A IN (list.txt) DO set size=%%~zA
IF "%size%"==0"" (
ECHO Aucun dossier trouver.
pause>nul
exit
)
echo Resultat : >a.txt
echo.>>a.txt
set a7=0
set a5=0
set a6=0
set a4=0
echo stop>>list.txt
for /f "tokens=2 delims=:" %%a in ('find /c /v "" list.txt') do set /a Lines=%%a
set /A Lines=%Lines%-1
echo Dossier trouver.
echo Nombre de dossier : %Lines%
echo Nom des dossier : 
set li=0
set li2=0
:retour

more +%li% list.txt>list2.txt
set /p string2=< list2.txt
set string3=%string2: =%
set /A li=%li%+1
if "%string3%"=="stop" (
goto all
)
echo %string3%
dir /s /b %string3%\*.jpg >temp.txt

FOR %%A IN (temp.txt) DO set size=%%~zA

echo stop>>temp.txt
echo Fichier en cours : 

:retour2
more +%li2% temp.txt>temp2.txt
set /p string4=< temp2.txt

set string5=%string4: =%
set /A li2=%li2%+1
if "%string5%"=="stop" (
set li2=0
echo Dossier : %string3% >> a.txt
echo A4 = %a4% >> a.txt
echo A5 = %a5% >> a.txt
echo A6 = %a6% >> a.txt
echo A7 = %a7% >> a.txt
echo. >>a.txt
set a7=0
set a5=0
set a6=0
set a4=0
goto retour
)

) else (
set "filename=%string5%"
For %%A in ("%filename%") do (
    set i=%%~nxA
)



set lef=%string3%\%i%
echo %lef%
echo %string5% | seed "s/ //g" > tiph.txt
set /p string7=<tiph.txt
exiftool -ImageSize %lef% | seed "s/Image Size                      : //g" > temp3.txt
set /p string=<temp3.txt
for /f "tokens=1 delims=x" %%a in ("%string%") do (
set x=%%a
)
set "y=%string:x=" & set "y=%"


if %x% GEQ 1200 (
 
if %x% LEQ 1600 (
 
if %y% GEQ 900 (
 
if %y% LEQ 1330 (
echo +1 A6
set /a a6="%a6%+1"
goto retour2
)
)
)
)

if %x% GEQ 1400 (
 
if %x% LEQ 1700 (
 
if %y% GEQ 2000 (
 
if %y% LEQ 2500 (
echo +1 A5
set /a a5="%a5%+1"
goto retour2
)
)
)
)

if %x% GEQ 2400 (
 
if %x% LEQ 2600 (
 
if %y% GEQ 2900 (
 
if %y% LEQ 3200 (
echo +1 A4
set /a a4="%a4%+1"
goto retour2
)
)
)
)
echo Error.
echo Problem with file : "%string5%">> error.txt
goto retour2
pause>nul
:all
timeout /t 2 >NUL
if exist "error.txt" start error.txt
start a.txt
del Final.txt
del list.txt
del list2.txt
del temp.txt
del temp2.txt

Le 21 mars 2022 à 01:50:45 :
C'est simple il suffit de backloop la variable d'ajustement structurel en combinant le facteur

https://image.noelshack.com/fichiers/2017/39/3/1506524542-ruth-perplexev2.png

Le 21 mars 2022 à 01:50:45 :
C'est simple il suffit de backloop la variable d'ajustement structurel en combinant le facteur

Le 21 mars 2022 à 01:50:41 :
bash ou rien

Mais sinon fait ça avec un langage lisible genre Python, là c'est une horreur, les goto j'ai vomi :(

mais j'y connais rien, c'est un khey qui a eu la gentillesse de me faire ça :rire:

Le 21 mars 2022 à 01:51:25 :

Le 21 mars 2022 à 01:50:45 :
C'est simple il suffit de backloop la variable d'ajustement structurel en combinant le facteur

https://image.noelshack.com/fichiers/2017/39/3/1506524542-ruth-perplexev2.png

Tu dashcard l'ip du routeur sur l'interface f0:1 en mode administrateur pour bootloop la config, compris ?

en bref dans le deuxième batch pour l'instant l'affichage final c'est

echo Dossier : %string3% >> a.txt
echo A4 = %a4% >> a.txt
echo A5 = %a5% >> a.txt
echo A6 = %a6% >> a.txt
echo A7 = %a7% >> a.txt
echo. >>a.txt

mais j'aimerais reprendre l'affichage du premier batch :ok:

Le 21 mars 2022 à 01:53:26 :

Le 21 mars 2022 à 01:51:25 :

Le 21 mars 2022 à 01:50:45 :
C'est simple il suffit de backloop la variable d'ajustement structurel en combinant le facteur

https://image.noelshack.com/fichiers/2017/39/3/1506524542-ruth-perplexev2.png

Tu dashcard l'ip du routeur sur l'interface f0:1 en mode administrateur pour bootloop la config, compris ?

j'imagine qu'on peut ensuite prompt le dir<p0 ? https://image.noelshack.com/fichiers/2017/16/1492605805-stickersystem32.png

Le 21 mars 2022 à 01:55:26 :

Le 21 mars 2022 à 01:53:26 :

Le 21 mars 2022 à 01:51:25 :

Le 21 mars 2022 à 01:50:45 :
C'est simple il suffit de backloop la variable d'ajustement structurel en combinant le facteur

https://image.noelshack.com/fichiers/2017/39/3/1506524542-ruth-perplexev2.png

Tu dashcard l'ip du routeur sur l'interface f0:1 en mode administrateur pour bootloop la config, compris ?

j'imagine qu'on peut ensuite prompt le dir<p0 ? https://image.noelshack.com/fichiers/2017/16/1492605805-stickersystem32.png

Ça se fait plus depuis 1997, mets-toi à jour

nan mais je vous jure ce langage du démon me rend fou https://image.noelshack.com/fichiers/2016/50/1481878288-asile2.jpg
:up: last try mais forcément qu'un pavé comme ça est pas motivant :-(
  • 1

Données du topic

Auteur
megaler
Date de création
21 mars 2022 à 01:49:19
Nb. messages archivés
14
Nb. messages JVC
14
En ligne sur JvArchive 226