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
| Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
'******************************************************************************
'***********boutton pour télécharger un fichier musical sur server ftp*********
'******************************************************************************
'déclaration + demande d'aide au démarage
Dim aide
aide = MsgBox("lors des premières utilisations une illustration est disponible désirez-vous la voir ?", vbQuestion + vbYesNo, "Z!T¤ùN£ @NT!C!P-W!N-32")
'si reponse oui
If aide = vbYes Then
'ouverture image d'illustration suite à la réponse oui
Dim WshShell
WshShell = CreateObject("WScript.Shell")
WshShell.Run("C:\ftp\image\capture.jpg")
End If
'*******************************************
'** déclaration + utilisation 1er inputbox**
'*******************************************
Dim rep, title, defaultValue As String
rep = "Merci de coller ici UNIQUEMENT l'emplacement du fichier à télécharger le titre vous sera demander après !"
title = "emplacement du fichier à télécharger ?"
defaultValue = "cela doit commencer par une LETTRE et finir par un \"
rep = InputBox(rep, title, defaultValue)
'*******************************************
'** déclaration + utilisation 2èm inputbox**
'*******************************************
Dim chx, title0, defaultValue0 As String
chx = "Merci de coller ici UNIQUEMENT le titre à télécharger"
title0 = "nom fichier à télécharger"
defaultValue0 = "générallement se termine par .mp3"
chx = InputBox(chx, title0, defaultValue0)
'*******************************************
'****déclaration + créer fichier choixDL****
'*******************************************
Dim FSys
FSys = CreateObject("Scripting.FileSystemObject")
Dim Monfic
Monfic = FSys.CreateTextFile("C:\ftp\script\choixdl.txt")
'écris le résultat des inputbox dans le fichier choixdDL
With Monfic
Monfic.writeLine("open @ftp")
Monfic.writeLine("id")
Monfic.writeLine("mdp")
Monfic.writeLine("lcd C:\ftp\Telechargements")
Monfic.writeLine("cd """ & rep & "")
Monfic.writeLine("get """ & chx & "")
Monfic.writeLine("quit")
End With
Monfic.close()
'***********************************************************************************
'**déclaration + lancement téléchargements ftp & ouverture dossier téléchargements**
'***********************************************************************************
Dim Shell, com, Result, Dl
Shell = CreateObject("WScript.Shell")
com = "cmd /c ftp -s:c:\ftp\script\choixdl.txt"
Result = Shell.Run(com, 0, True)
Dl = ("C:\ftp\telechargements")
Shell.Run(Dl)
'****************************
'** info pour utilisateur****
'****************************
Dim Info As String
Info = "Résumer de votre Téléchargement :""" & rep & chx & ""
Info = MsgBox(Info)
'Signature
MsgBox("Creation Z!T¤ùN£_@nT!C!P-W!n-32")
'*****************************
'*suppression fichier script**
'*****************************
If System.IO.File.Exists("c:\ftp\script\choixdl.txt") Then
File.Delete("c:\ftp\script\choixdl.txt")
End If
End Sub |
Partager