Prayag Posted December 15, 2015 Posted December 15, 2015 Hi, i am working on this project to download file from many servers using ftp having same path and same filename.but i am stuck. pl Help1. Gui. where i select From which servers i need to download using Checkbox2. GUI. i select which Files i need to download using Checkbox3. after Download finishes for each server , the next ti Server IP input Box " Download Successfully if Written Code Check how many Server are checkedthen Puts them in Array and Ftp download as per the data Check box selected. expandcollapse popup#include <GUIConstants.au3> #include <DateTimeConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("HU-CDMA Database Backup", 419, 220, 127, 128) GUISetFont(10, 400, 0, "MS Sans Serif") GUISetBkColor(0xFFFFFF) $Input1 = GUICtrlCreateInput(" Finished", 88, 16, 185, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Input2 = GUICtrlCreateInput(" Downloading...", 88, 48, 185, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Input3 = GUICtrlCreateInput(" Downloading...", 88, 80, 185, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Destination Dir", 296, 8, 113, 33, 0) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton("Download", 296, 56, 113, 33, 0) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Checkbox1 = GUICtrlCreateCheckbox("@SW_HIDE", 296, 96, 113, 17) $Checkbox2 = GUICtrlCreateCheckbox("Data 1", 296, 120, 113, 17) $Checkbox3 = GUICtrlCreateCheckbox("Data 2", 296, 145, 113, 17) $Checkbox4 = GUICtrlCreateCheckbox("Data 3", 296, 170, 113, 17) $Checkbox5 = GUICtrlCreateCheckbox("Server 1", 8, 16, 73, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Checkbox5 = GUICtrlCreateCheckbox("Server 2", 8, 48, 72, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Checkbox6 = GUICtrlCreateCheckbox("Server 3", 8, 80, 71, 28) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetState($Button2, $GUI_DISABLE) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $var = FileSelectFolder("Choose a folder.", "") if $var <> "" then $ArrayToString = "" GUICtrlSetState($Button2, $GUI_ENABLE) FileChangeDir (@ScriptDir) endif Case $Button2 $CheckBoxStatus2 = GuiCtrlRead($CheckBox2) ; Read the status for CheckBox1 $CheckBoxStatus3 = GuiCtrlRead($CheckBox3) ; Read the status for CheckBox2 $CheckBoxStatus4 = GuiCtrlRead($CheckBox4) ; Read the status for CheckBox2 $FTPServer = GUICtrlRead($Input1) $user = "ftpcommon" $password = "Password2008" $file = FileOpen($var & "\FTPX.DAT", 2) $command1 = "ftp -s:FTPX.DAT " & $FTPServer $command2 = $user & @CRLF & $password & @CRLF If $CheckBoxStatus2 = $GUI_UNCHECKED Then $command3 = "get /tmp/data1.TXT" & @CRLF ElseIf $CheckBoxStatus3 = $GUI_CHECKED Then $command3 = "get /tmp/data2.TXT" & @CRLF ElseIf $CheckBoxStatus4 = $GUI_CHECKED Then $command3 = "get /tmp/data2.TXT" & @CRLF EndIf ; End If/ElseIf statement for CheckBox1 IF BitAND (GUICtrlRead($Checkbox2), $GUI_CHECKED) then $command3 = "get /tmp/data1.TXT" & @CRLF ElseIf BitAND (GUICtrlRead($Checkbox3), $GUI_CHECKED) then ElseIf BitAND (GUICtrlRead($Checkbox4), $GUI_CHECKED) then $command3 = "get /tmp/data3.TXT" & @CRLF MsgBox(0,"to Download","Please select Data to Download") endif ; { ; need code to show Progress or confirmation file downloaded Sucessfully ;} $command3 = "bye" & @CRLF if FileWriteLine($file, $command3) then FileClose($file) FileChangeDir ($var) $commandX =@SW_MAXIMIZE IF BitAND (GUICtrlRead($Checkbox1), $GUI_CHECKED) then $commandX = @SW_HIDE RunWait($command1, "", $commandX) FileDelete("FTPX.DAT") FileChangeDir (@ScriptDir) endif EndSwitch WEnd
orbs Posted December 15, 2015 Posted December 15, 2015 @Prayag,welcome to AutoIt and to the forum!please report your own topic and ask a mod to transfer it to where it belongs - that's the General Help and Support forum. there, i'm certain, you'll get all the help you need. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates WinPose - simultaneous fluent move and resize Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Magic Math - a math puzzle Demos: Title Bar Menu - click the window title to pop-up a menu
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now