Пытаюсь написать FTP клиент на VBS, использую Catalyst SocketCtrl. В примерах дан вполне действующий кусок кода,
Возможно ли его заствить работать в VBS:
Function FtpGetResult(strResult As String) As Integer
Dim strBuffer As String
Dim cchBuffer As Integer
Dim strLine As String
Dim nPos As Integer
Dim nResult As Integer
Dim bContinue As Integer
FtpGetResult = 0
strResult = ""
bContinue = True
Do While bContinue = True
cchBuffer = formMain.sockCmd.Read(strBuffer, 512)
If cchBuffer < 1 Then
formMain.sockCmd.Action = SOCKET_DISCONNECT
Exit Function
End If
Do
nPos = InStr(strBuffer, vbCrLf)
If nPos > 0 Then
strLine = strLine + Left(strBuffer, nPos - 1)
cchBuffer = cchBuffer - (nPos + 1)
strBuffer = Right(strBuffer, cchBuffer)
nResult = Val(Left(strLine, 3))
If Mid(strLine, 4, 1) <> "-" Then
bContinue = False
End If
If Len(strResult) > 0 Then strResult = strResult + " "
strResult = strResult + Right(strLine, Len(strLine) - 4)
strLine = ""
Else
strLine = strLine + strBuffer
Exit Do
End If
Loop
DoEvents
Loop
FtpGetResult = nResult
End Function