#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.12.1 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; 0. Variables et fichier de configuration $url_serveur_edition = IniRead("config.ini","config","url_serveur_edition","http://www.magiccorporation.com/gathering-cartes-edition.html") $url_serveur_artist = IniRead("config.ini","config","url_serveur_artist","") $local_edition = IniRead("config.ini","config","local_edition","F:\Projets\magic\3 - www\images\editions") $local_artist = IniRead("config.ini","config","local_artist","F:\Projets\magic\3 - www\images\artistes") $force_download = IniRead("config.ini","config","force_download",0) $mysql_server = IniRead("config.ini","config","mysql_server","localhost") $mysql_database = IniRead("config.ini","config","mysql_database","magic") $mysql_user = IniRead("config.ini","config","mysql_user","root") $mysql_password = IniRead("config.ini","config","mysql_password","numeris") $mysql_driver = IniRead("config.ini","config","mysql_driver","MySQL ODBC 5.1 Driver") $output_master_edition = FileOpen(@ScriptDir &"\master_edition.txt",2) $output_short_edition = FileOpen(@ScriptDir &"\short_edition.txt",2) $output_artist = FileOpen(@ScriptDir &"\artist.txt",2) $no_ligne_search = 560 $a_master = 0 $no_ligne_artist = 570 ; ********* GESTION EDITIONS ; 1. Téléchargement pages html base des éditions/liste illustrateur et ouverture des fichiers if Not FileExists(@ScriptDir &"\editions.html") OR $force_download = 1 Then $download = InetGet($url_serveur_edition,@ScriptDir &"\editions.html",1) Else $download = 1 EndIf if $download = 1 Then $base_edition = FileOpen(@ScriptDir &"\editions.html",0) if @error Then MsgBox(0,"Erreur","Le fichier editions.html n'a pu être trouvée") Exit EndIf Else MsgBox(0,"Erreur","Le fichier d'éditions n'a pu être téléchargé") Exit EndIf if Not FileExists(@ScriptDir &"\illustrateurs.html") OR $force_download = 1 Then $download = InetGet($url_serveur_artist,@ScriptDir &"\illustrateurs.html",1) Else $download = 1 EndIf if $download = 1 Then $base_illustrateur = FileOpen(@ScriptDir &"\illustrateurs.html",0) if @error Then MsgBox(0,"Erreur","Le fichier illustrateurs.html n'a pu être trouvée") Exit EndIf Else MsgBox(0,"Erreur","Le fichier d'illustrateurs n'a pu être téléchargé") Exit EndIf ; 2. Ecriture des en-têtes CSV FileWriteLine($output_master_edition,"ID"& chr(9) &"name") FileWriteLine($output_short_edition,"ID"& chr(9) &"ID_master"& chr(9) &"name") FileWriteLine($output_artist,"ID"& chr(9) &"name") ; 3. EDITIONS : Analyse du fichier de base html vers 2 fichiers CSV While 1 ; Debug ExitLoop $line = FileReadLine($base_edition,$no_ligne_search) If @error = -1 Then ExitLoop EndIf if stringInStr($line,"
Modérateurs Cartes ",1) Then ExitLoop EndIf if StringInStr($line,"
") Then $a_master = $a_master + 1 $edition = StringSplit($line,"
",1) $edition = StringSplit($edition[2]," ",1) $master_edition = $edition[1] FileWriteLine($output_master_edition,$a_master & chr(9) & $master_edition) $no_ligne_search = $no_ligne_search + 3 $line = FileReadLine($base_edition,$no_ligne_search) $splitline = StringSplit($line,"