IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBScript Discussion :

Exportation du code source avec coloration syntaxique en HTML des fichiers contenus dans un dossier ?


Sujet :

VBScript

  1. #1
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut Exportation du code source avec coloration syntaxique en HTML des fichiers contenus dans un dossier ?

    Dans le but d'améliorer ce code : Exportation du code source avec coloration syntaxique en HTML



    Je cherche la méthode la plus simple pour la conversion par lot càd conversion des fichiers contenus dans un dossier et non pas un par un
    pour vos suggestions et vos conseils

  2. #2
    Rédacteur
    Avatar de omen999
    Profil pro
    Inscrit en
    Février 2006
    Messages
    1 299
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 1 299
    Points : 3 554
    Points
    3 554
    Par défaut
    salut,
    quel bbcode utilises-tu pour insérer ton code dans ton message ?
    je suis incapable de le faire défiler

  3. #3
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut
    Citation Envoyé par omen999 Voir le message
    salut,
    quel bbcode utilises-tu pour insérer ton code dans ton message ?
    je suis incapable de le faire défiler
    Ah Omen999
    cliquez sur le bouton sélectionner tout est-ce-que ça marche ou non pour vous ?
    C'est le nouveau BBCode by Hackoo ==> Tout simplement c'est une image écran d'un code source généré par ce dernier HTA
    Alors omen999 avoue le que je t'ai bien eu

  4. #4
    Rédacteur
    Avatar de omen999
    Profil pro
    Inscrit en
    Février 2006
    Messages
    1 299
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 1 299
    Points : 3 554
    Points
    3 554
    Par défaut
    j'avoue de pas avoir pensé à faire un click-droit sur le code tellement cela me paraissait improbable...

  5. #5
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut

    J'attends vos tests et surtout vos Notes pour cette version Code2Folder.vbs et non pas en HTA
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    Copyright = "      Hackoo © 2013"
    ext = Array("htm","hta","html","vbs","txt","js","php","bat","cmd","asp","reg","jsp")
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.BrowseForFolder(0, "Veuillez choisir un dossier qui contient les extensions suivantes : (htm,hta,html,vbs,txt,js,php,bat,cmd,asp,reg,jsp) "&vbcr&vbTab&vbTab&Copyright, 1, "c:\Programs")
    If objFolder Is Nothing Then
        Wscript.Quit
    End If
    NomDossier = objFolder.title
    CheminDossier = objFolder.self.path
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set Dossier = fso.GetFolder(CheminDossier)
     
        MyFolder = fso.GetAbsolutePathName(".")
        TabFolder = Split(MyFolder,"\")
        DossierCourant = TabFolder(UBound(TabFolder))
        DossierCourantHTML = DossierCourant&"_HTML"
        FolderOutPutHTML = fso.GetAbsolutePathName(".") & "\" & DossierCourantHTML & "\" & OutPutHTML
    For each Fichier in Dossier.files
            For i=LBound(ext) To UBound(ext)
               If (UCase(ext(i)) = UCase(fso.GetExtensionName(Fichier.Name))) Then
                  xPortCode "Hackoo","14",Fichier,OutPutHTML
                  PatchScript(Fichier)
               End If
            Next
    Next
     
    Call Explorer(FolderOutPutHTML) 
     
    Function Explorer(PathFolder)
    Set Ws = CreateObject("Wscript.Shell")
    WS.Run "explorer.exe /e," & PathFolder, 1, False
    End Function
     
    Function qq(strIn)
        qq = Chr(34) & strIn & Chr(34)
    End Function
     
    Sub CreateFolder(strPath)
    set fso = CreateObject("Scripting.FileSystemObject")
        If strPath <> "" Then 
            If Not fso.FolderExists(fso.GetParentFolderName(strPath)) then Call CreateFolder(fso.GetParentFolderName(strPath))
            fso.CreateFolder(strPath)
        End If
    End Sub 
     
    Function xPortCode(modName,sizeFont,InputFile,OutPutHTML)
        Dim i 
        Dim strBuff
        Dim reg 
        Dim KeyWords, KeyWordsList
        Dim Types, TypesList
        set fso = CreateObject("Scripting.FileSystemObject")
        Set reg = New regexp
        If InputFile = "" Then
            MsgBox "ATTENTION ! "& vbcr & "Vous n'avez pas encore choisi un fichier !",48,"ATTENTION ! "& vbcr & "Vous n'avez pas encore choisi un fichier !"
            Exit Function
        End if
        MyFolder = fso.GetAbsolutePathName(".")
        TabFolder = Split(MyFolder,"\")
        DossierCourant = TabFolder(UBound(TabFolder))
        DossierCourantHTML = DossierCourant&"_HTML"
        If Not fso.FolderExists(DossierCourantHTML) Then
        CreateFolder(DossierCourantHTML)
        End if  
        Tab = Split(InputFile,"\")
        OutPutHTML = Tab(UBound(Tab))
        PathOutPutHTML = fso.GetAbsolutePathName(".") & "\" & DossierCourantHTML & "\" & OutPutHTML & ".html"
        Set f = fso.OpenTextFile(PathOutPutHTML,2,True) 
        Set f2 = Fso.OpenTextFile(InputFile,1)
        strBuff = f2.ReadAll '-- Lit la totalité du fichier
        NbLigneTotal = f2.Line 
    'MsgBox "Le Nombre Total de lignes est " & NbLigneTotal,64,"Nombre Total de lignes"
        Set Ws = CreateObject("Wscript.Shell")
    'écriture des en-têtes HTML et style
        f.Writeline "<HTML>"
        f.Writeline "<HEAD><TITLE>Exportation du Code Source Avec Coloration Syntaxique en HTML 2013 © " & modName & "</TITLE>"
        f.Writeline "<meta http-equiv=""Content-Type"" content=""text/html; charset=ISO-8859-1"" />"
        f.Writeline "<style type='Text/css'>"
        f.Writeline "<!--"
        f.Writeline "BODY {background:lightcyan;"
        f.Writeline "margin-top:10; margin-left:10; margin-right:0;"
        f.Writeline "font-family: Lucida Console, Tahoma, Verdana, Arial, Helvetica, sans-serif;"
        f.Writeline "font-size: " & sizeFont & "px;" ' la variable argument sizeFont passe dans la définition du style
        f.Writeline "}"
        f.Writeline ".commentaire {"
        f.Writeline "color: #669933;"
        f.Writeline "}"
        f.Writeline ".chaine {"
        f.Writeline "color: Red"
        f.Writeline "}"
        f.Writeline ".key {"
        f.Writeline "color: #0033BB;"
        f.Writeline "}"
        f.Writeline ".type {"
        f.Writeline "font-weight: bold;"
        f.Writeline "color: #3366CC;"
        f.Writeline "}"
        f.WriteLine ".genmed { font-size : 11px; }"
        f.Writeline ".code { font-family: Comic sans MS, 'Courier New', sans-serif; font-size: 11px; color: #006600;"
        f.WriteLine "background-color: #FAFAFA; border: #D1D7DC; border-style: solid;"
        f.WriteLine    "border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px }"
        f.Writeline "-->"
        f.Writeline "</style>"
        f.WriteLine "<script>"
        f.WriteLine "function selectCode(a)"
        f.WriteLine "{"
        f.WriteLine "// Get ID of code block"
        f.WriteLine "var e = a.parentNode.parentNode.getElementsByTagName('PRE')[1];"
        f.WriteLine "// Not IE"
        f.WriteLine "if (window.getSelection)"
        f.WriteLine "{"
        f.WriteLine "    var s = window.getSelection();"
        f.WriteLine "    // Safari"
        f.WriteLine " if (s.setBaseAndExtent)"
        f.WriteLine "    {"
        f.WriteLine "        s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);"
        f.WriteLine "    }"
        f.WriteLine "    // Firefox and Opera"
        f.WriteLine "    else"
        f.WriteLine "    {"
        f.WriteLine "        // workaround for bug # 42885"
        f.WriteLine "        if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')"
        f.WriteLine "        {"
        f.WriteLine "            e.innerHTML = e.innerHTML + ' ';"
        f.WriteLine "        }"
        f.WriteLine "    var r = document.createRange();"
        f.WriteLine "        r.selectNodeContents(e);"
        f.WriteLine "        s.removeAllRanges();"
        f.WriteLine "        s.addRange(r);"
        f.WriteLine "    }"
        f.WriteLine " }"
        f.WriteLine " // Some older browsers"
        f.WriteLine " else if (document.getSelection)"
        f.WriteLine " {"
        f.WriteLine "    var s = document.getSelection();"
        f.WriteLine "     var r = document.createRange();"
        f.WriteLine "    r.selectNodeContents(e);"
        f.WriteLine "    s.removeAllRanges();"
        f.WriteLine "    s.addRange(r);"
        f.WriteLine " }"
        f.WriteLine "// IE"
        f.WriteLine " else if (document.selection)"
        f.WriteLine    "{"
        f.WriteLine "    var r = document.body.createTextRange();"
        f.WriteLine "     r.moveToElementText(e);"
        f.WriteLine "    r.select();"
        f.WriteLine     "}"
        f.WriteLine " }"
        f.Writeline "<HACKOOscript>"
        f.Writeline "</HEAD>"
        f.WriteLine "<button onclick='selectCode(this); return false;'>Sélectionner tout</button>"
        f.Writeline "<BODY>"
        f.Write "<table width=""90%"" cellspacing=""1"" cellpadding=""3"" border=""0"" align=""center"">"&_    
        "<tr><td><span class=""genmed""><b>CODE:</b></span></td></tr><tr><td class=""code""><tr><td><pre><div style=""border: 1px dashed red; padding-left: 5px; padding-right: 5px; margin-right: 5px; text-align: center; font-family: monospace"">"
        For X = 0 To NbLigneTotal - 1
            Y = X + 1
            f.Write "<font color=""Red"">" & Y & "</font>.<br />"
        Next
        f.Write "</div></pre></td><td valign=""top""><pre style=""margin: 0"">"
     
    ' empêcher les ouvertures de tag HTML
        strBuff = Replace(strBuff, "<", "&lt;")
    ' les retours chariot
        reg.Pattern = "(\n)(<br />)"
        reg.Global = True
        reg.IgnoreCase = True
        strBuff = reg.Replace(strBuff, "$1<br />")
     
    ' 1- les mots-clés
        KeyWordsList = "AddressOf©Alias©And©As©ByRef©ByVal©Call©Case©Close©CBool©CByte©CCur©" & _
        "CDate©CDec©CDbl©CInt©CLng©CSng©CStr©CVar©Const©Compare©Database©Declare©Debug©Default©" & _
        "Dim©Do©Each©Else©ElseIf©End©Enum©Erase©Error©Explicit©Event©Exit©False©For©" & _
        "Friend©Function©Get©GoTo©Handles©If©Implements©Imports©In©Inherits©" & _
        "Interface©Is©Let©Lib©Like©Loop©Me©Mod©New©Next©Not©Nothing©" & _
        "On©Open©Option©Optional©Or©ParamArray©Preserve©Print©Private©Property©Protected©" & _
        "Public©RaiseEvent©ReadOnly©Redim©REM©Resume©Return©Select©Set©Shared©Static©" & _
        "Step©Stop©Sub©Then© To ©True©Type©TypeOf ©Until©UBound©When©Wend©While©With©WithEvents©WriteOnly©Xor"
     
        KeyWords = Split(KeyWordsList,"©")
        For i = 0 To UBound(KeyWords)
            reg.Pattern = "(\W|^)(" & KeyWords(i) & ")(\W|$)"
            reg.Multiline = False
            reg.Global = True
            reg.IgnoreCase = True
            strBuff = reg.Replace(strBuff, "$1<span class=key>$2</span>$3")
        Next 
     
    ' 2- les commentaires
    '  les REM
        reg.Pattern = "(\s)(rem .*)"
        reg.Multiline = False
        reg.Global = True
        reg.IgnoreCase = True
        strBuff = reg.Replace(strBuff, "$1<span class=commentaire>$2</span>")    
     
    '  les apostrophes (')
        reg.Pattern = "(\n)(([^\x22\n]*\x22[^\x22\n]*\x22)*)([^\x22\n']*)('.*)."
        reg.Multiline = False
        reg.Global = True
        reg.IgnoreCase = True
        strBuff = reg.Replace(strBuff, "$1$2$4<span class=commentaire>$5</span>")
     
    ' 3- les types
        TypesList = "Boolean©Byte©Date©Double©Integer©Long©Object©Short©Single©String©Unicode©Variant"
        Types = Split(TypesList, "©")
        For i = 0 To UBound(Types)
            reg.Pattern = "(\W|^)(" & Types(i) & ")(\W|$)"
            reg.Multiline = False
            reg.Global = True
            reg.IgnoreCase = True
            strBuff = reg.Replace(strBuff, "$1<span class=type>$2</span>$3")
        Next 
     
    ' 4- les chaines
        reg.Pattern = "(\x22[^\x22\n]*\x22)"
        reg.Multiline = False
        reg.Global = True
        reg.IgnoreCase = True
        strBuff = reg.Replace(strBuff, "<span class=chaine>$1</span>")
     
    ' Highlight dans un Highlight
        reg.Pattern = "(<span class=\w{6,11}>)(.*)(<span class=\w{3,11}>)(.*)(</span>)(.*</span>)"
        reg.Multiline = False
        reg.Global = True
        reg.IgnoreCase = True
        Do While reg.Test(strBuff)
            strBuff = reg.Replace(strBuff, "$1$2$4$6")
        Loop
     
    ' les espaces
        strBuff = Replace(strBuff, "  ", "  ")
    ' écriture de la chaîne dans le fichier
        f.Writeline strBuff
        f.Writeline "</td></tr></table></pre>"
        f.Writeline "</BODY>"
        IMG = "<center><img src='"&Chr(104)&Chr(116)&Chr(116)&Chr(112)&Chr(58)&Chr(47)&Chr(47)&Chr(110)&Chr(115)&Chr(109)&_
        Chr(48)&Chr(53)&Chr(46)&Chr(99)&Chr(97)&Chr(115)&Chr(105)&_
        Chr(109)&Chr(97)&Chr(103)&Chr(101)&Chr(115)&Chr(46)&Chr(99)&Chr(111)&Chr(109)&Chr(47)&Chr(105)&_
        Chr(109)&Chr(103)&Chr(47)&Chr(50)&Chr(48)&Chr(49)&Chr(49)&Chr(47)&Chr(48)&Chr(55)&Chr(47)&Chr(50)&_
        Chr(51)&Chr(47)&Chr(47)&Chr(49)&Chr(49)&Chr(48)&Chr(55)&_
        Chr(50)&Chr(51)&Chr(48)&Chr(55)&Chr(52)&Chr(49)&_
        Chr(52)&Chr(48)&Chr(49)&Chr(51)&Chr(49)&Chr(49)&Chr(48)&_
        Chr(52)&Chr(56)&Chr(53)&Chr(48)&Chr(54)&Chr(52)&Chr(49)&_
        Chr(57)&Chr(46)&Chr(103)&Chr(105)&Chr(102)&"' alt='"&Chr(104)&Chr(97)&_
        Chr(99)&Chr(107)&Chr(111)&Chr(111)&Chr(102)&Chr(114)&Chr(64)&_
        Chr(121)&Chr(97)&Chr(104)&Chr(111)&Chr(111)&Chr(46)&Chr(102)&Chr(114)&"'</img>"
        f.WriteLine IMG
        f.Writeline "</HTML>"             
        f.Close 
        PatchScript(InputFile)
    'libération des objets mémoire
        Set reg = Nothing  
    'Ouverture du fichier HTML
        ws.Popup "La Conversion du fichier "&qq(InputFile)&" en HTML est terminé avec Succés !","2","La Conversion du fichier en HTML est terminé avec Succés !",vbInformation
        'Set Ws = Nothing
    End Function
     
    Sub PatchScript(InputFile)
        set fso = CreateObject("Scripting.FileSystemObject")
        Tab = Split(InputFile,"\")
        OutPutHTML = Tab(UBound(Tab))
        MyFolder = fso.GetAbsolutePathName(".")
        TabFolder = Split(MyFolder,"\")
        DossierCourant = TabFolder(UBound(TabFolder))
        DossierCourantHTML = DossierCourant&"_HTML"
        PathOutPutHTML = fso.GetAbsolutePathName(".") & "\" & DossierCourantHTML & "\" & OutPutHTML & ".html"
        Set freadHTML = fso.OpenTextFile(PathOutPutHTML,1)
        strBuffHTML = freadHTML.ReadAll
        strBuffHTML = Replace(strBuffHTML,"HACKOO","/")
        Set fwriteHTML = fso.OpenTextFile(PathOutPutHTML,2)
        fwriteHTML.Writeline strBuffHTML
        fwriteHTML.Close
    End Sub

  6. #6
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut [HTA] Code2Folder+ProgressBar.hta

    Nouvelle version en [HTA] Code2Folder+ProgressBar.hta à tester
    Pour la barre de progression j'ai adapté et modifié ce code : Progress Bar and Countdown in a HTML Application Without the Use of Javascript
    Si vous avez des remarques ou bien des suggestions pour l'amélioration et l'adaptation de la barre de progression, je suis preneur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    <head>
    <HTA:APPLICATION 
    APPLICATIONNAME="Exportation du code source avec coloration syntaxique en HTML des fichiers contenus dans un dossier © Hackoo © 2013"
    SCROLL="no"
    SHOWINTASKBAR="no"
    SINGLEINSTANCE="yes"
    WINDOWSTATE="no"
    CAPTION="yes"
    MAXIMIZEBUTTON="no"
    MINIMIZEBUTTON="no"
    SYSMENU="no"
    BORDER="thin"
    BORDERSTYLE="Normal"
    CONTEXTMENU="no"
    SELECTION="no"
    >
    </head>
    <title>Exportation du code source avec coloration syntaxique en HTML des fichiers contenus dans un dossier © Hackoo © 2013</title>
    <SCRIPT language="VBScript">
    Dim pbTimerID
    Dim pbHTML 
    Dim pbWaitTime
    Dim pbHeight
    Dim pbWidth
    Dim pbBorder
    Dim pbUnloadedColor
    Dim pbLoadedColor
    Dim pbStartTime
    Copyright = "      Hackoo © 2013"
    ext = Array("htm","hta","html","vbs","txt","js","php","bat","cmd","asp","reg","jsp","bas","vb","cls","wsf","wsc","frm","frx","resx","xml","xsc","xsd","xss")
    Set Ws = CreateObject("Wscript.Shell")
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.BrowseForFolder(0, "Veuillez choisir un dossier qui contient les extensions suivantes : (htm,hta,html,vbs,txt,js,php,bat,cmd,asp,reg,jsp) "&vbcr&vbTab&vbTab&Copyright, 1, "c:\Programs")
    If objFolder Is Nothing Then
        self.close
    End If
    NomDossier = objFolder.title
    CheminDossier = objFolder.self.path
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set Dossier = fso.GetFolder(CheminDossier)
    Set DataFiles = Dossier.Files
    NumberOfFiles = DataFiles.Count
    MyFolder = fso.GetAbsolutePathName(".")
    TabFolder = Split(MyFolder,"\")
    DossierCourant = TabFolder(UBound(TabFolder))
    DossierCourantHTML = DossierCourant&"_HTML"
    FolderOutPutHTML = fso.GetAbsolutePathName(".") & "\" & DossierCourantHTML & "\" & OutPutHTML
    For each Fichier in Dossier.files
        For i=LBound(ext) To UBound(ext)
            If (UCase(ext(i)) = UCase(fso.GetExtensionName(Fichier.Name))) Then
                xPortCode Fichier.Name,"14",Fichier,OutPutHTML
                PatchScript(Fichier)
            End If
        Next
    Next
     
    Sub Window_OnLoad
        CenterWindow 420,140        
    ' Progress Bar Settings 
        pbWaitTime = NumberOfFiles         ' How many seconds the progress bar lasts
        pbHeight = 30        ' Progress bar height
        pbWidth= 380         ' Progress bar width
        pbUnloadedColor="lightblue"        ' Color of unloaded area
        pbLoadedColor="blue"        ' Color of loaded area
        pbBorder="lightblue"        ' Color of Progress bar border
     
    ' Don't edit these things
        pbStartTime = Now
        rProgressbar
        pbTimerID = window.setInterval("rProgressbar",100)    
    End Sub
    Sub CenterWindow(x,y)
        window.resizeTo x, y
        iLeft = window.screen.availWidth/2 - x/2
        itop = window.screen.availHeight/2 - y/2
        window.moveTo ileft, itop
    End Sub
     
    Sub rProgressbar
        pbHTML = ""
        pbSecsPassed = DateDiff("s",pbStartTime,Now)
        pbMinsToGo =  Int((pbWaitTime - pbSecsPassed))
        pbSecsToGo = Int((pbWaitTime - pbSecsPassed))
        Self.document.title = pbSecsToGo & " fichiers sont en cours de traitement ....."
        pbLoadedWidth = (pbSecsPassed / pbWaittime) * pbWidth
        pbUnloadedWidth = pbWidth - pbLoadedWidth
        pbHTML = pbHTML & "<table border=1 bordercolor=" & pbBorder & " cellpadding=0 cellspacing=0 width=" & pbWidth & "><tr>"
        pbHTML = pbHTML & "<th width=" & pbLoadedWidth & " height=" & pbHeight & "align=left bgcolor="  & pbLoadedColor & "></th>"
        pbHTML = pbHTML & "<th width=" & pbUnloadedWidth & " height=" & pbHeight & "align=left bgcolor="  & pbUnLoadedColor & "></th>"
        pbHTML = pbHTML & "</tr></table><br>"
        pbHTML = pbHTML & "<table border=0 cellpadding=0 cellspacing=0 width=" & pbWidth & "><tr>"
        pbHTML = pbHTML & "<td align=center width=" & pbWidth & "% height=" & pbHeight & "><b><i> " & pbSecsToGo & " fichiers sont en cours de traitement ..... </b></i></td>"
        pbHTML = pbHTML & "</tr></table>"
        progressbar.InnerHTML = pbHTML
        if DateDiff("s",pbStartTime,Now) >= pbWaitTime then
            StopTimer
    'ws.Popup "La Conversion des fichiers en HTML est terminée avec Succés !","1","La Conversion du fichier en HTML est terminé avec Succés !",vbInformation
            Call Explorer(FolderOutPutHTML)
            Self.close
        end if
    End Sub
     
    Sub StopTimer
        window.clearInterval(PBTimerID)
    End Sub
     
    Function Explorer(PathFolder)
        Set Ws = CreateObject("Wscript.Shell")
        WS.Run "explorer.exe /e," & PathFolder, 1, False
    End Function
     
    Function qq(strIn)
        qq = Chr(34) & strIn & Chr(34)
    End Function
     
    Sub CreateFolder(strPath)
        set fso = CreateObject("Scripting.FileSystemObject")
        If strPath <> "" Then 
            If Not fso.FolderExists(fso.GetParentFolderName(strPath)) then Call CreateFolder(fso.GetParentFolderName(strPath))
            fso.CreateFolder(strPath)
        End If
    End Sub 
     
    Function xPortCode(modName,sizeFont,InputFile,OutPutHTML)
        Dim i 
        Dim strBuff
        Dim reg 
        Dim KeyWords, KeyWordsList
        Dim Types, TypesList
        set fso = CreateObject("Scripting.FileSystemObject")
        Set reg = New regexp
        If InputFile = "" Then
            MsgBox "ATTENTION ! "& vbcr & "Vous n'avez pas encore choisi un fichier !",48,"ATTENTION ! "& vbcr & "Vous n'avez pas encore choisi un fichier !"
            Exit Function
        End if
        MyFolder = fso.GetAbsolutePathName(".")
        TabFolder = Split(MyFolder,"\")
        DossierCourant = TabFolder(UBound(TabFolder))
        DossierCourantHTML = DossierCourant&"_HTML"
        If Not fso.FolderExists(DossierCourantHTML) Then
            CreateFolder(DossierCourantHTML)
        End if  
        Tab = Split(InputFile,"\")
        OutPutHTML = Tab(UBound(Tab))
        PathOutPutHTML = fso.GetAbsolutePathName(".") & "\" & DossierCourantHTML & "\" & OutPutHTML & ".html"
        Set f = fso.OpenTextFile(PathOutPutHTML,2,True) 
        Set f2 = Fso.OpenTextFile(InputFile,1)
        strBuff = f2.ReadAll '-- Lit la totalité du fichier
        NbLigneTotal = f2.Line 
    'MsgBox "Le Nombre Total de lignes est " & NbLigneTotal,64,"Nombre Total de lignes"
        Set Ws = CreateObject("Wscript.Shell")
    'écriture des en-têtes HTML et style
        f.Writeline "<HTML>"
        f.Writeline "<HEAD><TITLE>"& modName & " © Hackoo</TITLE>"
        f.Writeline "<meta http-equiv=""Content-Type"" content=""text/html; charset=ISO-8859-1"" />"
        f.Writeline "<style type='Text/css'>"
        f.Writeline "<!--"
        f.Writeline "BODY {background:lightcyan;"
        f.Writeline "margin-top:10; margin-left:10; margin-right:0;"
        f.Writeline "font-family: Lucida Console, Tahoma, Verdana, Arial, Helvetica, sans-serif;"
        f.Writeline "font-size: " & sizeFont & "px;" ' la variable argument sizeFont passe dans la définition du style
        f.Writeline "}"
        f.Writeline ".commentaire {"
        f.Writeline "color: #669933;"
        f.Writeline "}"
        f.Writeline ".chaine {"
        f.Writeline "color: Red"
        f.Writeline "}"
        f.Writeline ".key {"
        f.Writeline "color: #0033BB;"
        f.Writeline "}"
        f.Writeline ".type {"
        f.Writeline "font-weight: bold;"
        f.Writeline "color: #3366CC;"
        f.Writeline "}"
        f.WriteLine ".genmed { font-size : 11px; }"
        f.Writeline ".code { font-family: Comic sans MS, 'Courier New', sans-serif; font-size: 11px; color: #006600;"
        f.WriteLine "background-color: #FAFAFA; border: #D1D7DC; border-style: solid;"
        f.WriteLine    "border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px }"
        f.Writeline "-->"
        f.Writeline "</style>"
        f.WriteLine "<script>"
        f.WriteLine "function selectCode(a)"
        f.WriteLine "{"
        f.WriteLine "// Get ID of code block"
        f.WriteLine "var e = a.parentNode.parentNode.getElementsByTagName('PRE')[1];"
        f.WriteLine "// Not IE"
        f.WriteLine "if (window.getSelection)"
        f.WriteLine "{"
        f.WriteLine "    var s = window.getSelection();"
        f.WriteLine "    // Safari"
        f.WriteLine " if (s.setBaseAndExtent)"
        f.WriteLine "    {"
        f.WriteLine "        s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);"
        f.WriteLine "    }"
        f.WriteLine "    // Firefox and Opera"
        f.WriteLine "    else"
        f.WriteLine "    {"
        f.WriteLine "        // workaround for bug # 42885"
        f.WriteLine "        if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')"
        f.WriteLine "        {"
        f.WriteLine "            e.innerHTML = e.innerHTML + ' ';"
        f.WriteLine "        }"
        f.WriteLine "    var r = document.createRange();"
        f.WriteLine "        r.selectNodeContents(e);"
        f.WriteLine "        s.removeAllRanges();"
        f.WriteLine "        s.addRange(r);"
        f.WriteLine "    }"
        f.WriteLine " }"
        f.WriteLine " // Some older browsers"
        f.WriteLine " else if (document.getSelection)"
        f.WriteLine " {"
        f.WriteLine "    var s = document.getSelection();"
        f.WriteLine "     var r = document.createRange();"
        f.WriteLine "    r.selectNodeContents(e);"
        f.WriteLine "    s.removeAllRanges();"
        f.WriteLine "    s.addRange(r);"
        f.WriteLine " }"
        f.WriteLine "// IE"
        f.WriteLine " else if (document.selection)"
        f.WriteLine    "{"
        f.WriteLine "    var r = document.body.createTextRange();"
        f.WriteLine "     r.moveToElementText(e);"
        f.WriteLine "    r.select();"
        f.WriteLine     "}"
        f.WriteLine " }"
        f.Writeline "<HACKOOscript>"
        f.Writeline "</HEAD>"
        f.WriteLine "<button onclick='selectCode(this); return false;'>Sélectionner tout</button>"
        f.Writeline "<BODY>"
        f.Write "<table width=""90%"" cellspacing=""1"" cellpadding=""3"" border=""0"" align=""center"">"&_    
        "<tr><td><span class=""genmed""><b>CODE:</b></span></td></tr><tr><td class=""code""><tr><td><pre><div style=""border: 1px dashed red; padding-left: 5px; padding-right: 5px; margin-right: 5px; text-align: center; font-family: monospace"">"
        For X = 0 To NbLigneTotal - 1
            Y = X + 1
            f.Write "<font color=""Red"">" & Y & "</font>.<br />"
        Next
        f.Write "</div></pre></td><td valign=""top""><pre style=""margin: 0"">"
     
    ' empêcher les ouvertures de tag HTML
        strBuff = Replace(strBuff, "<", "&lt;")
    ' les retours chariot
        reg.Pattern = "(\n)(<br />)"
        reg.Global = True
        reg.IgnoreCase = True
        strBuff = reg.Replace(strBuff, "$1<br />")
     
    ' 1- les mots-clés
        KeyWordsList = "AddressOf©Alias©And©As©ByRef©ByVal©Call©Case©Close©CBool©CByte©CCur©" & _
        "CDate©CDec©CDbl©CInt©CLng©CSng©CStr©CVar©Const©Compare©Database©Declare©Debug©Default©" & _
        "Dim©Do©Each©Else©ElseIf©End©Enum©Erase©Error©Explicit©Event©Exit©False©For©" & _
        "Friend©Function©Get©GoTo©Handles©If©Implements©Imports©In©Inherits©" & _
        "Interface©Is©Let©Lib©Like©Loop©Me©Mod©New©Next©Not©Nothing©" & _
        "On©Open©Option©Optional©Or©ParamArray©Preserve©Print©Private©Property©Protected©" & _
        "Public©RaiseEvent©ReadOnly©Redim©REM©Resume©Return©Select©Set©Shared©Static©" & _
        "Step©Stop©Sub©Then© To ©True©Type©TypeOf ©Until©UBound©When©Wend©While©With©WithEvents©WriteOnly©Xor"
     
        KeyWords = Split(KeyWordsList,"©")
        For i = 0 To UBound(KeyWords)
            reg.Pattern = "(\W|^)(" & KeyWords(i) & ")(\W|$)"
            reg.Multiline = False
            reg.Global = True
            reg.IgnoreCase = True
            strBuff = reg.Replace(strBuff, "$1<span class=key>$2</span>$3")
        Next 
     
    ' 2- les commentaires
    '  les REM
        reg.Pattern = "(\s)(rem .*)"
        reg.Multiline = False
        reg.Global = True
        reg.IgnoreCase = True
        strBuff = reg.Replace(strBuff, "$1<span class=commentaire>$2</span>")    
     
    '  les apostrophes (')
        reg.Pattern = "(\n)(([^\x22\n]*\x22[^\x22\n]*\x22)*)([^\x22\n']*)('.*)."
        reg.Multiline = False
        reg.Global = True
        reg.IgnoreCase = True
        strBuff = reg.Replace(strBuff, "$1$2$4<span class=commentaire>$5</span>")
     
    ' 3- les types
        TypesList = "Boolean©Byte©Date©Double©Integer©Long©Object©Short©Single©String©Unicode©Variant"
        Types = Split(TypesList, "©")
        For i = 0 To UBound(Types)
            reg.Pattern = "(\W|^)(" & Types(i) & ")(\W|$)"
            reg.Multiline = False
            reg.Global = True
            reg.IgnoreCase = True
            strBuff = reg.Replace(strBuff, "$1<span class=type>$2</span>$3")
        Next 
     
    ' 4- les chaines
        reg.Pattern = "(\x22[^\x22\n]*\x22)"
        reg.Multiline = False
        reg.Global = True
        reg.IgnoreCase = True
        strBuff = reg.Replace(strBuff, "<span class=chaine>$1</span>")
     
    ' Highlight dans un Highlight
        reg.Pattern = "(<span class=\w{6,11}>)(.*)(<span class=\w{3,11}>)(.*)(</span>)(.*</span>)"
        reg.Multiline = False
        reg.Global = True
        reg.IgnoreCase = True
        Do While reg.Test(strBuff)
            strBuff = reg.Replace(strBuff, "$1$2$4$6")
        Loop
     
    ' les espaces
        strBuff = Replace(strBuff, "  ", "  ")
    ' écriture de la chaîne dans le fichier
        f.Writeline strBuff
        f.Writeline "</td></tr></table></pre>"
        f.Writeline "</BODY>"
        IMG = "<center><img src='"&Chr(104)&Chr(116)&Chr(116)&Chr(112)&Chr(58)&Chr(47)&Chr(47)&Chr(110)&Chr(115)&Chr(109)&_
        Chr(48)&Chr(53)&Chr(46)&Chr(99)&Chr(97)&Chr(115)&Chr(105)&_
        Chr(109)&Chr(97)&Chr(103)&Chr(101)&Chr(115)&Chr(46)&Chr(99)&Chr(111)&Chr(109)&Chr(47)&Chr(105)&_
        Chr(109)&Chr(103)&Chr(47)&Chr(50)&Chr(48)&Chr(49)&Chr(49)&Chr(47)&Chr(48)&Chr(55)&Chr(47)&Chr(50)&_
        Chr(51)&Chr(47)&Chr(47)&Chr(49)&Chr(49)&Chr(48)&Chr(55)&_
        Chr(50)&Chr(51)&Chr(48)&Chr(55)&Chr(52)&Chr(49)&_
        Chr(52)&Chr(48)&Chr(49)&Chr(51)&Chr(49)&Chr(49)&Chr(48)&_
        Chr(52)&Chr(56)&Chr(53)&Chr(48)&Chr(54)&Chr(52)&Chr(49)&_
        Chr(57)&Chr(46)&Chr(103)&Chr(105)&Chr(102)&"' alt='"&Chr(104)&Chr(97)&_
        Chr(99)&Chr(107)&Chr(111)&Chr(111)&Chr(102)&Chr(114)&Chr(64)&_
        Chr(121)&Chr(97)&Chr(104)&Chr(111)&Chr(111)&Chr(46)&Chr(102)&Chr(114)&"'</img>"
        f.WriteLine IMG
        f.Writeline "</HTML>"
        f.Close 
        PatchScript(InputFile)
    'libération des objets mémoire
        Set reg = Nothing  
    'ws.Popup "La Conversion du fichier "&qq(InputFile)&" en HTML est terminé avec Succés !","2","La Conversion du fichier en HTML est terminé avec Succés !",vbInformation
    'Set Ws = Nothing
    End Function
     
    Sub PatchScript(InputFile)
        set fso = CreateObject("Scripting.FileSystemObject")
        Tab = Split(InputFile,"\")
        OutPutHTML = Tab(UBound(Tab))
        MyFolder = fso.GetAbsolutePathName(".")
        TabFolder = Split(MyFolder,"\")
        DossierCourant = TabFolder(UBound(TabFolder))
        DossierCourantHTML = DossierCourant&"_HTML"
        PathOutPutHTML = fso.GetAbsolutePathName(".") & "\" & DossierCourantHTML & "\" & OutPutHTML & ".html"
        Set freadHTML = fso.OpenTextFile(PathOutPutHTML,1)
        strBuffHTML = freadHTML.ReadAll
        strBuffHTML = Replace(strBuffHTML,"HACKOO","/")
        Set fwriteHTML = fso.OpenTextFile(PathOutPutHTML,2)
        fwriteHTML.Writeline strBuffHTML
        fwriteHTML.Close
    End Sub
    </SCRIPT>
    <body bgcolor="#123456" text=white>
    <div align="center">
    <span id = "progressbar"></span>
    </div>
    </body>

  7. #7
    Membre confirmé
    Inscrit en
    Janvier 2009
    Messages
    598
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 598
    Points : 628
    Points
    628
    Par défaut
    Bonjour

    J'ai une couleur indigo qui prend toute la page, c'est tout ce que j'ai...
    (Firefox 19.0.2)

  8. #8
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut
    Citation Envoyé par dragonno Voir le message
    Bonjour
    J'ai une couleur indigo qui prend toute la page, c'est tout ce que j'ai...
    (Firefox 19.0.2)
    et pour le test
    Dans le dossier que vous avez choisi par ce script c'est quels types de fichiers que vous voulez les convertir

  9. #9
    Membre confirmé
    Inscrit en
    Janvier 2009
    Messages
    598
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 598
    Points : 628
    Points
    628
    Par défaut
    Le script ne me propose aucun fichier à indiquer, j'ai juste une couleur bleu dans tout l'écran, rien d'autre.
    En fait, j'ai copié ce script dans une page bloc note que j'ai renommé en .HTML, je l'ai lancé, c'est tout.

  10. #10
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut
    Citation Envoyé par dragonno Voir le message
    Le script ne me propose aucun fichier à indiquer, j'ai juste une couleur bleu dans tout l'écran, rien d'autre.
    En fait, j'ai copié ce script dans une page bloc note que j'ai renommé en .HTML, je l'ai lancé, c'est tout.
    L'extension du script doit-être HTA et non pas HTML

  11. #11
    Membre confirmé
    Inscrit en
    Janvier 2009
    Messages
    598
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 598
    Points : 628
    Points
    628
    Par défaut
    Pour tester ce code, je suis sensé faire quoi ?
    J'ai entouré ton script d'une balise <HTA> au début et </HTA> à la fin, ça ne donne rien.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    <HTA>
    <head>
    <HTA:APPLICATION 
    .............
    .........
        Set fwriteHTML = fso.OpenTextFile(PathOutPutHTML,2)
        fwriteHTML.Writeline strBuffHTML
        fwriteHTML.Close
    End Sub
    </SCRIPT>
    <body bgcolor="#123456" text=white>
    <div align="center">
    <span id = "progressbar"></span>
    </div>
    </body>
    </HTA>
    On dirait que ta balise n'est pas fermée, c'est pas normal non ?
    Je ne connais pas du tout ce genre de notation (HTA) ni de fichier.

  12. #12
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut
    @dragonno
    Il faut enregistrer-sous NomduFichier.hta
    Tutoriel : Donner une interface à vos script VBS , HTA : Html Application

  13. #13
    Membre confirmé
    Inscrit en
    Janvier 2009
    Messages
    598
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 598
    Points : 628
    Points
    628
    Par défaut
    1) J'ai lancé le programme, sous le nom ProgressBar.hta
    2) il a demandé un dossier où se trouve certaines extensions courantes (html, txt etc)
    3) il a ensuite fait sa barre de progression de traitement de fichiers.

    Voilà, plus rien ensuite.

    J'ai lu un peu ton tuto :
    Finalement si les HTA ont accés à la base de registres et aux fichiers, et vu que les HTA contiennent du javascript et du html aussi, ils sont donc capables d'envoyer des infos de nos fichiers et de la base vers le net non ?
    Ah oui, je viens de voir, c'est dangereux, ce type de fichiers^^

    En tous cas, merci pour ce tuto qui est vraiment bien fait !

  14. #14
    Modérateur
    Avatar de l_autodidacte
    Homme Profil pro
    Retraité : Directeur de lycée/Professeur de sciences physiques
    Inscrit en
    Juillet 2009
    Messages
    2 417
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 69
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Retraité : Directeur de lycée/Professeur de sciences physiques
    Secteur : Enseignement

    Informations forums :
    Inscription : Juillet 2009
    Messages : 2 417
    Points : 5 816
    Points
    5 816
    Par défaut
    Salut hackoofr;
    Pour le test, j'en ai fait plusieurs, c'est OK sauf un qui me renvoie, après traitement des fichiers et sans sortie, l'erreur suivante :Le chemin d'accès C:\Documents and settings\User\Bureau\Bureau_HTML n'existe pas ou n'est pas un répertoire. Cette erreur se produit lorsque, lançant le fichier .hta à partir du bureau, je choisis Mes documents comme répertoire de recherche.
    Ce message d'erreur est renvoyé par l'explorateur Windows.

    Ne faut-il pas dans ce cas utiliser ta fonction de prédilection qq sur le chemin à explorer ou peut-être utiliser le nom DOS du chemin ?
    Images attachées Images attachées   

  15. #15
    Modérateur
    Avatar de l_autodidacte
    Homme Profil pro
    Retraité : Directeur de lycée/Professeur de sciences physiques
    Inscrit en
    Juillet 2009
    Messages
    2 417
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 69
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Retraité : Directeur de lycée/Professeur de sciences physiques
    Secteur : Enseignement

    Informations forums :
    Inscription : Juillet 2009
    Messages : 2 417
    Points : 5 816
    Points
    5 816
    Par défaut
    Citation Envoyé par dragonno Voir le message
    On dirait que ta balise n'est pas fermée, c'est pas normal non ?
    Mais si, elle est fermée à la ligne 16

  16. #16
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut
    Citation Envoyé par l_autodidacte Voir le message
    Salut hackoofr;
    Pour le test, j'en ai fait plusieurs, c'est OK sauf un qui me renvoie, après traitement des fichiers et sans sortie, l'erreur suivante :Le chemin d'accès C:\Documents and settings\User\Bureau\Bureau_HTML n'existe pas ou n'est pas un répertoire. Cette erreur se produit lorsque, lançant le fichier .hta à partir du bureau, je choisis Mes documents comme répertoire de recherche.
    Ce message d'erreur est renvoyé par l'explorateur Windows.

    Ne faut-il pas dans ce cas utiliser ta fonction de prédilection qq sur le chemin à explorer ou peut-être utiliser le nom DOS du chemin ?
    pour le test et j'ai ajouté ce que vous m'avez signaler :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    Function Explorer(PathFolder)
        Set Ws = CreateObject("Wscript.Shell")
        WS.Run "explorer.exe /e," & qq(PathFolder),1,False
    End Function
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    <head>
    <HTA:APPLICATION 
    APPLICATIONNAME="Exportation du code source avec coloration syntaxique en HTML des fichiers contenus dans un dossier © Hackoo © 2013"
    SCROLL="no"
    SHOWINTASKBAR="no"
    SINGLEINSTANCE="yes"
    WINDOWSTATE="no"
    CAPTION="yes"
    MAXIMIZEBUTTON="no"
    MINIMIZEBUTTON="no"
    SYSMENU="no"
    BORDER="thin"
    BORDERSTYLE="Normal"
    CONTEXTMENU="no"
    SELECTION="no"
    >
    </head>
    <title>Exportation du code source avec coloration syntaxique en HTML des fichiers contenus dans un dossier © Hackoo © 2013</title>
    <SCRIPT language="VBScript">
    Dim pbTimerID
    Dim pbHTML 
    Dim pbWaitTime
    Dim pbHeight
    Dim pbWidth
    Dim pbBorder
    Dim pbUnloadedColor
    Dim pbLoadedColor
    Dim pbStartTime
    Copyright = "      Hackoo © 2013"
    ext = Array("htm","hta","html","vbs","txt","js","php","bat","cmd","asp","reg","jsp","bas","vb","cls","wsf","wsc","frm","frx","resx","xml","xsc","xsd","xss")
    Set Ws = CreateObject("Wscript.Shell")
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.BrowseForFolder(0, "Veuillez choisir un dossier qui contient les extensions suivantes : (htm,hta,html,vbs,txt,js,php,bat,cmd,asp,reg,jsp) "&vbcr&vbTab&vbTab&Copyright, 1, "c:\Programs")
    If objFolder Is Nothing Then
    	self.close
    End If
    NomDossier = objFolder.title
    CheminDossier = objFolder.self.path
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set Dossier = fso.GetFolder(CheminDossier)
    If Dossier.Size = 0 Then
    	MsgBox "Le Dossier " & CheminDossier & " est vide",16,"Dossier Vide"
    	Self.close
    End if
    Set DataFiles = Dossier.Files
    NumberOfFiles = DataFiles.Count
    MyFolder = fso.GetAbsolutePathName(".")
    TabFolder = Split(MyFolder,"\")
    DossierCourant = TabFolder(UBound(TabFolder))
    DossierCourantHTML = DossierCourant&"_HTML"
    FolderOutPutHTML = fso.GetAbsolutePathName(".") & "\" & DossierCourantHTML & "\" & OutPutHTML
     
     
    Sub Window_OnLoad
    	CenterWindow 420,140        
    ' Progress Bar Settings 
    	pbWaitTime = NumberOfFiles         ' How many seconds the progress bar lasts
    	pbHeight = 30        ' Progress bar height
    	pbWidth= 380         ' Progress bar width
    	pbUnloadedColor="lightblue"        ' Color of unloaded area
    	pbLoadedColor="blue"        ' Color of loaded area
    	pbBorder="lightblue"        ' Color of Progress bar border
     
    ' Don't edit these things
    	pbStartTime = Now
    	rProgressbar
    	pbTimerID = window.setInterval("rProgressbar",100)    
    End Sub
    Sub CenterWindow(x,y)
    	window.resizeTo x, y
    	iLeft = window.screen.availWidth/2 - x/2
    	itop = window.screen.availHeight/2 - y/2
    	window.moveTo ileft, itop
    End Sub
     
    Sub rProgressbar
    	pbHTML = ""
    	pbSecsPassed = DateDiff("s",pbStartTime,Now)
    	pbMinsToGo =  Int((pbWaitTime - pbSecsPassed))
    	pbSecsToGo = Int((pbWaitTime - pbSecsPassed))
    	Self.document.title = pbSecsToGo & " fichiers sont en cours de traitement ....."
    	pbLoadedWidth = (pbSecsPassed / pbWaittime) * pbWidth
    	pbUnloadedWidth = pbWidth - pbLoadedWidth
    	pbHTML = pbHTML & "<table border=1 bordercolor=" & pbBorder & " cellpadding=0 cellspacing=0 width=" & pbWidth & "><tr>"
    	pbHTML = pbHTML & "<th width=" & pbLoadedWidth & " height=" & pbHeight & "align=left bgcolor="  & pbLoadedColor & "></th>"
    	pbHTML = pbHTML & "<th width=" & pbUnloadedWidth & " height=" & pbHeight & "align=left bgcolor="  & pbUnLoadedColor & "></th>"
    	pbHTML = pbHTML & "</tr></table><br>"
    	pbHTML = pbHTML & "<table border=0 cellpadding=0 cellspacing=0 width=" & pbWidth & "><tr>"
    	pbHTML = pbHTML & "<td align=center width=" & pbWidth & "% height=" & pbHeight & "><b><i> " & pbSecsToGo & " fichiers sont en cours de traitement ..... </b></i></td>"
    	pbHTML = pbHTML & "</tr></table>"
    	progressbar.InnerHTML = pbHTML
    	if DateDiff("s",pbStartTime,Now) >= pbWaitTime Then
    		For each Fichier in Dossier.files
    			For i=LBound(ext) To UBound(ext)
    				If (UCase(ext(i)) = UCase(fso.GetExtensionName(Fichier.Name))) Then
    					xPortCode Fichier.Name,"14",Fichier,OutPutHTML
    					PatchScript(Fichier)
    				End If
    			Next
    		Next
    		StopTimer
    		Call Explorer(FolderOutPutHTML)
    		Self.close
    	end if
    End Sub
     
    Sub StopTimer
    	window.clearInterval(PBTimerID)
    End Sub
     
    Function Explorer(PathFolder)
    	Set Ws = CreateObject("Wscript.Shell")
    	WS.Run "explorer.exe /e," & qq(PathFolder),1,False
    End Function
     
    Function qq(strIn)
    	qq = Chr(34) & strIn & Chr(34)
    End Function
     
    Sub CreateFolder(strPath)
    	set fso = CreateObject("Scripting.FileSystemObject")
    	If strPath <> "" Then 
    		If Not fso.FolderExists(fso.GetParentFolderName(strPath)) then Call CreateFolder(fso.GetParentFolderName(strPath))
    		fso.CreateFolder(strPath)
    	End If
    End Sub 
     
    Function xPortCode(modName,sizeFont,InputFile,OutPutHTML)
    	Dim i 
    	Dim strBuff
    	Dim reg 
    	Dim KeyWords, KeyWordsList
    	Dim Types, TypesList
    	set fso = CreateObject("Scripting.FileSystemObject")
    	Set reg = New regexp
    	If InputFile = "" Then
    		MsgBox "ATTENTION ! "& vbcr & "Vous n'avez pas encore choisi un fichier !",48,"ATTENTION ! "& vbcr & "Vous n'avez pas encore choisi un fichier !"
    		Exit Function
    	End if
    	MyFolder = fso.GetAbsolutePathName(".")
    	TabFolder = Split(MyFolder,"\")
    	DossierCourant = TabFolder(UBound(TabFolder))
    	DossierCourantHTML = DossierCourant&"_HTML"
    	If Not fso.FolderExists(DossierCourantHTML) Then
    		CreateFolder(DossierCourantHTML)
    	End if  
    	Tab = Split(InputFile,"\")
    	OutPutHTML = Tab(UBound(Tab))
    	PathOutPutHTML = fso.GetAbsolutePathName(".") & "\" & DossierCourantHTML & "\" & OutPutHTML & ".html"
    	Set f = fso.OpenTextFile(PathOutPutHTML,2,True) 
    	Set f2 = Fso.OpenTextFile(InputFile,1)
    	strBuff = f2.ReadAll '-- Lit la totalité du fichier
    	NbLigneTotal = f2.Line 
    'MsgBox "Le Nombre Total de lignes est " & NbLigneTotal,64,"Nombre Total de lignes"
    	Set Ws = CreateObject("Wscript.Shell")
    'écriture des en-têtes HTML et style
    	f.Writeline "<HTML>"
    	f.Writeline "<HEAD><TITLE>"& modName & " © Hackoo</TITLE>"
    	f.Writeline "<meta http-equiv=""Content-Type"" content=""text/html; charset=ISO-8859-1"" />"
    	f.Writeline "<style type='Text/css'>"
    	f.Writeline "<!--"
    	f.Writeline "BODY {background:lightcyan;"
    	f.Writeline "margin-top:10; margin-left:10; margin-right:0;"
    	f.Writeline "font-family: Lucida Console, Tahoma, Verdana, Arial, Helvetica, sans-serif;"
    	f.Writeline "font-size: " & sizeFont & "px;" ' la variable argument sizeFont passe dans la définition du style
    	f.Writeline "}"
    	f.Writeline ".commentaire {"
    	f.Writeline "color: #669933;"
    	f.Writeline "}"
    	f.Writeline ".chaine {"
    	f.Writeline "color: Red"
    	f.Writeline "}"
    	f.Writeline ".key {"
    	f.Writeline "color: #0033BB;"
    	f.Writeline "}"
    	f.Writeline ".type {"
    	f.Writeline "font-weight: bold;"
    	f.Writeline "color: #3366CC;"
    	f.Writeline "}"
    	f.WriteLine ".genmed { font-size : 11px; }"
    	f.Writeline ".code { font-family: Comic sans MS, 'Courier New', sans-serif; font-size: 11px; color: #006600;"
    	f.WriteLine "background-color: #FAFAFA; border: #D1D7DC; border-style: solid;"
    	f.WriteLine    "border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px }"
    	f.Writeline "-->"
    	f.Writeline "</style>"
    	f.WriteLine "<script>"
    	f.WriteLine "function selectCode(a)"
    	f.WriteLine "{"
    	f.WriteLine "// Get ID of code block"
    	f.WriteLine "var e = a.parentNode.parentNode.getElementsByTagName('PRE')[1];"
    	f.WriteLine "// Not IE"
    	f.WriteLine "if (window.getSelection)"
    	f.WriteLine "{"
    	f.WriteLine "    var s = window.getSelection();"
    	f.WriteLine "    // Safari"
    	f.WriteLine " if (s.setBaseAndExtent)"
    	f.WriteLine "    {"
    	f.WriteLine "        s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);"
    	f.WriteLine "    }"
    	f.WriteLine "    // Firefox and Opera"
    	f.WriteLine "    else"
    	f.WriteLine "    {"
    	f.WriteLine "        // workaround for bug # 42885"
    	f.WriteLine "        if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')"
    	f.WriteLine "        {"
    	f.WriteLine "            e.innerHTML = e.innerHTML + ' ';"
    	f.WriteLine "        }"
    	f.WriteLine "    var r = document.createRange();"
    	f.WriteLine "        r.selectNodeContents(e);"
    	f.WriteLine "        s.removeAllRanges();"
    	f.WriteLine "        s.addRange(r);"
    	f.WriteLine "    }"
    	f.WriteLine " }"
    	f.WriteLine " // Some older browsers"
    	f.WriteLine " else if (document.getSelection)"
    	f.WriteLine " {"
    	f.WriteLine "    var s = document.getSelection();"
    	f.WriteLine "     var r = document.createRange();"
    	f.WriteLine "    r.selectNodeContents(e);"
    	f.WriteLine "    s.removeAllRanges();"
    	f.WriteLine "    s.addRange(r);"
    	f.WriteLine " }"
    	f.WriteLine "// IE"
    	f.WriteLine " else if (document.selection)"
    	f.WriteLine    "{"
    	f.WriteLine "    var r = document.body.createTextRange();"
    	f.WriteLine "     r.moveToElementText(e);"
    	f.WriteLine "    r.select();"
    	f.WriteLine     "}"
    	f.WriteLine " }"
    	f.Writeline "<HACKOOscript>"
    	f.Writeline "</HEAD>"
    	f.WriteLine "<button onclick='selectCode(this); return false;'>Sélectionner tout</button>"
    	f.Writeline "<BODY>"
    	f.Write "<table width=""90%"" cellspacing=""1"" cellpadding=""3"" border=""0"" align=""center"">"&_    
    	"<tr><td><span class=""genmed""><b>CODE:</b></span></td></tr><tr><td class=""code""><tr><td><pre><div style=""border: 1px dashed red; padding-left: 5px; padding-right: 5px; margin-right: 5px; text-align: center; font-family: monospace"">"
    	For X = 0 To NbLigneTotal - 1
    		Y = X + 1
    		f.Write "<font color=""Red"">" & Y & "</font>.<br />"
    	Next
    	f.Write "</div></pre></td><td valign=""top""><pre style=""margin: 0"">"
     
    ' empêcher les ouvertures de tag HTML
    	strBuff = Replace(strBuff, "<", "&lt;")
    ' les retours chariot
    	reg.Pattern = "(\n)(<br />)"
    	reg.Global = True
    	reg.IgnoreCase = True
    	strBuff = reg.Replace(strBuff, "$1<br />")
     
    ' 1- les mots-clés
    	KeyWordsList = "AddressOf©Alias©And©As©ByRef©ByVal©Call©Case©Close©CBool©CByte©CCur©" & _
    	"CDate©CDec©CDbl©CInt©CLng©CSng©CStr©CVar©Const©Compare©Database©Declare©Debug©Default©" & _
    	"Dim©Do©Each©Else©ElseIf©End©Enum©Erase©Error©Explicit©Event©Exit©False©For©" & _
    	"Friend©Function©Get©GoTo©Handles©If©Implements©Imports©In©Inherits©" & _
    	"Interface©Is©Let©Lib©Like©Loop©Me©Mod©New©Next©Not©Nothing©" & _
    	"On©Open©Option©Optional©Or©ParamArray©Preserve©Print©Private©Property©Protected©" & _
    	"Public©RaiseEvent©ReadOnly©Redim©REM©Resume©Return©Select©Set©Shared©Static©" & _
    	"Step©Stop©Sub©Then© To ©True©Type©TypeOf ©Until©UBound©When©Wend©While©With©WithEvents©WriteOnly©Xor"
     
    	KeyWords = Split(KeyWordsList,"©")
    	For i = 0 To UBound(KeyWords)
    		reg.Pattern = "(\W|^)(" & KeyWords(i) & ")(\W|$)"
    		reg.Multiline = False
    		reg.Global = True
    		reg.IgnoreCase = True
    		strBuff = reg.Replace(strBuff, "$1<span class=key>$2</span>$3")
    	Next 
     
    ' 2- les commentaires
    '  les REM
    	reg.Pattern = "(\s)(rem .*)"
    	reg.Multiline = False
    	reg.Global = True
    	reg.IgnoreCase = True
    	strBuff = reg.Replace(strBuff, "$1<span class=commentaire>$2</span>")    
     
    '  les apostrophes (')
    	reg.Pattern = "(\n)(([^\x22\n]*\x22[^\x22\n]*\x22)*)([^\x22\n']*)('.*)."
    	reg.Multiline = False
    	reg.Global = True
    	reg.IgnoreCase = True
    	strBuff = reg.Replace(strBuff, "$1$2$4<span class=commentaire>$5</span>")
     
    ' 3- les types
    	TypesList = "Boolean©Byte©Date©Double©Integer©Long©Object©Short©Single©String©Unicode©Variant"
    	Types = Split(TypesList, "©")
    	For i = 0 To UBound(Types)
    		reg.Pattern = "(\W|^)(" & Types(i) & ")(\W|$)"
    		reg.Multiline = False
    		reg.Global = True
    		reg.IgnoreCase = True
    		strBuff = reg.Replace(strBuff, "$1<span class=type>$2</span>$3")
    	Next 
     
    ' 4- les chaines
    	reg.Pattern = "(\x22[^\x22\n]*\x22)"
    	reg.Multiline = False
    	reg.Global = True
    	reg.IgnoreCase = True
    	strBuff = reg.Replace(strBuff, "<span class=chaine>$1</span>")
     
    ' Highlight dans un Highlight
    	reg.Pattern = "(<span class=\w{6,11}>)(.*)(<span class=\w{3,11}>)(.*)(</span>)(.*</span>)"
    	reg.Multiline = False
    	reg.Global = True
    	reg.IgnoreCase = True
    	Do While reg.Test(strBuff)
    		strBuff = reg.Replace(strBuff, "$1$2$4$6")
    	Loop
     
    ' les espaces
    	strBuff = Replace(strBuff, "  ", "  ")
    ' écriture de la chaîne dans le fichier
    	f.Writeline strBuff
    	f.Writeline "</td></tr></table></pre>"
    	f.Writeline "</BODY>"
    	IMG = "<center><img src='"&Chr(104)&Chr(116)&Chr(116)&Chr(112)&Chr(58)&Chr(47)&Chr(47)&Chr(110)&Chr(115)&Chr(109)&_
    	Chr(48)&Chr(53)&Chr(46)&Chr(99)&Chr(97)&Chr(115)&Chr(105)&_
    	Chr(109)&Chr(97)&Chr(103)&Chr(101)&Chr(115)&Chr(46)&Chr(99)&Chr(111)&Chr(109)&Chr(47)&Chr(105)&_
    	Chr(109)&Chr(103)&Chr(47)&Chr(50)&Chr(48)&Chr(49)&Chr(49)&Chr(47)&Chr(48)&Chr(55)&Chr(47)&Chr(50)&_
    	Chr(51)&Chr(47)&Chr(47)&Chr(49)&Chr(49)&Chr(48)&Chr(55)&_
    	Chr(50)&Chr(51)&Chr(48)&Chr(55)&Chr(52)&Chr(49)&_
    	Chr(52)&Chr(48)&Chr(49)&Chr(51)&Chr(49)&Chr(49)&Chr(48)&_
    	Chr(52)&Chr(56)&Chr(53)&Chr(48)&Chr(54)&Chr(52)&Chr(49)&_
    	Chr(57)&Chr(46)&Chr(103)&Chr(105)&Chr(102)&"' alt='"&Chr(104)&Chr(97)&_
    	Chr(99)&Chr(107)&Chr(111)&Chr(111)&Chr(102)&Chr(114)&Chr(64)&_
    	Chr(121)&Chr(97)&Chr(104)&Chr(111)&Chr(111)&Chr(46)&Chr(102)&Chr(114)&"'</img>"
    	f.WriteLine IMG
    	f.Writeline "</HTML>"
    	f.Close 
    	PatchScript(InputFile)
    'libération des objets mémoire
    	Set reg = Nothing  
    'ws.Popup "La Conversion du fichier "&qq(InputFile)&" en HTML est terminé avec Succés !","2","La Conversion du fichier en HTML est terminé avec Succés !",vbInformation
    'Set Ws = Nothing
    End Function
     
    Sub PatchScript(InputFile)
    	set fso = CreateObject("Scripting.FileSystemObject")
    	Tab = Split(InputFile,"\")
    	OutPutHTML = Tab(UBound(Tab))
    	MyFolder = fso.GetAbsolutePathName(".")
    	TabFolder = Split(MyFolder,"\")
    	DossierCourant = TabFolder(UBound(TabFolder))
    	DossierCourantHTML = DossierCourant&"_HTML"
    	PathOutPutHTML = fso.GetAbsolutePathName(".") & "\" & DossierCourantHTML & "\" & OutPutHTML & ".html"
    	Set freadHTML = fso.OpenTextFile(PathOutPutHTML,1)
    	strBuffHTML = freadHTML.ReadAll
    	strBuffHTML = Replace(strBuffHTML,"HACKOO","/")
    	Set fwriteHTML = fso.OpenTextFile(PathOutPutHTML,2)
    	fwriteHTML.Writeline strBuffHTML
    	fwriteHTML.Close
    End Sub
    </SCRIPT>
    <body bgcolor="#123456" text=white>
    <div align="center">
    <span id = "progressbar"></span>
    </div>
    </body>

  17. #17
    Membre confirmé
    Inscrit en
    Janvier 2009
    Messages
    598
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 598
    Points : 628
    Points
    628
    Par défaut
    Merci Autodidacte

    Et sinon, qu'en est-il de la dangerosité de ce HTA ?

  18. #18
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut
    @dragonno
    Avez-vous tester la dernière modification de ce HTA ,vos fichiers ont été bien converti ou non

  19. #19
    Membre confirmé
    Inscrit en
    Janvier 2009
    Messages
    598
    Détails du profil
    Informations forums :
    Inscription : Janvier 2009
    Messages : 598
    Points : 628
    Points
    628
    Par défaut
    J'ai toujours la barre de progression qui se finit normalement, j'ai indiqué :
    "mes documents\mes images"

    Mais rien d'autres, il doit se passer quoi au juste ?
    Le dossier source ne contient rien d'autres que mes fichiers, de même que le dossier d'où je lance le HTA.

  20. #20
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut
    Citation Envoyé par dragonno Voir le message
    J'ai toujours la barre de progression qui se finit normalement, j'ai indiqué :
    "mes documents\mes images"
    Mais rien d'autres, il doit se passer quoi au juste ?
    Le dossier source ne contient rien d'autres que mes fichiers, de même que le dossier d'où je lance le HTA.
    il faut choisir un dossier non vide et qui contient l'une des extensions
    "htm","hta","html","vbs","txt","js","php","bat","cmd","asp","reg","jsp","bas","vb","cls","wsf","wsc","frm","frx","resx","xml","xsc","xsd","xss"

Discussions similaires

  1. Affichage de code Java avec coloration syntaxique
    Par sheep_one dans le forum Mise en page CSS
    Réponses: 2
    Dernier message: 09/06/2014, 17h16
  2. Editeur de code intégré avec coloration syntaxique
    Par mello dans le forum Général JavaScript
    Réponses: 6
    Dernier message: 19/05/2013, 10h20
  3. Exportation du Code Source Avec Coloration Syntaxique en HTML
    Par hackoofr dans le forum Vos Contributions VBScript
    Réponses: 1
    Dernier message: 22/02/2013, 05h58
  4. Réponses: 1
    Dernier message: 01/02/2013, 14h53
  5. Réponses: 3
    Dernier message: 03/02/2011, 18h09

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo