Complete VBScript Example - WeOnlyDo Discussion board

Complete VBScript Example (General questions)

by Troglite, Tuesday, February 15, 2005, 00:04 (7032 days ago)

I am a fairly experienced VB and VBScript developer who needs to meet a tight deadline. Do you have any sample scripts that demonstrate the following:
* PutFile method use
* Error Handling for Connect method
* Error Handling for PutFile method

The only reference to PutFile calls I've seen in the code samples are in the C++ code samples. That doesn't help me! :(

I know that this is a silly question. The bits and pieces are in the help file. I just think a complete code sample would make my development go much faster.

Thanks,

~Justin

Re: Complete VBScript Example

by Troglite, Tuesday, February 15, 2005, 00:15 (7032 days ago) @ Troglite

Just in case my existing code sample (VERY SIMPLE) is useful:

dim obj_sftp
set obj_sftp = CreateObject( WeOnlyDo.wodSFTPCom.1 )

with obj_sftp
.Hostname = cstr(g_DestinationServer)
.Login = cstr(g_DestUsername)
.Password = cstr(g_DestPassword)
.Blocking = cbool(true)
.Connect
.PutFile cstr( & CStr(g_local_sub_path)), CStr(PathToUploadedFile)
.Disconnect
end with

Assuming this code is correct... how do errors get passed back to me and how can I capture useful information about the error for logging and reporting purposes??

Re: Complete VBScript Example

by wodSupport, Tuesday, February 15, 2005, 00:18 (7032 days ago) @ Troglite

I think using regular 'on error...' you can catch activex errors. Can you try? You can try with invalid username and you'll see it immediately.

Re: Complete VBScript Example

by Troglite, Tuesday, February 15, 2005, 00:28 (7032 days ago) @ wodSupport

I think using regular 'on error...' you can catch activex errors. Can you try? You can try with invalid username and you'll see it immediately.

--Yes I will try. To be clear, are you saying that all errors will be raised as an error object in VBScript? Are you also saying that the error description property will be populated without any addition effort?

THANKS FOR THE QUICK RESPONSE!

Re: Complete VBScript Example

by wodSupport, Tuesday, February 15, 2005, 00:30 (7032 days ago) @ Troglite

Correct. There's also sftp.LastError property you may check if you wish, but Err object should contain it anyway.

Re: Complete VBScript Example

by wodSupport, Tuesday, February 15, 2005, 00:32 (7032 days ago) @ wodSupport

I suggest you also download wodFtpDLX (it does support SFTP too). It has nice VBS sample in Samples section that even uses Events. Perhaps that would be helpful?

Re: Complete VBScript Example

by Troglite, Tuesday, February 15, 2005, 00:41 (7032 days ago) @ wodSupport

Correct. There's also sftp.LastError property you may check if you wish, but Err object should contain it anyway.

--Excellent. The help file seeed to imply that I would have to convert hex do decimal and then run it against a case statement to get a meaningful description (yuck!).

FYI.. I am using your component to relay files uploaded to a server on a DMZ network segment to a server on a Private segment. I first used tried to use the shell object to run an .exe at the command prompt. I found that I was running out of GDI resoruces when I hit ~100 concurrent transfers. I am hoping your component will remove that limitation.

I will be testing my script under load tomorrow. If I can support 100 concurrent transfers, then I will be placing my order with you before the end of the week!

Thanks again!!