Aide et conseils concernant AutoIt et ses outils.
Anthony
Niveau 6
Messages : 293 Enregistré le : lun. 17 janv. 2011 14:08
Localisation : France
Status :
Hors ligne
#1
Message
par Anthony » mar. 20 juin 2017 03:13
Bonjour à tous,
Voici mon problème avec les log de MediaInfo qui me paraissait simple à régler avec les caractères spéciaux àçéèù...
Voici le fichier original
mais le résultat dans une autre application est le suivant
StreamSize/String4 : 69.90 MiB
Title : Audio DTS Français X
Le ç de Français se retrouve écris ç j'ai donc tenté de le sauvegarder avec le "Bloc-Notes" de Windows 10 en format ANSI
Le résultat est correct et utilisable mais je dois faire la manip à chaque fois, ce qui est très dérangeant
StreamSize/String4 : 69.90 MiB
Title : Audio DTS Français X
J'ai essayé plusieurs codes mais sans succès auriez-vous une petite idée
Merci d'avance.
Modifié en dernier par
Anthony le mer. 12 juil. 2017 07:25, modifié 3 fois.
jchd
AutoIt MVPs (MVP)
Messages : 2273 Enregistré le : lun. 30 mars 2009 22:57
Localisation : Sud-Ouest de la France (43.622788,-1.260864)
Status :
Hors ligne
#2
Message
par jchd » mar. 20 juin 2017 10:55
Code : Tout sélectionner
#include <FileConstants.au3>
Local Const $sFilePath = "MediaInfo.txt"
Local $sData = FileRead($sFilePath)
Local $hFile = FileOpen("ANSI " & $sFilePath, $FO_OVERWRITE + $FO_ANSI)
FileWrite($hFile, $sData)
FileClose($hFile)
La cryptographie d'aujourd'hui c'est le taquin plus l'électricité.
Anthony
Niveau 6
Messages : 293 Enregistré le : lun. 17 janv. 2011 14:08
Localisation : France
Status :
Hors ligne
#3
Message
par Anthony » mar. 20 juin 2017 22:12
Bonjour jchd,
Un grand merci, c'est que du bonheur... Simple et efficace, çà fonctionne, je peux donc mettre ce post en résolu.
Et dire que j'étais en train de chercher bien plus compliqué
Merci jchd
Anthony
Niveau 6
Messages : 293 Enregistré le : lun. 17 janv. 2011 14:08
Localisation : France
Status :
Hors ligne
#4
Message
par Anthony » dim. 09 juil. 2017 18:23
Voilà que je pensait mon problème résolu mais là c'est étrange
voir si je dois créer un nouveau topic pas de soucis.
Dans ce log ("MediaInfo.txt" en pièce-jointe) voici ce que me retourne Scite, et le résultat est le même dans le fichier exporté
Le ligne 5|Subtitle|6|S_TEXT/UTF8|fr|fra|Yes|Yes|
FR Forcé | ne m'affiche correctement le résultat attendu
FR Forcé
Code : Tout sélectionner
0|Video|1|V_MPEGH/ISO/HEVC|02:12:52.348|3840|1600|23.976||24000|1001||00:00:00.000|en|eng|Yes|No||
1|Audio|2|A_TRUEHD|02:12:52.340|00:00:00.000|en|eng|No|No|Dolby Atmos TrueHD 7.1 @ 3951 kbps - Blu-ray CEE|
2|Audio|3|A_DTS|02:12:52.427|00:00:00.000|fr|fra|Yes|No|DTSHD MA|
3|Audio|4|A_DTS|02:12:52.427|00:00:00.000|en|eng|No|No|DTSHD MA|
4|Subtitle|5|S_TEXT/UTF8|en|eng|No|No||
5|Subtitle|6|S_TEXT/UTF8|fr|fra|Yes|Yes|FR Forcé|
6|Subtitle|7|S_TEXT/UTF8|fr|fra|No|No|FULL FR|
100|Chapters|00:00:00.000=en:00:00:00.000|00:08:40.270=en:00:08:40.270|00:18:55.718=en:00:18:55.718|00:28:23.660=en:00:28:23.660|00:38:34.187=en:00:38:34.187|00:48:08.594=en:00:48:08.594|00:58:19.246=en:00:58:19.246|01:09:14.692=en:01:09:14.692|01:17:26.392=en:01:17:26.392|01:29:33.660=en:01:29:33.660|01:38:02.085=en:01:38:02.085|01:50:27.871=en:01:50:27.871|01:59:04.471=en:01:59:04.471|02:04:11.944=en:02:04:11.944|
Je ne vois pas ce qui cloche (Scite, MediaInfo...?) avez-vous une idée ?
Je vous met ma ligne de commande MediaInfo
Code : Tout sélectionner
"MediaInfo.exe" "Video.mkv" --Full --BOM --Language=raw --LogFile=MediaInfo.txt
Mon code actuel
► Afficher le texte
#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.1 Author: myName Script Function: UNICODE 2 ANSI. #ce ---------------------------------------------------------------------------- #include <FileConstants.au3> $MediaInfo = @ScriptDir & "\MediaInfo.txt" ;~ $MediaInfo = $CmdLine[1] $MediaInfo2 = @ScriptDir & "\MediaInfo_ANSI.txt" Global $Tracks If $CmdLine [ 0 ] = 1 Or $MediaInfo Then Local $sData = FileRead ( $MediaInfo ) ;~ Local $hFile = FileOpen( $MediaInfo2, $FO_OVERWRITE + 512) Local $hFile = FileOpen ( $MediaInfo2 , BitOR ( $FO_UTF8_NOBOM , $FO_OVERWRITE ) ) $sData = StringReplace ( $sData , @CRLF
& @CRLF , Chr ( 1 ) ) $StringSplit = StringSplit ( $sData , Chr ( 1 ) ) For $i = 1 To $StringSplit [ 0 ] ; Tout MediaInfo If StringMid ( $StringSplit [ $i ] , 1 , 5 ) = "Video" Then $Split = StringSplit ( $StringSplit [ $i ] , @CRLF
& @CRLF ) Local $Track [ 18 ] For $j = 1 To $Split [ 0 ] If StringInStr ( $Split [ $j ] , "StreamOrder : " ) Then $Track [ 1 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "ID : " ) Then $Track [ 2 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "CodecID : " ) Then $Track [ 3 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Duration/String3 : " ) Then $Track [ 4 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Width : " ) Then $Track [ 5 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Height : " ) Then $Track [ 6 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "FrameRate : " ) Then $Track [ 7 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "ScanType : " ) Then $Track [ 8 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "FrameRate_Num : " ) Then $Track [ 9 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "FrameRate_Den : " ) Then $Track [ 10 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Interlacement : " ) Then $Track [ 11 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Delay/String3 : " ) Then $Track [ 12 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Language : " ) Then $Track [ 13 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Language/String3 : " ) Then $Track [ 14 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Default : " ) Then $Track [ 15 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Forced : " ) Then $Track [ 16 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Title : " ) Then $Track [ 17 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) Next $Tracks &= $Track [ 1 ] & '|' & 'Video' & '|' & $Track [ 2 ] & '|' & $Track [ 3 ] & '|' & $Track [ 4 ] & '|' & $Track [ 5 ] & '|' & $Track [ 6 ] & '|' & $Track [ 7 ] & '|' & $Track [ 8 ] & '|' & $Track [ 9 ] & '|' & _
$Track [ 10 ] & '|' & $Track [ 11 ] & '|' & $Track [ 12 ] & '|' & $Track [ 13 ] & '|' & $Track [ 14 ] & '|' & $Track [ 15 ] & '|' & $Track [ 16 ] & '|' & $Track [ 17 ] & '|' & @CRLF EndIf If StringMid ( $StringSplit [ $i ] , 1 , 5 ) = "Audio" Then $Split = StringSplit ( $StringSplit [ $i ] , @CRLF
& @CRLF ) Local $Track [ 11 ] For $j = 1 To $Split [ 0 ] If StringInStr ( $Split [ $j ] , "StreamOrder : " ) Then $Track [ 1 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "ID : " ) Then $Track [ 2 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "CodecID : " ) Then $Track [ 3 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Duration/String3 : " ) Then $Track [ 4 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Delay/String3 : " ) Then $Track [ 5 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Language : " ) Then $Track [ 6 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Language/String3 : " ) Then $Track [ 7 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Default : " ) Then $Track [ 8 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Forced : " ) Then $Track [ 9 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Title : " ) Then $Track [ 10 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) Next $Tracks &= $Track [ 1 ] & '|' & 'Audio' & '|' & $Track [ 2 ] & '|' & $Track [ 3 ] & '|' & $Track [ 4 ] & '|' & $Track [ 5 ] & '|' & $Track [ 6 ] & '|' & $Track [ 7 ] & '|' & $Track [ 8 ] & '|' & $Track [ 9 ] & '|' & _
$Track [ 10 ] & '|' & @CRLF EndIf If StringMid ( $StringSplit [ $i ] , 1 , 4 ) = "Text" Then $Split = StringSplit ( $StringSplit [ $i ] , @CRLF
& @CRLF ) Local $Track [ 9 ] For $j = 1 To $Split [ 0 ] If StringInStr ( $Split [ $j ] , "StreamOrder : " ) Then $Track [ 1 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "ID : " ) Then $Track [ 2 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "CodecID : " ) Then $Track [ 3 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Language : " ) Then $Track [ 4 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Language/String3 : " ) Then $Track [ 5 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Default : " ) Then $Track [ 6 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Forced : " ) Then $Track [ 7 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) If StringInStr ( $Split [ $j ] , "Title : " ) Then $Track [ 8 ] = StringMid ( $Split [ $j ] , 36 , StringLen ( $Split [ $j ] ) ) Next $Tracks &= $Track [ 1 ] & '|' & 'Subtitle' & '|' & $Track [ 2 ] & '|' & $Track [ 3 ] & '|' & $Track [ 4 ] & '|' & $Track [ 5 ] & '|' & $Track [ 6 ] & '|' & $Track [ 7 ] & '|' & $Track [ 8 ] & '|' & @CRLF EndIf If StringMid ( $StringSplit [ $i ] , 1 , 4 ) = "Menu" Then $Split = StringSplit ( $StringSplit [ $i ] , @CRLF
& @CRLF ) Local $Track [ 3 ] For $j = 1 To $Split [ 0 ] If StringInStr ( $Split [ $j ] , "00:00:00.000" ) Then $Track [ 1 ] = StringTrimLeft ( $StringSplit [ $i ] , StringInStr ( $StringSplit [ $i ] , "00:00:00.000" ) - 1 ) $Track [ 1 ] = StringReplace ( $Track [ 1 ] , " : " , "=" ) $Track [ 1 ] = StringReplace ( $Track [ 1 ] , @CRLF , "|" ) EndIf Next $Tracks &= '100' & '|' & 'Chapters' & '|' & $Track [ 1 ] & '|' & @CRLF EndIf Next $sData = $Tracks ConsoleWrite ( $Tracks ) FileWrite ( $hFile , $sData ) FileClose ( $hFile ) EndIf
jchd
AutoIt MVPs (MVP)
Messages : 2273 Enregistré le : lun. 30 mars 2009 22:57
Localisation : Sud-Ouest de la France (43.622788,-1.260864)
Status :
Hors ligne
#5
Message
par jchd » dim. 09 juil. 2017 20:31
Pour l'affichage dans la console SciTE, tout dépend du réglage de l'encodage en vigueur.
Pour le fichier de sortie, tu demandes de l'UTF8 no BOM et c'est exactement ce que le programme produit. Appeler le fichier *_ANSI.txt n'en fait pas un fichier ANSI
Local $hFile = FileOpen( $MediaInfo2, BitOR( $FO_UTF8_NOBOM, $FO_OVERWRITE))
La cryptographie d'aujourd'hui c'est le taquin plus l'électricité.
Anthony
Niveau 6
Messages : 293 Enregistré le : lun. 17 janv. 2011 14:08
Localisation : France
Status :
Hors ligne
#6
Message
par Anthony » dim. 09 juil. 2017 21:06
Merci jchd pour ton soutiens rapide,
J'ai déjà essayé auparavant: Code Page property, UTF-16 Little & Big, UTF-8 avec ou sans BOM (désolé j'ai oublié de le changer) et essayé les options vues dans FileConstants.au3
Code : Tout sélectionner
; Indicates the mode to open a file
Global Const $FO_READ = 0 ; Read mode
Global Const $FO_APPEND = 1 ; Write mode (append)
Global Const $FO_OVERWRITE = 2 ; Write mode (erase previous contents)
Global Const $FO_BINARY = 16 ; Read/Write mode binary
Global Const $FO_UNICODE = 32 ; Write mode Unicode UTF16-LE
Global Const $FO_UTF16_LE = 32 ; Write mode Unicode UTF16-LE
Global Const $FO_UTF16_BE = 64 ; Write mode Unicode UTF16-BE
Global Const $FO_UTF8 = 128 ; Read/Write mode UTF8 with BOM
Global Const $FO_UTF8_NOBOM = 256 ; Read/Write mode UTF8 with no BOM
Je suis sous Windows X x64, AutoIt Version: 3.3.8.1, SciTE-Lite Version 2.28 du Jan 29 2012 21:33:22 et je ne comprends pas.
jchd
AutoIt MVPs (MVP)
Messages : 2273 Enregistré le : lun. 30 mars 2009 22:57
Localisation : Sud-Ouest de la France (43.622788,-1.260864)
Status :
Hors ligne
#7
Message
par jchd » lun. 10 juil. 2017 17:49
La bonne question est "que souhaites-tu obtenir ?"
La cryptographie d'aujourd'hui c'est le taquin plus l'électricité.
orax
Modérateur
Messages : 1479 Enregistré le : lun. 23 mars 2009 04:50
Localisation : ::1
Status :
Hors ligne
#8
Message
par orax » lun. 10 juil. 2017 18:04
Anthony a écrit : ↑ dim. 09 juil. 2017 21:06
Je suis sous Windows X x64, AutoIt Version: 3.3.8.1,
SciTE-Lite Version 2.28 du Jan 29 2012 21:33:22 et je ne comprends pas.
Mettre à jour SciTE :
https://www.autoitscript.com/site/autoi ... downloads/
20-9-2015
- Added utf8.auto.check=4 default to SciTEGlobal. properties to check files when opened for their encoding or else use utf8 w/o BOM ad default.
5/3/2015
Added utf8.auto.check which will autodetect UTF8 encoded files without BOM and files containing Highvalue ASCII characters and setting the correct encoding.
We have set the default to 4 which means that the encoding is set to UTF8 without BOM for any script containing normal ASCII characters.
#~ Enhance function of auto checking utf8: providing two methods
#~ utf8.auto.check=1: detect utf8 and add BOM automatically
#~ utf8.auto.check=2: detect utf8 and do not add BOM
#~ utf8.auto.check=3: detect ascii high characters and if none found set default encoding to UTF8 and add BOM
utf8.auto.check=4: detect ascii high characters and if none found set default encoding to UTF8 and do not add BOM
https://www.autoitscript.com/autoit3/sc ... story.html
Dans les versions récentes de SciTE, le fichier devrait s'afficher correctement.
De petits détails peuvent faire toute la différence. — Quand la boule de neige commence à rouler… poussez-la. (Columbo)
jchd
AutoIt MVPs (MVP)
Messages : 2273 Enregistré le : lun. 30 mars 2009 22:57
Localisation : Sud-Ouest de la France (43.622788,-1.260864)
Status :
Hors ligne
#9
Message
par jchd » mar. 11 juil. 2017 01:25
Ah oui, je n'avais pas percuté qu'on déterrait les cadavres...
La cryptographie d'aujourd'hui c'est le taquin plus l'électricité.
Anthony
Niveau 6
Messages : 293 Enregistré le : lun. 17 janv. 2011 14:08
Localisation : France
Status :
Hors ligne
#10
Message
par Anthony » mer. 12 juil. 2017 07:24
Merci à tous j'utilisais cette version pour mes anciens scripts.
Problème résolu, désolé pour le déterrage de cadavres