Jump to content
Sign in to follow this  

_FTP_ProgressDownload showing always separate progress window.

Recommended Posts


When I upgraded from version to the latest I have the included functions _FTP_ProgressDownload and _FTP_ProgressUpload always showing a separate progress window, and not using the progress bar in the main gui.

This happens also with the example code from the Help :

#include <FTPEx.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <ProgressConstants.au3>

Global $g_sRemoteFile = "/pub/software/databases/rt/SRPMS/ucs-local-modperl-2.0.3-1.src.rpm"
Global $g_sLocalFile = @TempDir & "\temp.tmp"

Local $sServer = 'ftp.csx.cam.ac.uk'
Local $sUsername = ''
Local $sPass = ''

Local $hInternetSession = _FTP_Open('MyFTP Control')
; passive allows most protected FTPs to answer
Local $hFTPSession = _FTP_Connect($hInternetSession, $sServer, $sUsername, $sPass, 1)

Global $g_idProgressBarCtrl, $g_idBtn_Cancel


Func Example()
    ; create GUI
    GUICreate("My GUI download Progressbar", 220, 100, 100, 200)
    GUICtrlCreateLabel($g_sRemoteFile, 10, 10)
    $g_idProgressBarCtrl = GUICtrlCreateProgress(10, 40, 200, 20, $PBS_SMOOTH)
    GUICtrlSetColor(-1, 32250); not working with Windows XP Style
    $g_idBtn_Cancel = GUICtrlCreateButton("Cancel", 75, 70, 70, 20)

    Local $sFunctionToCall = "_UpdateGUIProgressBar"
    _FTP_ProgressDownload($hFTPSession, $g_sLocalFile, $g_sRemoteFile, $sFunctionToCall)
EndFunc   ;==>Example

Func _UpdateGUIProgressBar($iPercent)
    GUICtrlSetData($g_idProgressBarCtrl, $iPercent)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit -1 ; _FTP_DownloadProgress Aborts with -1, so you can exit your app afterwards
        Case $g_idBtn_Cancel
            Exit -2 ; Just Cancel, without special Return value
    Return 1 ; Otherwise continue Download
EndFunc   ;==>_UpdateGUIProgressBar

And   #include <FTPEx.au3>  is the latest (June 1 2014)

In my system the result is like this https://www.dropbox.com/s/kg9q7c4rzhmzrjk/errorFTPprogress.JPG?dl=0

Why ?

Share this post

Link to post
Share on other sites

The UDF was updated to use a new feature that makes it possible to pass a sort of pointer of the function and call that. See "Function Notes" under Function Reference in the helpfile for how that works.


The change in the UDF is in the changelog, but apparently the examples was not updates at the stable release (they are fixed in the beta).


Removed: Usage of Call() in _FTP_ProgressDownload(), _FTP_ProgressUpload() and _SQLite_Startup(). See documentation for changes to $hFunctionCall and $hPrintCallback parameters. THIS IS A SCRIPT BREAKING CHANGE.


To fix, change "_UpdateGUIProgressBar" to _UpdateGUIProgressBar (notice the lack of quotes!).

Share this post

Link to post
Share on other sites

Ok, received, my fault not reading that script breaking change.

Now corrected and it works as intended.

Thank you ! :bye:

Share this post

Link to post
Share on other sites

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
Sign in to follow this  

  • Similar Content

    • Raywando
      By Raywando
      This is my first post. So I’ve worked on a script for a while and I’m planning to publish it but the problem is that it connects to an FTP server at some point, and as you probably know FTP credentials are easily captured by a MITM attack or Wireshark (not sure if Wireshark does). So I thought if i can detect data capturing in the user’s network the script would stop. Any idea?.
      If there’s another workaround I’m happy to hear it. 
    • BrewManNH
      By BrewManNH
      I have created a UDF that will allow you to easily create a customizable GUI with either a standard progress bar or a marquee style progress bar. You can change the size and back ground color of the GUI, as well as the font, font size, and color of the text. The function doesn't require any parameters to operate, but the default text is very generic so you probably would want to set that at the very least.
    • Carm01
      By Carm01
      I am attempting to pull a list of the directory structure from a public FTP where no username or password is required i.e:
      Now I have looked all over the place and have failed find anything to accomplish, and if I found some, and the documentation is rather bleak for example;
      it does show something I am looking for, but there is no ftp.au3, and the usage and examples of what i want to do seems to elude me on this and it may not even apply to what I am trying to accomplish?
      I want to avoid using things with Internet explorer , and I have done some google searches. However nothing seems to help
      the documentation surrounding : _FTP_DirGetCurrent  references _FTP_Connect , and then references _FTP_Open , and regardless what I try I cannot get it to pull a list of directorys of files as a list.
      Any help is appreciated
    • Jemboy
      By Jemboy
      Ones(some times twice) a month I get an e-mail with zip file, which has price updates from a supplier.
      I have to upload the file to an FTP to get it processed.
      When uploading the file, it will get "timestamped" with the time and date at which time the file was uploaded.
      Normally this is fine, because I mostly upload the file the same day.
      Sometimes it may take 1 or 2 days before I can upload the file.
      For historical purpose, I would like to have the file timestamped with the original date.
      I have tried using:  _FTP_Command ( $hFTPSession, "MFCT YYYYMMDDHHMMSS path") 
      however this command does not work or change the timestamp as I expected.
      Does anyone now a way how I can change the timestamp of a FTP-file?
    • rm4453
      By rm4453
      I am currently writing a program that parses a massive table from a website, and need a way to add a progress bar while parsing.
      I am currently using the function _IETableWriteToArray($oObj, True) to parse the array. I need the progress bar to update as the table is parsed, not just at the end of the parsing.
      Any help at all would be very much appreciated!
      *EDIT --> The array I am left with after parsing is $array[0-50000][16]