[Gambas-user] I need your help with Processes

M. Cs. mohareve at ...626...
Fri Feb 3 18:04:58 CET 2012


Thanks!
I've tried to add:

Repeat
    wait 1
Until checker=TRUE
checker=FALSE
After every Run_command()

and

Public Sub Process_Read()
  Dim sStr As String
  Read #$hProcess, sStr, -256
 answers.Add(sStr)
 checker=TRUE
 End

My problem is how to solve insertion of user name and password as well
as the command 'ls -R'

How would you solve this?

2012/2/3, Jussi Lahtinen <jussi.lahtinen at ...626...>:
> Hmmm... seem like you need to wait for the execution of the commands.
>
> Try:
>
> 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")
>>
>
> Wait 1
>
> Or implement more intelligent method to wait something to appear to read
> event.
>
>
> This isn't necessary:
>
>
>>  fajl = Open User.Home & "/Csabax.txt" For Create
>>  Close (fajl)
>>
>
>
>
> Instead use this:
>
>  fajl = Open User.Home & "/Csabax.txt" For Write Create
>>  For i = 0 To answers.Max
>>    Print #fajl, answers[i]
>>  Next
>>  Close (fajl)
>>
>
>
> This kills the process before commands are executed:
>
>  $hProcess.Kill
>>
>
>
>
> Instead of this:
>
>
>> Public Sub Process_Read()
>>  Dim sStr As String
>>  Read #$hProcess, sStr, -256
>>  $sText = sStr
>>  answers.Add($sText)
>> End
>>
>
>
> Use this:
>
> Public Sub Process_Read()
>  Dim sStr As String
>  Read #$hProcess, sStr, -256
>  answers.Add(sStr)
> End
>
>
> Because otherwise, you can lose message written to $sText in error event.
>
>
> Instead of this:
>
> Public Sub Process_Error(sStr As String)
>>
>>  $sText = $sText & sStr
>>
>> End
>>
>>
> Use this:
>
>
> Public Sub Process_Error(sStr As String)
>
>  answers.Add(sStr)
>
> End
>
>
>
> Hope this helps.
>
>
> Jussi
> ------------------------------------------------------------------------------
> 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 at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list