source="c:\bookmarkjc.htm"
Set sh = WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
repfav= sh.SpecialFolders("Favorites")
reponse=""
'lire le fichier source
Set fch = fs.OpenTextFile(source, 1, true)
rep=repfav
rang=0
Do While not fch.atEndOfStream
txt=fch.readLine
if instr(txt,"FOLDED ADD_DATE")>0 then
'créer le répertoire
txt=right(txt,len(txt)-instr(txt,"FOLDED ADD_DATE"))
txt=right(txt,len(txt)-instr(txt,">"))
txt=left(txt,instr(txt,"<")-1)
'msgbox txt
rep=rep & "\" & txt
if not fs.folderexists(rep) then
fs.createfolder(rep)
end if
reponse=reponse & chr(10) & rep
'contenu du rep
do while instr(txt,"
")>0 and not fch.atEndOfStream
txt=fch.readLine
loop
end if
if instr(txt,"
")>0 then
rep=part(rep)
'msgbox rep
end if
if instr(txt,"0 then
'créer le raccourci
txturl=txt
txt=right(txt,len(txt)-instr(txt,""))
txt=left(txt,instr(txt,"<")-1)
txturl=right(txturl,len(txturl)-instr(txturl,""""))
txturl=left(txturl,instr(txturl,"""")-1)
cree_rac rep & "\" & txt & ".url",txturl
reponse=reponse & chr(10) & " " & rep & "\" & txt & ".url"
end if
Loop
fch.close
Set nouv_fich = fs.OpenTextFile("c:\rien.txt", 2, true)
nouv_fich.write reponse
nouv_fich.close
sh.run "explorer c:\rien.txt"
set sh=nothing
function part(rept)
do while right(rept,1)<>"\"
rept=left(rept,len(rept)-1)
loop
rept=left(rept,len(rept)-1)
part=rept
end function
sub cree_rac(adr,url)
if not fs.fileexists(adr) then
Set nouv_fich = fs.OpenTextFile(adr, 2, true)
nouv_fich.writeline "[InternetShortcut]"
nouv_fich.writeline "URL=" & url
nouv_fich.close
end if
end sub