Jump to content


Photo

Unable to connect using VBScript for either FTP or SFTP


  • Please log in to reply
14 replies to this topic

#1 Ajay

Ajay
  • Members
  • 9 posts

Posted 28 July 2008 - 03:32 PM

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

Edited by Ajay, 28 July 2008 - 03:37 PM.


#2 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 28 July 2008 - 04:18 PM

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

Regards,
Mat

#3 Ajay

Ajay
  • Members
  • 9 posts

Posted 28 July 2008 - 05:02 PM

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

Regards,
Mat

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.

Edited by mb, 11 April 2013 - 09:46 PM.


#4 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 28 July 2008 - 05:06 PM

Hello ..

For what purpose are you using the FTP Library?

Regards,
Mat

#5 Ajay

Ajay
  • Members
  • 9 posts

Posted 28 July 2008 - 05:12 PM

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

#6 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 28 July 2008 - 05:14 PM

Hello Ajay ..

How many users will be using this script?

Regards,
Mat

#7 Ajay

Ajay
  • Members
  • 9 posts

Posted 28 July 2008 - 05:17 PM

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

#8 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 28 July 2008 - 05:21 PM

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

#9 Ajay

Ajay
  • Members
  • 9 posts

Posted 28 July 2008 - 07:15 PM

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

#10 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 28 July 2008 - 07:27 PM

You can download the SDK from here:
http://www.smartftp....SDK-t13484.html

Regards,
Mat

#11 Ajay

Ajay
  • Members
  • 9 posts

Posted 28 July 2008 - 07:57 PM

You can download the SDK from here:
http://www.smartftp....SDK-t13484.html

Regards,
Mat



Thanks Much Mat !!

Regards
Ajay

#12 Ajay

Ajay
  • Members
  • 9 posts

Posted 31 July 2008 - 02:27 PM

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

#13 Ajay

Ajay
  • Members
  • 9 posts

Posted 31 July 2008 - 06:22 PM

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

#14 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 31 July 2008 - 06:56 PM

Hello Ajay ..

Yes that's the correct way.

Regards,
Mat

#15 Ajay

Ajay
  • Members
  • 9 posts

Posted 31 July 2008 - 07:03 PM

Hello Ajay ..

Yes that's the correct way.

Regards,
Mat



Thank You Much!!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users