mstoeger Posted May 31, 2010 Report Share Posted May 31, 2010 Dear collegues, What is the right way to COMMUNICATE with winscp? I'd like to open a winscp session, then "use" the session to transport files, rename them, whatever, and after finishing the job I'd like to close the session again. Of course, there is the possibility to write a script and run it. But: As I want to transport "livedata" packed into simple ascii-files or something similar, the effort for opening a session should be as small as possible. Is it possible to communicate interactively to a command-line application? With the built-in "Intermediate FTP"-VIs this is not a problem, but SCP/SFTP? Thank you! Martin Quote Link to comment
MichaelBalzer Posted June 23, 2010 Report Share Posted June 23, 2010 As far as I can tell from the System Exec VI help, this isn't possible: If wait until completion? is TRUE, standard input is available as input to the command and standard output and standard error are available when the command finishes running. If FALSE, the command runs in the background and its input and output are not available. That said, it should be possible to redirect WinSCP's stdin and stdout with the use of a DLL wrapper. An article on Code Project titled "Redirecting an arbitrary Console's Input/Output" describes just this. If SCP/SFTP is what you're after then an external FTP library such as libcurl might be of use. Again this requires DLL calls (and is probably more complex to implement). Quote Link to comment
Rolf Kalbermatter Posted June 25, 2010 Report Share Posted June 25, 2010 As far as I can tell from the System Exec VI help, this isn't possible: That said, it should be possible to redirect WinSCP's stdin and stdout with the use of a DLL wrapper. An article on Code Project titled "Redirecting an arbitrary Console's Input/Output" describes just this. The OpenG Pipe Project does just that. It is a LabVIEW Library that replaces the System Exec function and returns pipe refnums for the three standard IO interfaces and functions to read and write to those refnums. The project hasn't been released yet as I consider it not entirely release quality but it does work for me and I have actually used in in several of my projects already. Since there is no officially released package yet you can't just download it through VIPM from internet. But here is a copy of a package you can install using VIPM. oglib_pipe-1.0-1.ogp Quote Link to comment
mstoeger Posted July 2, 2010 Author Report Share Posted July 2, 2010 Interesting approaches ... I will take a closer look to it and post my success! Martin Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.