[Gambas-user] R: Prog.gambas only one process

Ru Vuott vuott at ...325...
Tue Mar 13 22:37:58 CET 2012


Hello Jussi,

wery well, yes I tried it and it works fine !

Mine works too, but yours it's shorter and more simple than mine ! I didn't know "pgrep"... thank you !

Optime !

I want to say to abbat.81 that the operation principle is substantially the same: "picking" the PID number in the string returned by "pgrep" (Jussi's solution: very good) or "grep" (my...long solution).


Bye
Vuott





--- Mar 13/3/12, Jussi Lahtinen <jussi.lahtinen at ...626...> ha scritto:

> Da: Jussi Lahtinen <jussi.lahtinen at ...626...>
> Oggetto: Re: [Gambas-user] R: Prog.gambas only one process
> A: "mailing list for gambas users" <gambas-user at lists.sourceforge.net>
> Data: Martedì 13 marzo 2012, 21:33
> This is code that I use:
> 
> Dim sOutput As String
> 
>   Exec ["pgrep", "-f", "-l",
> "NameOfYourProgram.gambas"] Wait To sOutput
> 
>   If Split(Trim$(sOutput), gb.NewLine).Count > 1
> Then
>   Quit
>   Endif
> 
> 
> Jussi
> 
> 
> 
> On Tue, Mar 13, 2012 at 03:29, Ru Vuott <vuott at ...325...>
> wrote:
> 
> > My suggestion:
> >
> > <<<<<<
> >
> > Public Sub Form_Open()
> >
> >  Dim index As String
> >  Dim plura As String[]
> >  Dim a, b, c As Integer
> >
> > Shell "ps -aux | grep " & "aaaaaaaaaaaaaaaa" To
> index
> >
> >
> >  plura = Split(index, " ")
> >
> >  c = plura.Count
> >
> >  For a = 0 To c - 1
> >
> >
> > If Right(plura[a], 20) Like "*.gambas*" Then
> >
> >    For b = a To 100
> >
> >
> >    Try Shell "kill " & plura[b]
> >    Next
> >  Endif
> >
> >
> >  Next
> >
> > End
> >
> > >>>>>>
> >
> >
> > bye
> >
> > Vuott
> >
> >
> >
> >
> >
> > --- Mar 13/3/12, abbat <abbat.81 at ...787...>
> ha scritto:
> >
> > > Da: abbat <abbat.81 at ...787...>
> > > Oggetto: [Gambas-user]  Prog.gambas only one
> process
> > > A: gambas-user at lists.sourceforge.net
> > > Data: Martedì 13 marzo 2012, 00:44
> > >
> > > How to allow to run only one copy of prog.gambas?
> > > I tried to:
> > > Shell ["killall", "prog.gambas"]
> > > on form open...
> > > But there is no such a process when prog.gambas is
> running/
> > >
> > >
> > > --
> > > View this message in context:
> > http://old.nabble.com/Prog.gambas-only-one-process-tp33491262p33491262.html
> > > Sent from the gambas-user mailing list archive at
> > > Nabble.com.
> > >
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > > 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
> > >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Keep Your Developer Skills Current with LearnDevNow!
> > 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-d2d
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> 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-d2d
> _______________________________________________
> 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