[Gambas-user] Avoiding multiple instances

Epíleg epileg at ...626...
Thu Jan 31 18:38:35 CET 2008


En/na Stefano Palmeri ha escrit:
> 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

Very good solution. Thanks a lot!

Epíleg.





More information about the User mailing list