Unable to connect using VBScript for either FTP or SFTP

Hi,
We recently purchased licenses of SmartFTP Pro here at Hoffman Enclosures Inc. Prior to purchasing the licenses, we evaluated the software by running a VBScript using SmartFTP and FTPLibrary to do SFTP/FTP. However this script does not work after we installed SmartFTP Pro. It is unable to connect to the server. We are able to connect to the server using the SmartFTP Pro client so the user name/password and server IP are all correct.

We traced the FTP Process flow, the script gets invoked, and has all the passed in arguments but the return code of obj.connect() is 17 and then the script fails indicating its unable to connect to the FTP server. This happens for both FTP and SFTP. Please help us resolve this issue as it is stopping a scheduled PRODUCTION rollout.

I even ran the sample script "Simple.vbs" and even here the return code is 17. I also emailed support@smartftp.com on 07/25/08 with a copy of the VB Script that we are using.

Thanks
Ajay

Did you purchase a license for the FTP Library and did you load it with the LoadLicenseKeyData method?

Regards,
Mat

<blockquote class="ipsBlockquote" data-author="mb" data-cid="49314" data-date="Jul 28 2008, 11:18 AM">Did you purchase a license for the FTP Library and did you load it with the LoadLicenseKeyData method?
Regards,
Mat</blockquote>Hi Mat,
Luanne who made the purchase is out of the office. I will confirm with her tomorrow. I believe we purchased 25 licenses of Smart FTP Pro because the professional version included FTP Library and that way we did not have to buy a developer license of FTP Library.
Regarding LoadLicenseKeyData method - I need a little assistance here as I am not familiar with VB Script. I pass in arguments and accordingly create a connection object either for FTP or SFTP. None of these objects support the LoadLicenseKeyData method. So I create a global object that supports the LoadLicenseKeyFile method. I got the latest license.xml file from the web and I used that with the LoadLicenseKeyFile method, however the method is returning FALSE so I have not been successful in doing that. Please advise
We have two license keys - one with 15 licenses and another with 10 licenses. So I'd prefer using the LoadLicenseKeyFile method than the LoadLicenseKeyData method so that I can maintain one version of the VBScript file.

Hello ..

For what purpose are you using the FTP Library?

Regards,
Mat

Hello ..

For what purpose are you using the FTP Library?

Regards,
Mat

Hi Mat,
We are using the FTP Library to transfer documents via SFTP/FTP silently. To do this, we created a VB Script based off the sample scripts for file upload. This script was working fine during our evaluation obviously because it was using the trial license which has since expired. We run the VBScript using cscript and pass a bunch of arguments that tell the script to do either FTP or SFTP with all login details. This way the user only sees a cmd window pop up for a couple of seconds and then close automatically rather than use a FTP client.


Thanks
Ajay

Hello Ajay ..

How many users will be using this script?

Regards,
Mat

Hello Ajay ..

How many users will be using this script?

Regards,
Mat

Hi Mat,
I think a maximum of 10 - 12 users will use this. Its a very limited set of users who have access to modify and upload documents to our FTP servers. The number might even be smaller, if you'd like I can get you an exact count but am sure it will not exceed what I just mentioned.

Regards
Ajay

Hello ..

Thanks. So to use the FTP Library through the Pro version of SmartFTP you have to create the objects through the SmartFTP application object. To do this use the sample code in the SDK\Samples\Script folder. Here is the code you are probably interested in:

Dim objSmartFTP

' get existing

' Reference: http://www.microsoft.com/technet/scriptcenter/guide/sas_vbs_ekqn.mspx?mfr=true

' http://www.mail-archive.com/vbscript@p2p.wrox.com/msg00127.html			

On Error Resume Next

Set objSmartFTP = GetObject(,"SmartFTP.Application")

On Error Goto 0



If TypeName(objSmartFTP) <> "Application" Then

   Set objSmartFTP = WScript.CreateObject("SmartFTP.Application")

End If



objSmartFTP.Visible = true



Dim objGlobal 

Set objGlobal = objSmartFTP.CreateObject("sfFTPLib.Global")



Dim objFTPConnection

Set objFTPConnection = objSmartFTP.CreateObject("sfFTPLib.FTPConnectionSTA")

As you can see you don't need to load the license key for the ftp library because you don't have/need one.

Regards,
Mat

Hi Mat,
It worked. Thanks much!!

However I was unable to locate the sample code. I do not have a SDK folder on my machine for SmartFTP. Would it be possible to email these sample scripts to me...

Thanks
Ajay

You can download the SDK from here:
https://www.smartftp.com/forums/SmartFTP ... 13484.html

Regards,
Mat

Hi Mat,
When we create the SmartFTP Application object in the VB Script and then use that to create either a SFTP or FTP object, it opens up the SmartFTP client. I found a temporary work around by calling the Exit() method to close the client once the file transfer is done. However, it'll be great if we could do this in a slient mode where the SmartFTP client does not open up at all. Is there any way I can do this?

Thanks
Ajay

Hi Mat,
When we create the SmartFTP Application object in the VB Script and then use that to create either a SFTP or FTP object, it opens up the SmartFTP client. I found a temporary work around by calling the Exit() method to close the client once the file transfer is done. However, it'll be great if we could do this in a slient mode where the SmartFTP client does not open up at all. Is there any way I can do this?

Thanks
Ajay


Hi Mat,
In response to my earlier post, I set the application.visible = false and the client stopped opening up and file transfer was successful. Could you please confirm if I did the right thing.


Thanks Much!!
Ajay

Hello Ajay ..

Yes that's the correct way.

Regards,
Mat

Hello Ajay ..

Yes that's the correct way.

Regards,
Mat


Thank You Much!!