[PD-dev] checking to see if another instance of Pd is running

Hans-Christoph Steiner hans at eds.org
Tue Jan 13 05:38:05 CET 2009

I just found this snippet in the Tcl/Tk docs (http://tcl.tk/man/tcl8.4/TkCmd/send.htm 
) and it shows how to check if another instance of an app is running.

> This script fragment can be used to make an application that only  
> runs once on a particular display.
> if {[tk appname FoobarApp] ne "FoobarApp"} {
>     send -async FoobarApp RemoteStart $argv
>     exit
> }
> # The command that will be called remotely, which raises
> # the application main window and opens the requested files
> proc RemoteStart args {
>     raise .
>     foreach filename $args {
>         OpenFile $filename
>     }
> }

I think given the new Tcl code I am writing, it could be an easy  
solution to the problem of only launching one instance.  Basically, if  
Pd is started via pd.tk first, then it would only allow one instance.   
If it was started with 'pd', which launches pd.tk, then it would allow  
multiple instances.

This that is feasible?



                             kill your television

More information about the Pd-dev mailing list