'function to connect cute FTP
public function fnConnectCuteFTP(strHost,strUploadUserID,strUploadPwd)
 Dim Flag
 If Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").Exist Then
       Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").Close
    End If
 Systemutil.Run "C:\Program Files (x86)\Globalscape\CuteFTP\cuteftppro.exe"
 Wait (5)
 Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").Dialog("regexpwndclass:=#32770","regexpwndtitle:=Tip of the Day").WinButton("regexpwndclass:=Button","regexpwndtitle:=&Close").Click
 Wait(1)
 Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").WinEdit("regexpwndclass:=Edit","attached text:=Host:").Type trim(strHost)
 Wait(1)
 Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").WinEdit("nativeclass:=Edit","attached text:=Username:").Set trim(strUploadUserID)
 Wait(1)
 Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").WinEdit("nativeclass:=Edit","attached text:=Password:").Set trim(strUploadPwd)
 Wait(1)
 Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").WinToolbar("regexpwndclass:=ToolbarWindow32","regexpwndtitle:=Quick Connect").Press 1
 Wait (5)
 If Window("regexpwndclass:=#32770","regexpwndtitle:=File Transfer Log").Exist Then
       Window("regexpwndclass:=#32770","regexpwndtitle:=File Transfer Log").Close
       Call fnFailResult("CuteFTP Connection Failure ","Unable to connect to CuteFTP")
  Flag=False      
    Else
       Call fnDoneResult("CuteFTP Connection Sucessful ","CuteFTP connection is sucessful")
  Flag=True      
    End If
    fnConnectCuteFTP=Flag
End function
Public function fnDisconnectCuteFTP()
 If Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").Exist Then
       Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").Close
  Call fnDoneResult("CuteFTP DisConnection","CuteFTP Disconnected sucessful")      
    Else
  Call fnFailResult("CuteFTP is not launched","Unable to close as CuteFTP is not launched")   
    End If
End function
Public Function fnCuteFTPFileUpload(strFileSourcePath,strTestFileName)
 Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").WinEdit("regexpwndclass:=Edit","window id:=132").Set trim(strFileSourcePath)
 Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").WinEdit("regexpwndclass:=Edit","window id:=132").Type micReturn
 Count=Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").WinListView("regexpwndclass:=SysListView32","window id:=1200").GetItemsCount
 For i = 0 To Count
        FileName=Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").WinListView("regexpwndclass:=SysListView32","window id:=1200").GetItem(i)
        If FileName=trim(strTestFileName) Then
           Window("regexpwndtitle:=Globalscape","regexpwndclass:=Afx:").WinListView("regexpwndclass:=SysListView32","window id:=1200").Activate i
           Exit For
        End If
 Next
 Call fnDoneResult("CuteFTP Fileupload done","CuteFTP File upload sucessful")
End Function