three3 Posted May 7, 2013 Share Posted May 7, 2013 I am new for autoit programing? Objective: To make the program which send all the .dis files(Create one folder on my desktop computerwith all the dis files) to the servers. By using the KODA I made the GUI for the servers. The gui has selection button for each server and OK button. Once we select the servers and press ok button is there any way to send all the .dis files which are on my desktop computer to servers? Can anybody help me with this? If u need more information let me know Thanks Link to comment Share on other sites More sharing options...
FireFox Posted May 7, 2013 Share Posted May 7, 2013 Hi, Use the TCP* functions, there are many examples on the forum and some nice commented ones in the Examples Scripts forum section. Br, FireFox. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 7, 2013 Moderators Share Posted May 7, 2013 Hi, three3. I think you need to specify what you mean by "send files to the servers". Are you talking a straight copy, an email, an FTP, carrier pigeon? The method you use to get the files where you need them will determine what your code looks like. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
three3 Posted May 8, 2013 Author Share Posted May 8, 2013 (edited) Hi JLogan3o13, Thanks for ur reply. Actually i want to copy all .dis extension files one by one and copy them to the server. Before i did not create the GUI for all the servers by using the ftp protocol i send the files to the servers one by one.please take a look at the below code expandcollapse popup#include <Date.au3> ;includes a date file in the current script Run("cmd.exe") ;Run the command prompt(External Programm) Sleep(1000) ;Pause script execution 1000=delay in milliseconds Send("cd\") ;send simulated keystrokes to the active window Sleep(2000) ;pause for two seconds Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) Send("cd temp") ;send cd temp to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("dir") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("ftp 10") ;send ftp 10 to the command prompt Send("{.}") ;send (.) to the command prompt Send("85") ;send 85 to the command prompt Send("{.}") ;send (.) to the command prompt Send("161") ;send 161 to the command prompt Send("{.}") ;send (.) to the command prompt Send("82") ;send 82 to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("emcadmin") ;send emcadmin to the command prompt sleep(500) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("emc") ;send emc to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("pwd") ;send PWD to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("cd /v/emc/tmp") ;send cd /v/emc/tmp to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000 ;pause for one second Send("pwd") ;send pwd to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("bin") ;send bin to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("put dmcall05") ;send put dmcall05 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("put d0911553dmc01") ;send put d0911553dmc01 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("put dmcall07") ;send put dmcall07 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("put f0311456_1") ;send put f0311456_1 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTERto the command prompt Sleep(1000) ;pause for one second Send("put g1011407_1") ;send put g1011407_1 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("put g2411600dmc01") ;send put g2411600dmc01 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTEr to the command prompt Sleep(1000) ;pause for one second Send("put g2511049dmc01") ;send put g2511049dmc01 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("put g2821715_1") ;send put g2821715_1 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("put l1910948_1") ;send put l1910948_1 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("put m1921603_1") ;send put m1921603_1 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("put n2911001_1") ;send put n2911001_1 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Send("put n2911442dmc01") ;send put n2911442dmc01 to the command prompt Send(".") ;send (.) to the command prompt Send("dis") ;send dis to the command prompt Sleep(1000) ;pause for one second Send("{ENTER}") ;send ENTER to the command prompt Sleep(1000) ;pause for one second Global $hCmdWnd, $aCmdPoss ;declare a variable $hCmdWnd = WinGetHandle("[CLASS:Command Prompt]") ;Recover the internal handle of window If Not WinActive($hCmdWnd) Then WinActivate($hCmdWnd);winactive-checks to see if a specified window(command) exits and currently active,winactivate-activates a command window $aCmdPos = WinGetPos($hCmdWnd) ;recover the position and size of command window MouseClick("right", $aCmdPos[0] + 15, $aCmdPos[1] + 40, 1, 0);right click on the mouse and search for the x,y position Send("{DOWN 4}{ENTER 2}") ;Copy the command window Run("notepad.exe") ;Run the notepad WinWaitActive("[CLASS:Notepad]") ;pauses execution of the script until the notepad window is active Send("^v") ;paste the command prompt on notepad WinClose("[CLASS:Notepad]") ;close the notepad window WinWaitActive("Notepad", "") ;pauses execution of the script until the notepad window is close Send("!s");save the .txt file WinWaitActive("Save As", "") ;pauses execution of the script until the save as is selected Sleep (5000) ;pause for five seconds Send("C:\temp\results\Decoder installation.text") ;send the .txt file in results folder Sleep(5000) ;pause for 5 seconds Send("!s");save the file Local $TempFileDate = FileGetTime(@ScriptDir, 0);returns the time and date information for a file Local $JobLastRun = $TempFileDate[0] & "/" & $TempFileDate[1] & "/" & $TempFileDate[2] & " " & $TempFileDate[3] & ":" & $TempFileDate[4] & ":" & $TempFileDate[5];find the date and time of last job local $diff_in_minutes = _DateDiff("n", $JobLastRun, _NowCalc()) ; store minute difference in variable ConsoleWrite($diff_in_minutes & @LF) ; display variable in console Sleep(2000) ;pause for 2 seconds send("{left}") ;send the left arrow Sleep(1000) ;pause for 1 second send("{Enter}") ;press enter MsgBox(0, '', _NowCalc() & @CRLF & $JobLastRun & @CRLF & _DateDiff("n", $JobLastRun, _NowCalc()),2);message box shows the difference of two dates and time MouseMove(878, 611, 50) ;move the mouse to the x,y position MouseClick("left", 878, 611, 1, 0) ;mouse click on the x,y position Send("{ENTER}") ;press enter You can see in the above code that i by using ftp i send the files to the servers.now i made the GUI for all the servers #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("PNC Servers", 615, 438, 244, 132) Global $Checkbox1 = GUICtrlCreateCheckbox("10.85.161.82", 160, 96, 217, 41) GUICtrlSetFont($Checkbox1, 15, 800, 0, "MS Sans Serif") Global $Checkbox2 = GUICtrlCreateCheckbox("10.85.161.86", 160, 144, 161, 41) GUICtrlSetFont($Checkbox2, 15, 800, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("ok", 200, 216, 75, 25) GUICtrlSetFont($Button1, 12, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Run("cmd.exe") EndSwitch WEnd when i run the above program the GUI open with checkbox with servers ip address and at last the ok button. with the GUI how can i copy the files and paste it to the servers. if this information is not enough please let me know Thanks Edited May 8, 2013 by Melba23 Added autoit tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 8, 2013 Moderators Share Posted May 8, 2013 three3,When you post code please use Code tags - put [autoit] before and [/autoit] after your posted code. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 8, 2013 Moderators Share Posted May 8, 2013 I would suggest looking at _FTP_FilePut in the help file. You should be able to open an FTP session, and put those files on the server without all of those Sends to the command line window. Just based on your code above, I would think it would look something like this (untested!): #include <FTPEx.au3> $myFTP = _FTP_Open("MyFtp") $session = _FTP_Connect($myFTP, "10.85.161.82", "emcadmin", "emc") _FTP_FilePut($session, "dmcall1105.dis", "/v/emc/temp") "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
ZombieKillz Posted May 30, 2013 Share Posted May 30, 2013 I know this is an old topic, but here is a suggestion to add on to JLogan3o13's code (also untested ). In the help file find _FileListToArray to get all .dis files from your Desktop directory, then "put" each one onto the server using a For loop. #include <FTPEx.au3> #include <File.au3> #include <Array.au3> $myFTP = _FTP_Open("MyFtp") $session = _FTP_Connect($myFTP, "10.85.161.82", "emcadmin", "emc") $disArray = _FileListToArray(@DesktopDir, "*.dis", 1) If @error Then ; put some message box here, maybe, that no files were found? Else For $i = 1 to $disArray[0] _FTP_FilePut($session, @DesktopDir&"\"&$disArray[$i], "/v/emc/temp/"&$disArray[$i]) Next EndIf Link to comment Share on other sites More sharing options...
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