Public $hProcess As Process Private $sText As String Private answers As New String[]
Public Sub Main() Dim fajl As File Dim tovabb As Boolean Dim i As Integer $hProcess = Exec ["bash", "--noediting"] For Input Output As "Process" tovabb = Run_command("ftp") tovabb = Run_command("open") tovabb = Run_command("ftp.mysite.com") tovabb = Run_command("myusername") tovabb = Run_command("mypassword") tovabb = Run_command("ls ./public_html -R") fajl = Open User.Home & "/Csabax.txt" For Create Close (fajl) fajl = Open User.Home & "/Csabax.txt" For Write For i = 0 To answers.Max Print #fajl, answers[i] Next Close (fajl) $hProcess.Kill End Public Sub Process_Read() Dim sStr As String Read #$hProcess, sStr, -256 $sText = sStr answers.Add($sText) End Public Sub Process_Error(sStr As String) $sText = $sText & sStr End Public Sub Run_command(cmd As String) As Boolean Dim sLig As String sLig = cmd & gb.NewLine sLig = Conv$(sLig, Desktop.Charset, System.Charset) Print #$hProcess, sLig Return True End Private Function Normalize(sStr As String) As String Dim sNorm As String Dim iInd As Integer Dim iCar As Integer Dim bEsc As Boolean sNorm = sStr If System.Charset = Desktop.Charset Then Return sNorm Else Return Conv$(sNorm, System.Charset, Desktop.Charset) Endif End This is what I have stolen from the Console example. What I want is to have a FTP site's content listed and stored in a local text file or in variable for further processing. The problem is that this module returns nothing. How could I simulate the behaviour of a real console with predefined myuser, mypassword and ftp address. The same thing works with Console example, but I don't need a form or anything else, just the result of "ls ./public_html -R" at the end. Main() is called from other part of the program. Thanks! Csaba ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user