home *** CD-ROM | disk | FTP | other *** search
- '=======================================================================
- '= File: tests.vbs
- '= Notes:
- '= script to display use of many TE object methods and properties.
- '=======================================================================
-
- Sub Test()
- 'Create standard Scripting Host Shell object
- Set Shell = CreateObject("WScript.Shell")
-
- 'Get name of of the user's desktop folder by invoking
- 'a VB function, then assign it as the localfolder
- strDesktop = Shell.SpecialFolders("Desktop")
-
- ' line break
- strNL = (Chr(13) & Chr(10))
-
- Dim fserv
- Set fserv = CreateObject("CuteFTPPro.TEConnection")
- 'fserv.UseProxy = "BOTH"
-
- fserv.Retries = 0
-
- 'socks-proxy prompt
- nUserChoice = MsgBox ("Use Socks and Proxy", vbYesNoCancel)
- If nUserChoice = vbYes Then
- socksInfo = InputBox("Enter sock info (leave empty or use url syntax: socks[4|5]://[name:pass@]host:port)", "SOCKS", "socks5://proxy:1080")
- proxyInfo = InputBox("Enter proxy info (leave empty or use url syntax: [http|ftp]://[name:pass@]host:port)", "PROXY", "http://proxy:8000")
- fserv.SocksInfo = socksInfo
- fserv.ProxyInfo = proxyInfo
- else
- If nUserChoice = vbNo Then
- fserv.SocksInfo = socksInfo
- fserv.ProxyInfo = proxyInfo
- End If
- End If
-
- 'show sock and proxy info
- If Not nUserChoice = vbCancel Then
- socksInfo2 = fserv.SocksInfo
- proxyInfo2 = fserv.ProxyInfo
- If socksInfo2 = "" Then
- socksInfo2 = "none"
- End If
- If proxyInfo2 = "" Then
- proxyInfo2 = "none"
- End If
- strMsg = "Socks(" & socksInfo2 & ") and Proxy(" & proxyInfo2 & ")"
- MsgBox strMsg, vbOKOnly, "Connection's SOCKS/PROXY info"
- End If
-
- 'test 0 - connect, REST, COMB
- If Not nUserChoice = vbCancel Then
- nUserChoice = MsgBox ("[TEST 0] connect, REST, COMB", vbYesNoCancel)
- End If
- If nUserChoice = vbYes Then
- strHost = "ftp.cuteftp.com"
-
- strHost = InputBox("Enter host", "CuteFTP Pro", strHost)
-
- fserv.Host = strHost
- fserv.Protocol = "ftp"
- fserv.Connect
- nREST = fserv.RestSupport
- nCOMB = fserv.CombSupport
- MsgBox "REST support: " & nREST & ", COMB support: " & nCOMB
- End If
-
- 'test 1 - remote exists test
- If Not nUserChoice = vbCancel Then
- nUserChoice = MsgBox ("[TEST 1] RemoteExists", vbYesNoCancel)
- End If
- If nUserChoice = vbYes Then
- strHost = "ftp.cuteftp.com"
- strPath = "/pub/cuteftppro/cuteftppro.exe"
-
- strHost = InputBox("Enter host", "CuteFTP Pro", strHost)
- strPath = InputBox("Enter remote path", "CuteFTP Pro", strPath)
- fserv.Host = strHost
- fserv.Protocol = "ftp"
-
- if fserv.RemoteExists(strPath) then
- ftype = fserv.FileType
- fsize = fserv.FileSize
- fdate = fserv.FileTimeModified
- MsgBox "Remote file info: type=" & ftype & ", size=" & fsize & ", date=" & fdate & strNL & "type: 1 - dir, 2 - file, 3 - link"
- else
- MsgBox "File not found: " & strPath
- End If
- End If
-
- 'test 2 - ftp download test
- If Not nUserChoice = vbCancel Then
- nUserChoice = MsgBox ("[TEST2] FTP Download: ", vbYesNoCancel)
- End If
- If nUserChoice = vbYes Then
- strHost = "ftp.cuteftp.com"
- strPath = "/pub/cuteftppro/cuteftppro.exe"
- strLocalPath = strDesktop & "\te_com_test\CutePRO_ftp.exe"
-
- strHost = InputBox("Enter host", "CuteFTP Pro", strHost)
- strPath = InputBox("Enter remote path", "CuteFTP Pro", strPath)
- strLocalPath = InputBox("Enter local path", "CuteFTP Pro", strLocalPath)
-
- fserv.Host = strHost
- fserv.Protocol = "ftp"
- fserv.Download strPath, strLocalPath
- End If
-
- 'test 3 - ftp download multiple test
- If Not nUserChoice = vbCancel Then
- nUserChoice = MsgBox ("[TEST3] FTP Download multiple", vbYesNoCancel)
- End If
- If nUserChoice = vbYes Then
- strHost = "ftp.cuteftp.com"
- strPath = "/pub/cuteftppro"
- strLocalPath = strDesktop & "\te_com_test"
- strWCard = "*.*"
-
- strHost = InputBox("Enter host", "CuteFTP Pro", strHost)
- strPath = InputBox("Enter remote path", "CuteFTP Pro", strPath)
- strLocalPath = InputBox("Enter local path", "CuteFTP Pro", strLocalPath)
- strWCard = InputBox("Enter name", "CuteFTP Pro", strWCard)
-
- fserv.Host = strHost
- fserv.Protocol = "ftp"
- fserv.RemoteFolder = strPath
- fserv.LocalFolder = strLocalPath
- fserv.Download strWCard, ""
- End If
-
- 'test 4 - http download test
- If Not nUserChoice = vbCancel Then
- nUserChoice = MsgBox ("[TEST4] HTTP Download", vbYesNoCancel)
- End If
- If nUserChoice = vbYes Then
- strHost = "www.cuteftp.com"
- strPath = "/index.html"
- strLocalPath = strDesktop & "\te_com_test\http\index.txt"
-
- strHost = InputBox("Enter host", "CuteFTP Pro", strHost)
- strPath = InputBox("Enter remote path", "CuteFTP Pro", strPath)
- strLocalPath = InputBox("Enter local path", "CuteFTP Pro", strLocalPath)
-
- fserv.Host = strHost
- fserv.Protocol = "http"
- fserv.Download strPath, strLocalPath
- End If
-
- 'test 5 - ftp download test
- If Not nUserChoice = vbCancel Then
- nUserChoice = MsgBox ("[TEST5] FTP synchronize dir: ", vbYesNoCancel)
- End If
- If nUserChoice = vbYes Then
- strHost = "ftp.microsoft.com"
- strPath = "/solutions"
- strLocalPath = strDesktop & "\te_com_test\sync"
-
- strHost = InputBox("Enter host", "CuteFTP Pro", strHost)
- strPath = InputBox("Enter remote path", "CuteFTP Pro", strPath)
- strLocalPath = InputBox("Enter local path", "CuteFTP Pro", strLocalPath)
-
- fserv.Protocol = "ftp"
- fserv.Host = strHost
- fserv.Synchronize strPath, strLocalPath, 1, 1
- End If
-
- 'MsgBox("Log: " & fserv.Log)
-
- End Sub
-
- '=======================================================================
- '= Main
- '=======================================================================
- Test()
- MsgBox("Done")
-