Jump to content

FTP.au3


w0uter
 Share

Recommended Posts

This is a question for those very familiar with DLL calls...

I noticed this (even in FTP_EX):

; Function Name:    _FTPConnect()
; Description:    Connects to an FTP server.
; Parameter(s):  $l_InternetSession - The Long from _FTPOpen()
;                  $s_ServerName        - Server name/ip.
;                  $s_Username        - Username.
;                  $s_Password          - Password.
;                  $i_Passive           - Passive mode?.
;                  $i_ServerPort          - Server port ( 0 is default (21) )
;                  $l_Service           - I dont got a clue what this does.
...

According to MSDN, the Service flag is:

"Type of service to access. This parameter can be one of the following values."

INTERNET_SERVICE_FTP = FTP service.

INTERNET_SERVICE_GOPHER = Gopher service.

INTERNET_SERVICE_HTTP = HTTP service.

Since this is a FTP Connect function, wouldn't that parameter always be whatever value the INTERNET_SERVICE_FTP is supposed to be?

Two follow up questions from this:

1) The current code is defaulting to 1, is that correct?

2) Wouldn't it make sense to remove the parameter since it HAS TO BE a FTP service in this case?

Thanks.

Link to comment
Share on other sites

  • 1 month later...
  • Replies 283
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 4 weeks later...

it load only file name with zeros size, i.e., when i open the website it show that the files are uploaded but all of them have size = 0.

This should be becoz script itself or becoz the host?

Link to comment
Share on other sites

  • 1 month later...

Anyway to speed up the transfer? This is my test script just testing out the ftp functions.

All the commands work but it takes me about 2 minutes to grab a 6meg file.

I can live with that except the other file I need is 60meg's

I can launch any of my browsers and grab the same 6meg file in about 10 seconds, so it's not my connection.

Any ideas?

I am running Windows 7 maybe that's effecting this though I don't have any problems with any other scripts.

Maybe someone can try it on another OS?

Thanks,

Kenny

#include <FTP_Ex.au3>
#include <array.au3>

$FTPIdentifier = _FTPOpen("ftpupdate")
$FTPSession    = _FTPConnect($FTPIdentifier, "ftp.antivirus.com", "", "")

_FtpSetCurrentDir($FTPSession, "products/pattern/")
$Array = _FTPFilesListToArray($FTPSession, 2) ;download by comparing version numbers
_ArrayDisplay($Array)

_FtpSetCurrentDir($FTPSession, "spyware/ssapi/");"products/pattern/spyware/ssapi/")
$Array = _FTPFilesListToArray($FTPSession, 2) ;always download
_ArrayDisplay($Array)
FileChangeDir("D:\User Profile Folders\Desktop\AV Emergency Thumb Drive\Trend Micro No Install AV")
_FTPGetFile($FTPSession, "ssapiptn813.zip", "ssapiptn813.zip", "ssapiptn813.zip")

_FTPClose($FTPIdentifier)

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

Thanks, I'll give it a try this afternoon. >_<

-Kenny

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

Works perfectly, even runs almost twice as fast as my browsers >_

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

  • 4 weeks later...

Works perfectly, even runs almost twice as fast as my browsers :D

Having tried to integrate this UDF into my code I have to say that it is a glorious failure of programming in general. I've used countless UDF's off this forum with amazement and excitement at how well they work. Beyond that, I'm always extraordinarily impressed at how they work together to allow me to create extraordinary solutions for my company.

The FTP UDF that is posted here (and on numerous other topics with added features) has a brilliant absence of sophistication. When it works, my confidence level in it completing successfully is at a record low. But, more often than not, I'm jubilantly approached with a complete absence of feedback and a cataclysmic crash of the AutoIT script altogether.

I don't think I could program a FTP UDF with the level of sophistication that is needed. My core knowledge in engineering is not in Windows program development, which is why I'm using AutoIT to perform the tasks I need. My intention is not to discredit AutoIT or other UDF programmers at all. I feel responsible to give honest feedback on the complete and utter failure of this UDF to the AutoIT community. Its disappointing, frustrating, and leaves me for a lack of words when thinking at how poorly it performs the tasks it boasts.

I only hope the AuotIT community agrees and releases something with the elegance one would expect. I know I'll credit it as strongly as I've discredited this UDF.

Link to comment
Share on other sites

@MrHowDoesHeDoIt

In latest beta version of Autoit is included FTP UDF  as standard one. So try that one.

If you encounter some problems be concrete, maybe somebody can help you with your bad script or 

maybe you found some bug and developers will fix it.

Edited by Zedna
Link to comment
Share on other sites

@MrHowDoesHeDoIt

In latest beta version of Autoit is included FTP UDF  as standard one. So try that one.

If you encounter some problems be concrete, maybe somebody can help you with your bad script or 

maybe you found some bug and developers will fix it.

That's fair. I've posted my source code. The program works in 3 stages. The App, The Droid, and The LDE (Last Ditch-Effort...I know...I know). The LDE app just keeps the Droid running in case of a crash. The Droid watches time and performs actions based off certain times as well as makes sure the LDE is running (yes they watch each other...how cute). The App actually does all the work and thats the one with the FTP UDF included. If you run the app with the correct switch directly from a run box or the command line...it works great. If you run it using the Droid...it fails.

Initially the Droid included the service UDF and the LDE didn't exist. But I couldn't get the FTP thing to work at all when initiated from a service. I was able to get it work as described above from my PC...but now it doesn't work on other PCs. Very confusing.

; Script Function:
;   Can check for a CRI "authorized" USB drive and/or download files via FTP based off a "manifest" and "docket"
;   Program looks for 1 of 2 possible passed arguments (USB or DOWNLOAD)
;   This program is intended to be called from its sister program which runs as a service and looks for timed events

;Define Includes
#include <Process.au3>
#include <File.au3>
#include <Array.au3>
#include <FTP.au3>

;Define Global Variable Needed
$FTPserver = IniRead("Config.ini","FTP","Server","")
$FTPusername = IniRead("Config.ini","FTP","User","")
$FTPpass = IniRead("Config.ini","FTP","Password","")
Global $LinesInFile
Global $Manifest
Global $Docket
Global $DriveLetters[26]
Global $ErrorDuringDownload = 0

;Code
If FileGetSize("C:\DownloadIt.LOG") > 153600 Then ;Checks if Log File is bigger than 150 KB, if so, it deletes it
    FileDelete("C:\DownloadIt.LOG")
EndIf

If $cmdline[0] > 0 Then ;Check for passed arguments
    Switch $cmdline[1]
        Case "USB"
            _USBFinder(1)
        Case "DOWNLOAD"
            _CheckDocket()
    EndSwitch
EndIf

Func _CheckDocket() ;See if I'm someone who needs to download files from the manifest...
    If FileExists("C:\Downloading") Then
        RunWait(@ComSpec & " /c " & 'rmdir /s /q C:\Downloading')   ;Delete old downloading folder if left over somehow
    EndIf
    DirCreate("C:\Downloading")     ;Create a temp folder for downloads
    $FTPOpen = _FTPOpen('myFTPDownload')    ;Open an FTP session with the PC
    $FTPConn = _FTPConnect($FTPOpen, $FTPserver, $FTPusername, $FTPpass)    ;Connect to the FTP site
    $Ftpp = _FTPGetFile($FTPConn, '/fst/docket.txt', 'C:\Downloading\docket.txt')   ;Get the manifest of files needed
    $Ftpc = _FTPClose($FTPOpen)     ;Close the FTP session with the PC
    For $LinesInFile = 1 TO _FileCountLines("C:\Downloading\docket.txt") STEP 1     ;Loop through the docket line by line for PC name comparison
        $Docket = FileOpen("C:\Downloading\docket.txt",0)   ; Open the docket file for line reading
        If FileReadLine($Docket,$LinesInFile) = @ComputerName Then  ;If any line in the docket equals my PC name, delete myself, download manifest and exit loop
            FileClose($Docket)
            FileDelete("C:\Downloading\docket.txt")
            _DownloadManifest()
            ExitLoop
        ElseIf $LinesInFile = _FileCountLines("C:\Downloading\docket.txt") Then ;If I've ended and I haven't founds myself drop a log and delete myself and the downloading folder...we're done
            _FileWriteLog("C:\DownloadIt.LOG","I'm not on the docket...just ending")
            FileClose($Docket)
            RunWait(@ComSpec & " /c " & 'rmdir /s /q C:\Downloading')
            ;MsgBox(0,"Not Found","My PC Hasn't Been Found...Peace!")   ;Diagnostics
        Else
            FileClose($Docket)  ;If somehow if ended up here I at least want to close the file so it can be deleted through some other code...
        EndIf
    Next
    
EndFunc

Func _DownloadManifest()    ;Actually download files from the FTP based on the manifest that exists...
    $FTPOpen = _FTPOpen('myFTPDownload')    ;Open an FTP session with the PC
    $FTPConn = _FTPConnect($FTPOpen, $FTPserver, $FTPusername, $FTPpass)    ;Connect to the FTP site
    $Ftpp = _FTPGetFile($FTPConn, '/fst/manifest.txt', 'C:\Downloading\manifest.txt')   ;Get the manifest of files needed
    $Ftpc = _FTPClose($FTPOpen)     ;Close the FTP session with the PC
    Sleep(500)      ;Sleep, for good measure
    For $LinesInFile = 1 TO _FileCountLines("C:\Downloading\manifest.txt") STEP 1       ;Loop through the manifest line by line for file downloading
        $FTPOpen = _FTPOpen('myFTPDownload')    
        $FTPConn = _FTPConnect($FTPOpen, $FTPserver, $FTPusername, $FTPpass)
        $Manifest = FileOpen("C:\Downloading\manifest.txt",0)   ; Open the manifest file for line reading
        DIM $FileNameString = FileReadLine($Manifest,$LinesInFile)  ;Read the line active for this time through the loop
        DIM $FolderNameString
        $FileNameString = StringTrimLeft($FileNameString,StringinStr($FileNameString,"/",0,1,3))    ;Trim off the beginning of the folder structure, in this case, "/fst/"...I go 3 characters in to skip the very 1st "/"
        $FileNameString = StringReplace($FileNameString,"/","\")    ;Replace all the "/" for "\"...stupid Windows vs Linux BS
        $FolderNameString = StringTrimRight($FileNameString,StringLen($FileNameString) - StringInStr($FileNameString,"\",0,-1)) ;Use line above and trim off the filename so I know what folder structure needs to be kept
        ;MsgBox(0,"Title","FileName is:"&$FileNameString)       ;Diagnostics
        ;MsgBox(0,"Title","FolderName is:"&$FolderNameString)   ;Diagnostics
        DirCreate("C:\Downloading\" & $FolderNameString)    ;Create the folder structure from each line read
        ;$Ftpp = _FTPGetFile($FTPConn, FileReadLine($Manifest,$LinesInFile), 'C:\Downloading\' & $FileNameString)   ;If I wanted to transfer things without progress meter
        $Ftpp = _FTP_DownloadProgress($FTPConn, 'C:\Downloading\' & $FileNameString, FileReadLine($Manifest,$LinesInFile), "")  ;If I wanted to transfer things WITH a progress meter
        $Ftpc = _FTPClose($FTPOpen)
        FileClose($Manifest)    ;Close manifest file
    Next
    If FileGetSize("C:\Downloading\manifest.txt") > 0 Then  ;If the manifest actually has size, meaning it downloaded, then do something
        ;Do nothing, I'm good to go
    Else
        $ErrorDuringDownload = $ErrorDuringDownload + 2 ;The manifest is poorly sized and we have yet another error, so add it to any other errors I have
        _FileWriteLog("C:\DownloadIt.LOG","Download of Files Failed!") ;Drop log of failure
        Exit($ErrorDuringDownload) ;Exit program with any possible errors
    EndIf
    _FileWriteLog("C:\DownloadIt.LOG","Download of Files Complete!") ;Drop log of success
If _USBFinder(2) = 0 Then   ;Lets go and find the USB drive that needs to house the offline update files that should have downloaded
    $Directory = FileOpen("C:\USBDriveAt.txt",0)    ;Read where the drive was found
    DirMove("C:\Downloading\OfflineUpdateImage",FileReadLine($Directory,1) & "OfflineUpdateImage")  ;Move OfflineUpdateImage folder over
    FileClose($Directory)   ;Close pointer file for deletion
    FileDelete("C:\USBDriveAt.txt") ;Delete the damn thing
    _FileWriteLog("C:\DownloadIt.LOG","Copy to USB Complete!") ;Drop log of success
EndIf
If _ExternalCommandsSent() = 0 Then ;Lets go and find out if there are external commands sent and process them accordingly
    _FileWriteLog("C:\DownloadIt.LOG","Run of External Commands Complete!") ;Drop log of success
ElseIF _ExternalCommandsSent() = 1 Then
    RunWait(@ComSpec & " /c " & 'rmdir /s /q C:\Downloading')   ;Delete downloading folder as there are no external commands to be processed
EndIf
Exit($ErrorDuringDownload) ;Exit program with any possible errors
EndFunc

Func _USBFinder(Const $y)   ;Attempts to find a USB drive that has been "prepared" by CRI and is inserted in the PC
    $DriveLetters[0]    =   "A:\"   ;List of every drive label in the alphabet
    $DriveLetters[1]    =   "B:\"
    $DriveLetters[2]    =   "C:\"
    $DriveLetters[3]    =   "D:\"
    $DriveLetters[4]    =   "E:\"
    $DriveLetters[5]    =   "F:\"
    $DriveLetters[6]    =   "G:\"
    $DriveLetters[7]    =   "H:\"
    $DriveLetters[8]    =   "I:\"
    $DriveLetters[9]    =   "J:\"
    $DriveLetters[10]   =   "K:\"
    $DriveLetters[11]   =   "L:\"
    $DriveLetters[12]   =   "M:\"
    $DriveLetters[13]   =   "N:\"
    $DriveLetters[14]   =   "O:\"
    $DriveLetters[15]   =   "P:\"
    $DriveLetters[16]   =   "Q:\"
    $DriveLetters[17]   =   "R:\"
    $DriveLetters[18]   =   "S:\"
    $DriveLetters[19]   =   "T:\"
    $DriveLetters[20]   =   "U:\"
    $DriveLetters[21]   =   "V:\"
    $DriveLetters[22]   =   "W:\"
    $DriveLetters[23]   =   "X:\"
    $DriveLetters[24]   =   "Y:\"
    $DriveLetters[25]   =   "Z:\"
    For $DriveLetterSearch = 0 TO 25 Step 1 ;Loops through every possible drive letter
        If FileExists($DriveLetters[$DriveLetterSearch] & "USBDrive.txt") Then  ;If the drive letter has the USBDrive.txt file, then lets get ready for copying to it
            If $y = 1 Then  ;If called to check USB only...drop a log and be out
                _FileWriteLog("C:\DownloadIt.LOG","USB Drive FOUND!") ;Drop log of success
                Return 0
            ElseIf $y = 2 Then  ;If called from within the manifest, proceed with additional codeset
                RunWait(@ComSpec & " /c " & 'rmdir /s /q ' & $DriveLetters[$DriveLetterSearch]) ;Clean off the drive totally
                _FileWriteLog($DriveLetters[$DriveLetterSearch] & "USBDrive.txt","Drive Wiped") ;Re-write the USBDrive.txt file and stamp it with some information for diagnostics
                $USBDriveAt = FileOpen("C:\USBDriveAt.txt",2)   ;Create a pointer file for what drive letter should be used to copy to
                FileWrite($USBDriveAt,$DriveLetters[$DriveLetterSearch])
                FileClose($USBDriveAt)
                Return 0    ;Return a value to the originally calling code letting them know we've succeeded in finding the USB drive
                ExitLoop
            EndIf
        ElseIf $DriveLetterSearch = 25 Then ;If we ran through the entire alphabet of drive letters and nothing is found
            _FileWriteLog("C:\DownloadIt.LOG","Can't find a USB drive...just ending")   ;Drop log for diagnostics
            $ErrorDuringDownload = $ErrorDuringDownload + 3 ;Keeping track of errors during downloads...we'll add them together later to create a final error code
            If $y = 1 Then  ;If called to check USB only and we've failed, exit program with error code so I can track it
                Exit(1)
            EndIf
            Return 1
        EndIf
    Next
EndFunc

Func _ExternalCommandsSent()    ;Find external commands if downloaded
    If FileExists("C:\Downloading\commands.exe") Then   ;If commands.exe found then run it
        Run("C:\Downloading\commands.exe")
        Return 0    ;Reutrn a value to the oiginally calling code letting them know we've succeeded in finding external commands that need processing, and have processed them
    ElseIf FileExists("C:\Downloading\commands.bat") Then   ;If commands.bat found then run it (we chose to look for a BAT 2nd to an EXE)
        Run("C:\Downloading\commands.bat")
        Return 0    ;Reutrn a value to the oiginally calling code letting them know we've succeeded in finding external commands that need processing, and have processed them
    Else
        Return 1    ;Reutrn a value to the oiginally calling code letting them know we've failed to find external commands that need processing
    EndIf
EndFunc

; Finished!

;
; Script Function:
;   Checks times in a config file and triggers outside events to occur
;   Program runs as a driod, which has a child process as a last-ditch effort to recover
;   This program is intended to be calling its sister program which looks for passed arguments

;Define Includes
#NoTrayIcon
#include <Process.au3>
#include <File.au3>
#include <smtp.au3>

;Define Global Variable Needed
Global $PulledTime
Global $PulledDayofWeek
Global $JustRan[10]     ;Hard coded to store up to 10 different "Justrans" or what would be used to stop triggered events from happening too quickly
Global $TimerJustRan[10]
Global $ErrorFromSisterApp = 0
$SmtpServer = "127.0.0.1"; address for the smtp-server to use - REQUIRED
$FromName = ""                  
$Body = ""                       
$AttachFiles = ""  
$CcAddress = ""       
$BccAddress = ""     
$Importance = "Normal" ;"High", "Normal", "Low"
$Username = ""     
$Password = ""                 
$IPPort = 25                            
$ssl = 0   


while 1     
    $PulledDayofWeek = @WDAY    ;Store current day of week 1 = Sun, 7 = Sat
    $PulledTime = (@Hour & ":" & @Min)  ;Store current hour and minute
    $FromAddress = IniRead(@ScriptDir & "\Config.ini","Email","EmailFrom","Default@email.com") 
    $ToAddress = IniRead(@ScriptDir & "\Config.ini","Email","EmailRecipients","Default@email.com")
    $Subject = IniRead(@ScriptDir & "\Config.ini","Email","Subject","Subject Line")
    For $z = 0 TO 9 STEP 1  ;Loop through all possible "JustRans" and see if they can be lifted
        If $JustRan[$z] = 1 AND TimerDiff($TimerJustRan[$z]) > 60000 Then
        $JustRan[$z] = 0
        EndIf
    Next
    If NOT ProcessExists ("DownloadItLDE.exe") Then ;Checking to make sure the last-ditch effort (LDE) applet is running, if not, starts it again
        Run("DownloadItLDE.exe")
    EndIf
    If FileExists("C:\Downloaditstop.txt") Then ;If this file exists all droids will stop running
        FileDelete("C:\Downloaditstop.txt")
        ProcessClose("DownloadItLDE.exe")
        ProcessClose("DownloadItDroid.exe")
    EndIf
    If $PulledDayofWeek = IniRead(@ScriptDir & "\Config.ini","Times","USBDOW","6") Then ;If stored day of the week is the same that is in the Config.ini
        If $PulledTime = IniRead(@ScriptDir & "\Config.ini","Times","USBTime","04:30") AND $JustRan[1] = 0 Then ;If the stored time is the same minute and hour that is in the Config.ini
                $JustRan[1] = 1     ;Enforce "JustRan" so this doesn't happen again within a minute of running (in this line we "sucked up" JustRan 1, so next time we will hard code the next one up...)
                $q = RunWait(@ScriptDir & "\DownloadIt.exe USB")    ;Run DownloadIt App with the correct argument passed to it
                If $q = 1 Then
                    If IniRead(@ScriptDir & "\Config.ini","Email","AlertsToggle","0") = 1 Then
                        Run("localsrv.exe")
                        ProcessWait("localsrv.exe")
                        $Body = "USB Drive on TN " & @ComputerName & " was not replaced.  Please alert tech to return to site and replace USB drive."
                        $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
                        ProcessClose("localsrv.exe")
                    EndIf
                    ;Msgbox(0, "Title", "Would have been an error emailed off for USB")
                EndIf
                $TimerJustRan[1] = TimerInit () ;Used to track "JustRan" time, matches the instant of JustRan (e.g. 1)
        EndIf
    EndIf
    If $PulledDayofWeek = IniRead(@ScriptDir & "\Config.ini","Times","DownloadDOW","5") Then
        If $PulledTime = IniRead(@ScriptDir & "\Config.ini","Times","DownloadTime","05:30") AND $JustRan[2] = 0 Then
        $JustRan[2] = 1
        $q = RunWait(@ScriptDir & "\DownloadIt.exe DOWNLOAD")
            If $q > 0 Then
                $ErrorFromSisterApp = $q
                If IniRead(@ScriptDir & "\Config.ini","Email","AlertsToggle","0") = 1 Then
                        Run("localsrv.exe")
                        ProcessWait("localsrv.exe")
                        Switch $ErrorFromSisterApp
                        Case 2
                            $Body = "Offline Update Download on TN " & @ComputerName & " was not completed properly.  Please stop tech from arriving onsite.  Error Code: "& $ErrorFromSisterApp & " Found."
                        Case 3
                            $Body = "Offline Update Download on TN " & @ComputerName & " was not completed properly.  Tech will need a USB drive and additional time onsite.  Error Code: "& $ErrorFromSisterApp & " Found."
                        Case 5
                            $Body = "Offline Update Download on TN " & @ComputerName & " was not completed properly.  Please stop tech from arriving onsite, unknown crash of system occured.  Error Code: "& $ErrorFromSisterApp & " Found."
                        EndSwitch
                        $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
                        ProcessClose("localsrv.exe")
                    EndIf
                ;Msgbox(0, "Title", "Would have been email for download" & $ErrorFromSisterApp)
            EndIf
            $TimerJustRan[2] = TimerInit ()
        EndIf
    EndIf
Sleep(IniRead(@ScriptDir & "\Config.ini","Times","DroidLoop","5000"))
WEnd

; END

; Script Function:
;   Program runs as a driod, which is a child process of its droid parent
;   This program's sole purpose is to be the last line of defense against DownLoadIt Droid crashing and not starting back up
;   

;Define Includes
#NoTrayIcon
#include <Process.au3>
#include <File.au3>

;Define Global Variable Needed

while 1     
    If NOT ProcessExists ("DownloadItDroid.exe") Then   ;Checking to make sure the droid applet is running, if not, starts it again
        Run("DownloadItDroid.exe")
        _FileWriteLog("C:\DownloadIt.LOG","LDE initiated!")
    EndIf
Sleep(IniRead(@ScriptDir & "\Config.ini","Times","LDELoop","5000"))
WEnd

; END
Link to comment
Share on other sites

  • 1 month later...

I spent several days to find this in the search, and it was stickied. I do not feel to bright.

Give me mailing directions and I would mail you a cookie. You deserve one

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
  • 4 weeks later...

I have a strange problem with FTP_Ex.au3. The compiled script doesn't work, but the script runned in the editor.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=ftp.exe
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <String.au3>
#include <FTP_Ex.au3>
$title = "Titel"
$file = "ftp.txt"
Global $serv = "xxx"
Global $user = "xxx"
Global $pass = "xxx"
Global $ftp = _FTPOpen("ftp")
Global $FTPServer = _FTPConnect($ftp, $serv, $user, $pass, 1)
$ftpfile = _FTPOpenFile($FTPServer, "file")
If @error Then
    MsgBox(0, "", "1" & @error)
EndIf
$ftpfileread = _FTPReadFile($ftpfile, 256)
If @error Then
    MsgBox(0, "", "2" & @error)
EndIf
$ftpfileread = BinaryToString($ftpfileread)
If @error Then
    MsgBox(0, "", "3" & @error)
EndIf
_FTPCloseFile($ftpfile)
MsgBox(0, $title, $ftpfileread & @error)
_FTPClose($FTPServer)
_FTPClose($ftp)

Link to comment
Share on other sites

I have a strange problem with FTP_Ex.au3. The compiled script doesn't work, but the script runned in the editor.

#AutoIt3Wrapper_Outfile=ftp.exe

Try to use different output EXE name. ftp.exe is the existing system file: 

C:\WINDOWS\system32\ftp.exe 

So you may have conflict with it.

Edited by Zedna
Link to comment
Share on other sites

  • 4 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...