[Gambas-user] SHELL or EXEC background with gb.web.gui

Bruce Steers bsteers4 at gmail.com
Thu Dec 24 19:32:16 CET 2020


Hi.  I would do something like this.. (writing this code ad-lib so not
tested it)
Create a timer to monitor the running shell process for Process.Running and
clean up when finished that way.

Export

 Public hProcess As Process

Public Sub WebTimer1_Timer()

  WebLabel1.Text = Now()

End

Public Sub WebButton1_Click()

  hProcess = Shell "sleep 5"
  ProcessTimer.Start
End

Public Sub ProcessTimer_Timer()

If hProcess.State = Process.Running Then Return

ProcessTimer.Stop
If hProcess Then hProcess.Kill()
  WebLabel2.Text = "Kill"

End

BruceS

On Thu, 24 Dec 2020 at 16:59, Mayost Sharon <sharon at 455.co.il> wrote:

> Hello
>
> (For example I did sleep but in practice I need to run a command to
> convert that it takes some time)
>
> I'm trying to run any command in the background without WAIT
>
> so:
>
> Export
>
> Public Sub WebTimer1_Timer()
>
>   WebLabel1.Text = Now()
>
> End
>
> Public Sub WebButton1_Click()
>
>   Dim hProcess As Process
>
>   hProcess = Shell "sleep 5" As "myp"
>
> End
>
> Public Sub myp_Kill()
>
>   WebLabel2.Text = "Kill"
>
> End
>
>
> I see that it continues to the next line but on the page I see that the
> time display is stopped until the end of the command.
>
> At the end of the command he does not update what is inside the Kill event
> WebLabel2.Text = "Kill"
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201224/6670feb1/attachment.htm>


More information about the User mailing list