This Lib allows the use of WinSCP in AHK by creating a wrapper class for WinSCPnet.dll (can be donwloaded here).
-
The DLL file has to be registered. This is done with
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe WinSCPnet.dll /codebase <path_to>WinSCPnet.dll %WINDIR%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe WinSCPnet.dll /codebase <path_to>WinSCPnet.dll
or by running the included WinSCP_regDLL.cmd
file
The commands must be run with Admin permissions (elevated)
2. The library can be included using #Inclulde or by placing the file inside Library Folders.
FTPSession := new WinSCP
try
FTPSession.OpenConnection("ftp://myserver.com","username","password")
catch e
msgbox % "Oops. . . Something went wrong``n" e.Message
FTPSession := new WinSCP
try
{
FTPSession.Hostname := "ftp://myserver.com"
FTPSession.Protocol := WinSCPEnum.FtpProtocol.Ftp
FTPSession.Secure := WinSCPEnum.FtpSecure.ExplicitSsl
FTPSession.User := "MyUserName"
FTPSession.Password := "P@ssw0rd"
FTPSession.Fingerprint := "xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" ;set to false to ignore server certificate
FTPSession.OpenConnection()
} catch e
msgbox % "Oops. . . Something went wrong``n" e.Message
FTPSession := new WinSCP
try
{
FTPSession.OpenConnection("ftp://myserver.com","username","password")
fName := "Windows10_InsiderPreview_x64_EN-US_10074.iso"
fPath := "C:\temp"
tPath := "/Win10beta/"
if (!FTPSession.FileExists(tPath))
FTPSession.CreateDirectory(tPath)
FTPSession.PutFiles(fPath "\" fName, tPath)
} catch e
msgbox % "Oops. . . Something went wrong``n" e.Message
FTPSession := new WinSCP
try
{
FTPSession.OpenConnection("ftp://myserver.com","username","password")
fName := "Windows10_InsiderPreview_x64_EN-US_10074.iso"
lPath := "C:\temp"
rPath := "/Win10beta/"
if (FTPSession.FileExists(rPath "/" fName))
FTPSession.GetFiles(rPath "/" fName, lPath)
} catch e
msgbox % "Oops. . . Something went wrong``n" e.Message
FTPSession := new WinSCP
try
{
FTPSession.OpenConnection("ftp://myserver.com","username","password")
FileCollection := t.ListDirectory("/")
for file in FileCollection.Files {
if (file.Name != "." && file.Name != "..")
msgbox % "Name: " file.Name "``nPermission: " file.FilePermissions.Octal "``nIsDir: " file.IsDirectory "``nFileType: " file.FileType "``nGroup: " file.Group "``nLastWriteTime: " file.LastWriteTime "``nLength: " file.Length "``nLength32: " file.Length32 "``nOwner: " file.Owner
} catch e
msgbox % "Oops. . . Something went wrong``n" e.Message
More example will be available in the wiki once it's set up
- "Oliver Lipkau" @ oliver.lipkau.net
Git Repo Wiki yet to be written