Étape 5: Script sans commentaire
« Votre VB avant le FTP upload Dim MyDirectory As String Dim fichier1 AsIntegerDim fichier2 comme IntegerFile1 = FreeFileFile2 = FreeFile ' changer cela dans un répertoire de votre choix ‘Your VB before the FTP upload Dim MyDirectory As String Dim File1 AsIntegerDim File2 As IntegerFile1 = FreeFileFile2 = FreeFile ‘Change this to a directory of your choosing MyDirectory = “C:\Temp\FTPFiles" ‘Kill existing .out filesIf Dir(MyDirectory & ".out") <> "" Then Kill (MyDirectory & ".out") Open MyDirectory & ".txt" For Output As #File1 ‘Put your ftp server address herePrint #File1, "open ftp.myserver.com" ‘Put your user name herePrint #File1, “my_username” ‘Put your password herePrint #File1, “my_password” ‘Change your remote directory. Omit this line if root is fine.Print #File1 “cd my/remote/directory/” ‘Add your list of files here using put or mput with wildcard if neededPrint #File1, “put C:/MyFiles/thisfile1.png”Print #File1, “put C:/MyFiles/thisfile2.png” Print #File1, "bye"Close #File1 Open MyDirectory & ".bat" For Output As #File2Print #File2, "ftp -s:" & MyDirectory & ".txt"Print #File2, "Echo ""Complete"" > " & MyDirectory & ".out" Close #File2 ‘Execute the bat fileShell (MyDirectory & ".bat"), vbNormalFocus Do While Dir(MyDirectory & ".out") = "" DoEvents Loop Application.Wait (Now + TimeValue("0:00:03")) ‘Delete the batch filesIf Dir(MyDirectory & ".bat") <> "" Then Kill (MyDirectory & ".bat")If Dir(MyDirectory & ".out") <> "" Then Kill (MyDirectory & ".out")If Dir(MyDirectory & ".txt") <> "" Then Kill (MyDirectory & ".txt") ‘Your VB after the upload "Tuer existants .out filesIf Dir (MyDirectory & « .out ») <>" "puis le tuer (MyDirectory &".out")' Mettre votre ftp serveur adresse herePrint #File1, « open ftp.myserver.com » ' mettre votre utilisateur nom herePrint #File1, « my_username » "Mettez votre mot de passe herePrint #File1, « base » ' modifier votre répertoire distant. Omettez cette ligne si la racine est très bien. Imprimer #File1 "mon cd/télécommande/annuaire /" ' ajouter à votre liste de fichiers ici en utilisant put ou mput avec joker si neededPrint #File1, "mis C:/MyFiles/thisfile1.png"Print #File1, « mettre C:/MyFiles/thisfile2.png » Print #File1, "bye" Close #File1 Open MyDirectory & ".bat" pour sortie comme #File2Print #File2, "ftp - s:" & MyDirectory & ".txt" imprimer #File2, "Echo""complet" ">" & MyDirectory & ".out" fermer #File2 ' exécuter la fileShell bat (MyDirectory & « .bat ») , constantes vbNormalFocus Do tandis que Dir(MyDirectory & ".out") = "" DoEvents Loop