Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Variable uses an Automation type not supported in VBScript

Thanks for your report.

This issue has been added to the tracker:
https://winscp.net/tracker/1231

I'll send you a dev version for testing shortly to an address you have used to register on this forum.
nyhack44

Variable uses an Automation type not supported in VBScript

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

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