Open Text Corporation Press Room | Careers | Investors  
Enterprise Content Management
News | Company | Open Text | Hummingbird Connectivity  
Home > Exceedusers > May2002 >  Sample FTP API script Print View   Contact Me   
Site Tools
My Notes
My Menu Add this page to My Menu
Enterprise Content Management

 

From: NDIAYE Pierre DvSI/SNPI DAU ( )
Date: Thu May 30 2002 - 03:14:05 EDT


Hi all, (excuse my english !)

I need your help :o))

I'm writting a code under "Hummingbird Basic Workbench" (on NT).
This script must connect to a server and run a KSH script (present on
the server). This script return the name of a file. And this file must
be transfered on the local PC (NT). And if it's possible, I would like
to open this file on the PC screen.

Can you show the commands to run KSH script on a UNIX server, to get
or transfer a file from the server to the local PC, to open this file ?

Thanks a lot !

If it can help you, a part of the beginning of my code has been pasted
at the end of this email.

Best regards,
Pierre.

---
Très Cordialement,
Regards,
---
Pierre Ndiaye
Direct Line: +33(0)1 55 88 28 32
mailto:




Development Business Unit/DvSI/SNPI DAU

************************************************ SOURCES *********

option explicit Global const ASCII_TRANSFER_TYPE = 0 Global const BINARY_TRANSFER_TYPE = 1 Global const AUTO_TRANSFER_TYPE = 2

Global const HCL_TRUE = 1 Global const MSGBOX_OK = 0 Global const MSGBOX_STOP = 16 Global const MSGBOX_WARNING = 48 Global const MSGBOX_INFORMATION = 64 Global const DLG_OK = -1

dim MODULE_NAME as string dim VERSION_STR as string dim MODULE_LOG as string

dim la?

sub main

dim FtpEngine As Object dim FtpSession As Object dim FtpSessions As Object

dim temp as string dim temp1 as string

MODULE_NAME = "Outil de Gestion des Licences" VERSION_STR = "1.0" MODULE_LOG = "U:\audit_license.log"

' Robust scripts should install an error handler. on error goto FtpInitError

' Must first initialize Ftp Engine Set FtpEngine = CreateObject ("HclFtp.Engine")

' Create collection of sessions on error goto FtpSessionsError Set FtpSessions = FtpEngine.Sessions

' Create FTP session on error goto FtpSessionError Set FtpSession = FtpSessions.NewSession

Begin Dialog GetFtpInfo 100, 100, 201, 188, "Licenses Managing Tool" OkButton 145, 166, 45, 15 CancelButton 11, 166, 45, 15 GroupBox 11, 20, 180, 90, "SERVER" Text 18, 36, 50, 10, "Host name" TextBox 73, 35, 100, 10, .HostName Text 18, 51, 50, 10, "IP address" TextBox 73, 49, 100, 10, .AdresseIP Text 18, 67, 50, 10, "User (root)" TextBox 73, 65, 100, 10, .UserName Text 18, 82, 50, 10, "Password" TextBox 73, 81, 100, 10, .Password Text 18, 97, 50, 10, "Home directory" TextBox 73, 95, 100, 10, .InitialDir GroupBox 11, 126, 180, 30, "CLIENT" Text 18, 137, 50, 10, "Local directory" TextBox 73, 137, 100, 10, .LocalDir Text 74, 4, 101, 10, "please, fill in the form entirely" End Dialog

dim FtpInfo as GetFtpInfo, Erreur as string dim rep$ , tbrep(500) as string, nbRep as integer dim repInit$, semaine as string, i as integer, FlagErr as integer dim RepCour as string, filtre as string, fic as string dim RepCourHost as string, message as string

On error goto LogErr open MODULE_LOG for append as #1

repInit = "U:\" FtpInfo.HostName = "nom de la machine" FtpInfo.AdresseIP = "198.243.117.225" FtpInfo.UserName= "root" FtpInfo.Password= "mot de passe" FtpInfo.InitialDir= "/pdu/audit_license" FtpInfo.LocalDir= repInit FlagErr = 0

SaisieInfo: if FlagErr > 0 then msgbox message, MSGBOX_STOP, MODULE_NAME FlagErr = 0 end if if dialog(FtpInfo) <> DLG_OK then exit sub end if

......

FtpSession.InitialHostDirectory = FtpInfo.InitialDir FtpSession.ServerName = FtpInfo.AdresseIP FtpSession.UserName = FtpInfo.UserName FtpSession.Password = FtpInfo.Password

FtpSession.ConnectToHost FtpSession.UserLogin

FtpSession.TransferType = BINARY_TRANSFER_TYPE

.....



This archive was generated by hypermail 2b29 : Fri May 31 2002 - 23:54:01 EDT