Collins Posted August 22, 2018 Share Posted August 22, 2018 Hello. How do i create script that will connect to my FTP SERVER. And I also have a text file name greet.txt on the server which has the words "Hello User" in it. How can i make my script connect to my ftp server. Read the string from the .txt file and then output the content using MSGBOX.. Below is my script which connects to the ftp_server Link to comment Share on other sites More sharing options...
caramen Posted August 22, 2018 Share Posted August 22, 2018 Can you access to the file with an administrative share ? I mean: \\Servername\Data If yes it will be easy. If not How do you access to your file ? My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
AutoBert Posted August 22, 2018 Share Posted August 22, 2018 Test this script: #include <FTPEx.au3> #include <MsgBoxConstants.au3> _Example() Func _Example() Local $sServer = 'ftp.csx.cam.ac.uk' ; UNIVERSITY OF CAMBRIDGE ANONYMOUS FTP SERVER Local $sUsername = '' Local $sPass = '' Local $sPath ='/pub/README' Local $hFile, $sText Local $hOpen = _FTP_Open('MyFTP Control') Local $hConn = _FTP_Connect($hOpen, $sServer, $sUsername, $sPass) If @error Then MsgBox($MB_SYSTEMMODAL, '_FTP_Connect', 'ERROR=' & @error) Else $hFile=_FTP_FileOpen($hConn,$sPath) $sText=BinaryToString(_FTP_FileRead($hFile,9999)) ;aus Datei lesen und in Format wandeln _FTP_FileClose($hFile) MsgBox($MB_APPLMODAL, 'README: ',$sText) EndIf _FTP_Close($hConn) _FTP_Close($hOpen) EndFunc ;==>_Example and after testing change to your needs. Collins 1 Link to comment Share on other sites More sharing options...
Collins Posted August 22, 2018 Author Share Posted August 22, 2018 I tested it but it gives Error Code = -1 Link to comment Share on other sites More sharing options...
AutoBert Posted August 22, 2018 Share Posted August 22, 2018 (edited) You got this MsgBox: in my Example or in your adapted script? This error happens when connecting to server isn't possible, in my example only possible if: server is down or your firewall is blocking. othercase MsgBox appears. If in your script you have also to test: is user correct is password correct are all other parameter's for _ftp_connect correct. can you connect to ftp-server with a standar ftp-client? Edited August 22, 2018 by AutoBert Link to comment Share on other sites More sharing options...
Collins Posted August 23, 2018 Author Share Posted August 23, 2018 (edited) Thanks everyone. it worked perfectly. Edited August 23, 2018 by Collins script worked 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