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
| '+
' Classe de gestion du clipboard
'-
Class cClipBoard
Private objIE
Public Property Get Data()
Data = objIE.Document.ParentWindow.ClipboardData.GetData("Text")
End Property
Public Property Let Data ( Value )
objIE.Document.ParentWindow.ClipboardData.SetData "Text" , Value
End Property
Public Sub Clear()
objIE.Document.ParentWindow.ClipboardData.ClearData()
End Sub
Private Sub Class_Initialize
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate ("about:blank")
End Sub
Private Sub Class_Terminate
objIE.Quit
Set objIE = Nothing
End Sub
End Class
'+
' Programme principal
'-
Dim ClipBoard
Set Clipboard = New cClipBoard
'
' récup argument ligne de commande
'
Set sh = CreateObject("WScript.Shell")
Set argv = Wscript.Arguments
'
' transformation des espaces et autres en "%xx"
'
filename=argv(0)
url="file://" & filename
url=replace(url, " ", "%20")
url=replace(url, "É", "%C9")
url=replace(url, "é", "%E9")
url=replace(url, "è", "%E8")
url=replace(url, "à", "%E0")
url=replace(url, "ê", "%EA")
url=replace(url, "ù", "%F9")
url=replace(url, "È", "%C8")
url=replace(url, "Ç", "%C7")
url=replace(url, "À", "%C0")
url=replace(url, "Ù", "%D9")
url=replace(url, "Ê", "%CA")
url=replace(url, "ç", "%E7")
url=replace(url, "â", "%E2")
url=replace(url, "Â", "%C2")
url=replace(url, "ï", "%EF")
url=replace(url, "Ï", "%CF")
url=replace(url, "ö", "%F6")
url=replace(url, "Ö", "%D6")
' continuer comme ça pour tous les caractères accentués
ClipBoard.Clear ' effacemengt du clipboard
ClipBoard.Data = url ' ajout de l'url dans le clipboard |