Topic "Variable uses an Automation type not supported in VBScript"

Author Message
nyhack44
[View user's profile]

Joined: 2014-10-09
Posts: 2
Hi,

I am trying to use the VBScript ListDirectory example and I am getting an error:

Variable uses an Automation type not supported in VBScript
Line 31

Line 31 is :

WScript.Echo fileInfo.Name & " with size " & fileInfo.Length & _
", permissions " & fileInfo.FilePermissions & _
" and last modification at " & fileInfo.LastWriteTime


Can someone please tell me if I am doing something wrong? I use VB script in WSF files for getting and putting files all the time, and they work fine. For the life of me, I can't get list directory to work.

Thanks,

Mark

Code:

<job>                                                               
<reference object="WinSCP.Session"/>
<script language="VBScript">
 
Option Explicit
 
' Setup session options
Dim sessionOptions
Set sessionOptions = WScript.CreateObject("WinSCP.SessionOptions")
With sessionOptions
    .Protocol = Protocol_Sftp
    .HostName = <hostname>
    .UserName = <username>
    .Password = <password>
    .SshHostKeyFingerprint = <SSH Key>
End With
 
Dim session
Set session = WScript.CreateObject("WinSCP.Session")
 
' Connect
session.Open sessionOptions
 
Dim directoryInfo
Set directoryInfo = session.ListDirectory("/home/martin/public_html")
 
Dim fileInfo
For Each fileInfo In directoryInfo.Files
    WScript.Echo fileInfo.Name & " with size " & fileInfo.Length & _
        ", permissions " & fileInfo.FilePermissions & _
        " and last modification at " & fileInfo.LastWriteTime
Next
 
' Disconnect, clean up
session.Dispose
 
</script>
</job>
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Thanks for your report.

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

I'll send you a dev version for testing shortly to an address you have used to register on this forum.
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