Sign in to follow this  
Followers 0
LibrarianMark

FTP Upload progress bar broken?

4 posts in this topic

#1 ·  Posted (edited)

Folks - I am using _FTP_ProgressUpload to upload a file and present a progress bar. The code I am using worked fine until I updated to the newest verson of AutoIT. My code looks like this:

Func send_print_job($archive_file, $print_job_ID)
    $server = RegRead("HKLM64\Software\willard\pcs","server_ip")
    $user = RegRead("HKLM64\Software\willard\pcs","user")
    $pass = RegRead("HKLM64\Software\willard\pcs","pass")
    $remote_path = RegRead("HKLM64\Software\willard\pcs","remote_path")
    $remote_file = $remote_path & "/" & $print_job_ID & ".tar"
    $hInternetSession = _FTP_Open('pcs_server')
    $hFTPSession = _FTP_Connect($hInternetSession, $server, $user, $pass,1)
    GUICtrlSetState($progress_bar , $GUI_SHOW)
    $result = _FTP_ProgressUpload($hFTPSession, $archive_file, $remote_file, "_UpdateProgress")
    _FTP_Close($hInternetSession )
EndFunc   ;==>send_print_job

Func _UpdateProgress($iPercent)
    GUICtrlSetData($progress_bar, $iPercent)
    Return 1 ; Continue upload
EndFunc   ;==>_UpdateProgress

Now when the files upload, the usual progress bar on my form ($progress_bar) does not update, and there is a little popup window on top of my form that does have a progress bar along with the name of the file that is being uploaded. The files do upload succesfully, but it was a lot cleaner before.

Like I said, this worked as it should for the older version of AutoIT that I was using. What would have changed?

Edited by LibrarianMark

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

So I just tried to run the example in the help file and it does the same thing - the GUI that is created is visible, but another form pops up with a progress bar. Sounds like a bug to me.

Edit: I just installed Version 3.3.6.0 and the progress bar works correctly, so there is some sort of bug with the lastest version.

Edit#2: 3.3.11.6-beta works correctly, too. Wierd.

Edited by LibrarianMark

Share this post


Link to post
Share on other sites

Here is a screen shot of what I am talking about.

post-59400-0-01893000-1403808487_thumb.p

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Greetings:

Looking for the same problem, I find the problem is the passing parameter $hFunctionToCall, thus in the example and in your problem is passed as a string, while it has to be passed as class object

;Replace
$result = _FTP_ProgressUpload($hFTPSession, $archive_file, $remote_file, "_UpdateProgress")
;With
$result = _FTP_ProgressUpload($hFTPSession, $archive_file, $remote_file, _UpdateProgress)

WHY

if you check the include <FTPEx.au3>, the _FTP_ProgressUpload has the function IsFunc to discriminate the use of a progress bar as the value of $hFunctionToCall is a string the result of IsFunc is 0 and the progress bar appears,

Regards

Edited by Alenis

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  
Followers 0