[Gambas-user] Avoiding multiple instances

Stefano Palmeri rospolosco at ...152...
Thu Jan 31 17:35:04 CET 2008


Alle 16:45, giovedì 31 gennaio 2008, Stefano Palmeri ha scritto:
> I use this simple code:
>
> PUBLIC SUB Main()
>  
>   DIM sShellOutput AS String
>  
>   SHELL "ps aux | grep " & Application.Name & ".gambas" & " | grep -v grep"
> TO sShellOutput
>  
>   IF sShellOutput THEN QUIT  
>      
> END

or better:

PUBLIC SUB Main()
  
  DIM sShellOutput AS String
  
  SHELL "ps aux | grep " & Application.Name & ".gambas" & 
        " | grep -wv grep | wc -l" TO sShellOutput 
  
  IF Val(sShellOutput) > 1 THEN QUIT  
          
END






More information about the User mailing list