FTP Gestion..0.1!

« Older   Newer »
  Share  
Gianlu-thebest
CAT_IMG Posted on 2/5/2010, 11:01     +1   -1




Questo è uno dei miei programmi più utili FTP Gestion 0.1
L'ho provato è funziona benissimo, ecco le funzionalità:

  • Upload di file con Progresso

  • Crea cartelle

  • Elimina cartelle

  • Elimina file

  • Scarica file con progresso

  • Possibilità di salvare i dati

  • Possibilitò di connettersi in modalità passiva


Vi consiglio di provarlo...
SPOILER (click to view)
CODICE
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <FTPex.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Login", 453, 166, 192, 124)
$Input1 = GUICtrlCreateInput(FileReadLine(@homedrive&"\host-pass.txt",1), 96, 40, 265, 21)
$Input2 = GUICtrlCreateInput(FileReadLine(@homedrive&"\host-pass.txt",2), 96, 64, 265, 21)
$Checkbox1 = GUICtrlCreateCheckbox("Ricorda i dati", 80, 96, 89, 17)
$Label1 = GUICtrlCreateLabel("Host:", 32, 42, 29, 17)
$Label2 = GUICtrlCreateLabel("Password:", 32, 64, 53, 17)
$Button1 = GUICtrlCreateButton("Login", 104, 128, 211, 25, 0)
$Input3 = GUICtrlCreateInput(FileReadLine(@homedrive&"\host-pass.txt",3), 96, 16, 265, 21)
$Label3 = GUICtrlCreateLabel("User", 32, 16, 26, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Connessione passiva", 200, 96, 137, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
       $nMsg = GUIGetMsg()
       Switch $nMsg
               Case $GUI_EVENT_CLOSE
                       Exit
               Case $Button1
                       If BitOR(guictrlread($input1) = "*.altervista.org",guictrlread($input2) = "", guictrlread($input1) = "",guictrlread($input2) = "") = 1 Then
                               MsgBox(48,"Avviso","Inserisci i dati corretti!")
                       Else
                               $user=GUICtrlRead($Input3)
                               $host=GUICtrlRead($Input1)
                               $password=GUICtrlRead($input2)
                               $open=_FTP_Open("myftp")
                               If GUICtrlRead($CheckBox2) = 1 Then
                                       $passiva = 1
                               Else
                                       $passiva = 0
                               EndIf
                               If GUICtrlRead($CheckBox1) = 1 Then
                                       If FileExists(@homedrive&"\host-pass.txt") Then FileDelete(@homedrive&"\host-pass.txt")
                                       FileWrite(@homedrive&"\host-pass.txt",GUICtrlRead($input1)&@CRLF&GUICtrlRead($Input2)&@CRLF&GUICtrlRead($Input3))
                               EndIf
                               $connect=_FTP_Connect($open,$host,$user,$password,$passiva)
                               If @error Then
                                       MsgBox(16,"Errore","Errore!")
                               Else
                                       GUIDelete()
                                       MsgBox(64,"Connesso","Connesso!")
                                       _GUI()
                               EndIf
                       EndIf                                
                       
       EndSwitch
WEnd

Func _GUI()
       
       $Form2 = GUICreate("FTP Gestion 0.1", 633, 547, 192, 124)
       $Label1 = GUICtrlCreateLabel("Connesso!", 144, 8, 54, 17)
       $Group1 = GUICtrlCreateGroup("Upload", 24, 72, 577, 137)
       $Button1 = GUICtrlCreateButton("Sfoglia", 520, 96, 75, 25, 0)
       $Label2 = GUICtrlCreateLabel("File da caricare:", 40, 96, 79, 17)
       $Input1 = GUICtrlCreateInput("", 128, 96, 377, 21,$GUI_ACCEPTFILES)
       $Label3 = GUICtrlCreateLabel("Posizione in cui caricare", 32, 128, 118, 17)
       $Input2 = GUICtrlCreateInput("/file.ext", 168, 128, 409, 21)
       $Button2 = GUICtrlCreateButton("Upload", 200, 168, 171, 25, 0)
       GUICtrlCreateGroup("", -99, -99, 1, 1)
       Global $Progress1 = GUICtrlCreateProgress(24, 224, 582, 17)
       $Label4 = GUICtrlCreateLabel("", 24, 248, 172, 20)
       $Input5 = GUICtrlCreateInput("/nome_cartella", 88+15, 298, 409, 21)
       $Crea_Carte = GUICtrlCreateButton("Crea Cartella",15,297)
       $annulla_up = GUICtrlCreateButton("Annulla upload",420,167)
       $input6 = GUICtrlCreateInput("/nome_cartella", 88+15, 328, 409, 21)
       $remove_cart = GUICtrlCreateButton("Elimina Cartella",15,327)
       $file_remove = GUICtrlCreateButton("Elimina   File  ",15,327+29)
       $file_input = GUICtrlCreateInput("/file.ext",88+15,327+30,409,21)
       $down_file = GUICtrlCreateButton("Scarica file",15,(327+29)+29)
       $down_input = GUICtrlCreateInput("/file.ext",88+15,327+(30*2),409/2,21)
       $down_inpu2 = GUICtrlCreateInput(@Homedrive&"\file.ext",88+15+(409/2),327+(30*2),409/2,21)
       Global $Pr = GUICtrlCreateProgress(24,327+(30*3),582,17)
       GUISetState(@SW_SHOW)
       
       While 1
               $nMsg = GUIGetMsg()
               Switch $nMsg
                       Case $GUI_EVENT_CLOSE
                               Exit
                       Case $Button1
                               $file=FileOpenDialog("","","ALL(*.*)")
                               GUICtrlSetData($input1,$file)
                       Case $Button2
                               If BitOR(guictrlread($input1) = "",guictrlread($input2) = "") <> 1 Then
                                       $size=FileGetSize(GUICtrlRead($input1))
                                       _FTP_ProgressUpload($connect,GUICtrlRead($input1),GUICtrlRead($input2),"Set")
                                       MsgBox(64,"Upload","Upload completato!")
                                       GUICtrlSetData($Progress1,0)
                               EndIf
                       Case $Crea_Carte
                               _FTP_DirCreate($connect,guictrlread($input5))
                               If not @error Then
                                       MsgBox(64,"Cartella creata","Cartella creata!")
                               Else
                                       MsgBox(16,"Cartella non creata","Errore")
                               EndIf
                       Case $remove_cart
                               _FTP_DirDelete($connect,GUICtrlRead($input6))
                               If not @error Then
                                       MsgBox(64,"Cartella eliminata","Cartella eliminata!")
                               Else
                                       MsgBox(16,"Cartella non eliminata","Errore")
                               EndIf
                       Case $file_remove
                               _FTP_FileDelete($connect,GUICtrlRead($file_input))
                               If Not @error Then
                                       MsgBox(64,"File eliminato","File eliminato!")
                               Else
                                       MsgBox(16,"File non eliminato","File non eliminato!")
                               EndIf
                       Case $down_file
                               _FTP_ProgressDownload($connect,GUICtrlRead($down_inpu2),GUICtrlRead($down_input),"SetD")
                               If Not @error Then
                                       MsgBox(64,"Download completato","Download completato!")
                               Else
                                       MsgBox(10+6,"Download non completato!","Si è verificato un'errore!")
                               EndIf
                               GUICtrlSetData($PR,0)
               EndSwitch
       WEnd
EndFunc

Func Set($Percentage)
       GUICtrlSetData($Progress1,$Percentage)
       Return 1        
       Switch GUIGetMsg()
       Case $GUI_EVENT_CLOSE
           Return -1
       Case $annulla_up
               Return 0
       EndSwitch
EndFunc

Func SetD($Percentage)
       GUICtrlSetData($Pr,$Percentage)
       Return 1
       Switch GUIGetMsg()
       Case -3
               Return -1
       EndSwitch
EndFunc
 
Top
ACIDBURN16
CAT_IMG Posted on 2/5/2010, 11:13     +1   -1




Bravo, molto utile ;)
 
Top
-Anubi-
CAT_IMG Posted on 2/5/2010, 11:30     +1   -1




CITAZIONE
Vi consiglio di provarlo...

Sennò? xD
Comunque bello
 
Top
Kurt_Black_hat 2.0
CAT_IMG Posted on 2/5/2010, 18:54     +1   -1




Good!
 
Top
Gianlu-thebest
CAT_IMG Posted on 2/5/2010, 18:55     +1   -1




Thanks you
 
Top
Kurt_Black_hat 2.0
CAT_IMG Posted on 2/5/2010, 18:57     +1   -1




Questo mi piace davvero molto :P
 
Top
Gianlu-thebest
CAT_IMG Posted on 2/5/2010, 19:03     +1   -1




grazie
 
Top
6 replies since 2/5/2010, 11:01   141 views
  Share