Convertisort : Différence entre versions
(Page créée avec « Convertisort converti le texte copié du .pdf du Livre du Joueur et collé dans un fichier "input.txt", en texte formaté pour être directement ajouté dans le Wiki. Ce t... ») |
|||
| Ligne 1 : | Ligne 1 : | ||
Convertisort converti le texte copié du .pdf du Livre du Joueur et collé dans un fichier "input.txt", en texte formaté pour être directement ajouté dans le Wiki. Ce texte est stocké dans le fichier "output.txt". | Convertisort converti le texte copié du .pdf du Livre du Joueur et collé dans un fichier "input.txt", en texte formaté pour être directement ajouté dans le Wiki. Ce texte est stocké dans le fichier "output.txt". | ||
| + | |||
| + | Il faut juste modifier le code pour changer l'élément. | ||
==Script== | ==Script== | ||
| − | + | <pre> | |
Const ELEMENT = "Air" | Const ELEMENT = "Air" | ||
| Ligne 66 : | Ligne 68 : | ||
getStr = ret | getStr = ret | ||
End Function | End Function | ||
| + | </pre> | ||
Version du 24 février 2012 à 05:43
Convertisort converti le texte copié du .pdf du Livre du Joueur et collé dans un fichier "input.txt", en texte formaté pour être directement ajouté dans le Wiki. Ce texte est stocké dans le fichier "output.txt".
Il faut juste modifier le code pour changer l'élément.
Script
Const ELEMENT = "Air"
Set fso = CreateObject("Scripting.FileSystemObject")
Set input = fso.OpenTextFile("input.txt", 1)
Set output = fso.CreateTextFile("output.txt", True)
X = input.readAll
input.close
Dim KeyWord(7)
KeyWord(0) = "Temps d'incantation-"
KeyWord(1) = "Portée-"
KeyWord(2) = "Durée-"
KeyWord(3) = "Zone-"
KeyWord(4) = "Effet-"
KeyWord(5) = "Spécial-"
KeyWord(6) = "Utilisation alternative-"
output.write "{{DISPLAYTITLE:<span>" & ELEMENT & " : {{PAGENAME}} -Coût " & getStr("-Coût ", " cL", X) & " cL</span>}}" & vbcrlf
For i = 0 to 6
For j = i+1 to 6
Z = "-"
debut = KeyWord(i)
fin = KeyWord(j)
if i >= 4 then
Z = vbcrlf
if j >= 6 then
fin = vbEndOfFile
end if
end if
Y = getStr(debut, fin, X)
Y = Replace(Y, " ", " ")
Y = Replace(Y, " ", " ")
Y = Replace(Y, " ", " ")
if Y <> "" then
output.write "*" & mid(KeyWord(i), 1, len(KeyWord(i)) - 1) & Z & Y
exit for
end if
Next
Next
output.write vbcrlf & "[[Catégorie:Sorts " & ELEMENT & "]]" & vbcrlf & "[[Catégorie:Livre du Joueur]]"
output.close
Function getStr(strStart, strEnd, text)
posStart = inStr(text, strStart)
lenStart = len(strStart)
posEnd = inStr(text, strEnd)
lenGet = posEnd - posStart - lenStart
if posStart = 0 then
ret = ""
elseIf posEnd = 0 then
ret = ""
elseIf lenGet < 0 then
ret = mid(text, posStart + lenStart)
else
ret = mid(text, posStart + lenStart, lenGet)
end if
getStr = ret
End Function