Re: wodSFTP --vbs --Retry the Connection (General questions)
Thank you for your help
I rewriting the code like this:
Option Explicit
Dim objFTP, n
Set objFTP = WScript.CreateObject( WeOnlyDo.wodSFTPCom.1 , wod_ )
WScript.echo Please edit this file and setup Login, Hostname and Password properties
n=0
while objFTP.state <> 3 and n < 2
n = n + 1
objFTP.hostname = xxx.xx.x.xxx
objFTP.login = login
objFTP.password = password
objFTP.connect
WScript.Echo objFTP.state: &objFTP.state
WScript.Echo objFTP.LastError: &objFTP.LastError
WScript.Echo objFTP.LastError <> 0: &cstr(objFTP.LastError <> 0)
WScript.Echo objFTP.ErrorText(objFTP.LastError): &objFTP.ErrorText(objFTP.LastError)
wend
WScript.Echo over
1.If the Password doesn't exist ,Execution result like this:
-------Execution result-----------
Please edit this file and setup Login, Hostname and Password properties
objFTP.state:1
objFTP.LastError:30015----->some times it is objFTP.LastError:0
bjFTP.LastError <> 0: True
objFTP.ErrorText(objFTP.LastError):Invalid username or password reported by server.
objFTP.state:1
objFTP.LastError:30015----->some times it is objFTP.LastError:0
bjFTP.LastError <> 0: True
objFTP.ErrorText(objFTP.LastError):Invalid username or password reported by server.
over
----------------------------------
2.If the Password exist ,Execution result like this:
-------Execution result-----------
Please edit this file and setup Login, Hostname and Password properties
objFTP.state:1
objFTP.LastError:0
objFTP.LastError <> 0:false
objFTP.ErrorText(objFTP.LastError):No error
over
----------------------------------
*** if set 'objFTP.blocking = true' ,It will stop by the first Error.
The problem is :
How can I get the 'Error Handling for Connect method' during the 'while.....wend'?
Could I use then 'objFTP.LastError <> 0' to judge the 'Connect' success or failure ?
Thanks
Openpc,
I think this is your choice. Since you are doing this inside VBS and in blocking mode, you could do something like this (pseudo code):
while sftp1.state != connected
sftp1.hostname = something
sftp1.login = something_attempt_1
sftp1.password = something_attempt_1
sftp1.blocking = true
sftp1.connect
wendabove loop will iterate until it connects. Now, it's your job to change Login and Password so they're taken from somewhere and populated each time differently. I don't think you should use events in VBS for this purpose.
Can you try something like that?
Kreso
Complete thread:
- wodSFTP --vbs --Retry the Connection - openpc, 2006-04-12, 09:39
- Re: wodSFTP --vbs --Retry the Connection - woddrazen, 2006-04-12, 10:15
- Re: wodSFTP --vbs --Retry the Connection - openpc, 2006-04-12, 11:16
- Re: wodSFTP --vbs --Retry the Connection - wodSupport, 2006-04-12, 16:09
- Re: wodSFTP --vbs --Retry the Connection - openpc, 2006-04-14, 04:13
- Re: wodSFTP --vbs --Retry the Connection - wodSupport, 2006-04-15, 00:09
- Re: wodSFTP --vbs --Retry the Connection - openpc, 2006-04-14, 04:13
- Re: wodSFTP --vbs --Retry the Connection - wodSupport, 2006-04-12, 16:09
- Re: wodSFTP --vbs --Retry the Connection - openpc, 2006-04-12, 11:16
- Re: wodSFTP --vbs --Retry the Connection - woddrazen, 2006-04-12, 10:15