Topic "Progress indicator within a script?"

Author Message
Fox
[View user's profile]

Joined: 2013-02-22
Posts: 2
When I run the winscp.com and do open mysession and then get file.ext I get a nice indicator for the download process, but when I do the same within a script it just stands there blinking until it's done and then it prints all that happened.

Is there a way to get it to show a more "live" progress within a script?

My script is in JS if that matters.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
WinSCP does not print progress to redirected output.
With upcoming 5.2 you can use WinSCP .NET assembly from your JS and handle Session.FileTransferProgress event.
Fox
[View user's profile]

Joined: 2013-02-22
Posts: 2
Ok thanks! I'll try that once it's out then.

Right now I went around the problem by creating a batch file that start WinSCP.exe with all the parameters I need and run that from within the script instead of directly running the command. Not as pretty but it works. Smile
aerze
[View user's profile]

Joined: 2014-02-20
Posts: 1
Location: San Diego
prikryl wrote:
WinSCP does not print progress to redirected output.
With upcoming 5.2 you can use WinSCP .NET assembly from your JS and handle Session.FileTransferProgress event.


The Session.FileTransferProgress Event won't fire.
Code:

var zvSession = WScript.CreateObject('WinSCP.Session','sessionEvent_');
// This event won't fire
function sessionEvent_FileTransferProgress(sender, args) {
    WScript.echo('start');
}

// Although this one does
function sessionEvent_FileTransferred(sender, args) {
    WScript.echo(args.FileName);
    WScript.echo('end');
}


Am I implementing this wrong? I'm having a hard time finding any JScript examples.

BTW If you don't mind, I could JScript examples for the site.
This tool has been super useful so far.
jbratten
[View user's profile]

Joined: 2014-02-25
Posts: 2
I too find that FileTransferred fires after each file, but FileTransferProgress does not fire at all.
WinSCP Ver. 5.5.1 Build 3970
WinSCPNet Ver. 5.5.1 (at least that's what the zip file is named)
Windows XP and 7
VBA in Access 2003/2007 and Excel 2007

The file transfer occurs and completes without any errors or problems. Just no progress updates.

Code:
'// Instantiate Class

Sub testEDI()

    Dim objEDI As New OfficeEDI

    objEDI.doXfer

End Sub


'// Class OfficeEDI

Option Compare Database

Private WithEvents objSession As WinSCPnet.Session

Public Sub doXfer()

    Dim objOptions As New WinSCPnet.SessionOptions

    Set objSession = New WinSCPnet.Session

    objOptions.Protocol = Protocol_Sftp
    objOptions.Portnumber = 30
    objOptions.hostname = "@xxx.xxx.xxx.xxx"
    objOptions.UserName = "test"
    objOptions.Password = "xxxxxxxx"
    objOptions.SshHostKeyFingerprint = "ssh-dss 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"

    objSession.Open objOptions

    If objSession.opened Then
        Debug.Print "Session Opened"
   objSession.putfiles "F:\FileName*", "//Test//*", False
    End If

    objSession.dispose

    Set objOptions = Nothing
    Set objSession = Nothing

End Sub

Private Sub objSession_FileTransferProgress(ByVal sender As Object, ByVal e As FileTransferProgressEventArgs)

    Debug.Print Format(e.overallprogress, "Percent")

End Sub

Private Sub objSession_FileTransferred(ByVal sender, ByVal e As TransferEventArgs)

    Debug.Print e.FileName & " To " & e.destination

End Sub


Thanks
BoringPortlander

Guest


I am trying to figure this out as well. I want to add a simple dialog bog with a progress bar while I run a Syncronization with the newest WinSCPNet.dll libs

Any help would be appreciated
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Thanks for your reports.

This bug has been added to the tracker:
http://winscp.net/tracker/show_bug.cgi?id=1134

I'll send dev version with fix for testing to registered reporters.
jbratten
[View user's profile]

Joined: 2014-02-25
Posts: 2
The development version fixed the issue for me in VBA (Access, etc).

Thank you for the prompt response and fix.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
jbratten wrote:
The development version fixed the issue for me in VBA (Access, etc).

Thank you for the prompt response and fix.

Thanks for your feedback.
_________________
Martin Prikryl
xscraper

Guest


prikryl wrote:
Thanks for your reports.

This bug has been added to the tracker:
http://winscp.net/tracker/show_bug.cgi?id=1134

I'll send dev version with fix for testing to registered reporters.


I just got the WinSCP .Net library from Nuget and I used it in my code. I also do not see FileTransferProgress event in the Session class. How do I get the latest build where the bug is fixed? Thanks a lot.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
xscraper wrote:
I just got the WinSCP .Net library from Nuget and I used it in my code. I also do not see FileTransferProgress event in the Session class. How do I get the latest build where the bug is fixed? Thanks a lot.

What NuGet package? Anyway, no NuGet package is maintained by WinSCP team. They are all outdated. You should download the .NET assembly from this site.
But, WinSCP 5.5.2 will be released today and as part of that we are taking over "WinSCP" NuGet package and will be keeping it up to date.
http://www.nuget.org/packages/WinSCP/
http://winscp.net/tracker/show_bug.cgi?id=1145
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License