Topic "Use with Delphi"

Author Message
ordromike
[View user's profile]

Joined: 2010-03-04
Posts: 2
Hello.

I would like use process winscp with language delphi.
There is examples in .Net (C# and VB) on this site.
Have you an example in Delphi ?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Please read documentation. If that does not help, come back.
_________________
Martin Prikryl
ordromike
[View user's profile]

Joined: 2010-03-04
Posts: 2
In Delphi, I use CreateProcess() for create a process with WinScp.com
After, I would like "send" function open, put, close ...

But I don't know what functions to use for this (like "WriteLine()" in example C# and VB.net in documentation)

And I cant find informations !

Can you help me?
Thanks.
Gerhard_S
[View user's profile]

Joined: 2011-11-12
Posts: 8
Location: Berlin, Germany
Hi,
I got an elementary part of WinSCP to work with Delphi XE.
To call WinSCP, I use the function ShellExecute_AndWait, which can be found at Torry or here:
http://www.swissdelphicenter.ch/en/showcode.php?id=93
Password, host name and sesssion information is stored in WinSCP.ini - before using Delphi, I established a connection via the WinSCP GUI and saved the session, including the password.
In Delphi, create a form with a button and a memo.

procedure TForm1.Button1Click(Sender: TObject);
var logdir, progdir, paramstring: string;
begin
logdir := 'C:\Users\user\Documents';
progdir := 'C:\Program Files (x86)\WinSCP\WinSCP.exe'; //for use with Win7/x64
paramstring := '/ini=WinSCP.ini /log=logfile.txt /script=C:\Users\user\Documents\upload2.txt';
if ShellExecute_AndWait('open', PChar(progdir), paramstring, logdir, SW_SHOWNORMAL, true) >=0 then
begin
Sleep(1000);
Memo1.Lines.LoadFromFile(logdir + '\logfile.txt');
end
else
ShowMessage('Error 1');
end;
The script file upload2.txt consists of:
option batch abort
option confirm off
open username@hostname.com
put D:\heuteneu.txt /httpdocs/content/test/heuteneu.txt
exit
==============
Maybe someone can help me to solve the next tasks:
1. List the content of the remote directory to a stringlist (so it becomes possible to prevent overwriting of existing files)
2. get an online error message (not only in the logfile)
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Please read
https://winscp.net/eng/docs/logging_xml

Or wait for the next version, it will be way easier with it.
_________________
Martin Prikryl
Gerhard_S
[View user's profile]

Joined: 2011-11-12
Posts: 8
Location: Berlin, Germany
You can find a free sample application (including source code), written with Delphi XE, on my website:
http://www.seyso.de/projects_e/projects_en.php
It demonstrates the use of the cd, ls, put, get, and synchronize commands as well as evaluating the xml logfile.
It is not meant for commercial use, as it does not encrypt password nor user name.
Please send remarks to me using the contact form on
http://www.seyso.de/varia_e/contact_e/contact_en.php
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License