Re: [PD] Check for batch and/or nogui mode from Patch

2014-01-13 Thread Cyrille Henry

hello,

the most simple solution is to add a message at startup :
pd -batch -send testquit bang

[loadbang]
|
[message for object(
|
[object-to-test]
|
[t b a]
| |
| [stdout]
|
|   [r testquit]
|   |
|  [1 
|   |
[spigot 0]
|
[; pd quit(

cheers
c


Le 13/01/2014 20:26, Thomas Mayer a écrit :

Hi,

is there a way to get information on whether Pd has been started with
-batch or -nogui from inside a patch?

I am trying to make unit tests by starting a Pd instance in batch mode
from Python, and comparing the output from [stdout] to the desired
result, and I want Pd to close itself via [; pd quit(. When Pd is not
running in batch mode, then I want to stop this message from being sent
with a [spigot], something like:

[loadbang]
|
[message for object(
|
[object-to-test]
|
[t b a]
| |
| [stdout]
|
|  [test-for-batch-mode]
|  |
[spigot]
|
[; pd quit(

Thanks,
Thomas



___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Check for batch and/or nogui mode from Patch

2014-01-13 Thread Roman Haefeli
On Mon, 2014-01-13 at 20:26 +0100, Thomas Mayer wrote:
 Hi,
 
 is there a way to get information on whether Pd has been started with
 -batch or -nogui from inside a patch?

Though I consider Cyrille's approach the clean way for your specific
purpose, there is also a way to check for '-batch' without help from
outside. Measure [delay 1000] with [realtime] and if the result is
orders of magnitude smaller than '1000' (say 0.4), Pd has most likely
been started with '-batch' (assuming it didn't do much during the 1000ms
logical time). 

Roman





___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Check for batch and/or nogui mode from Patch

2014-01-13 Thread Thomas Mayer
Hi,

On 13.01.2014 21:20, Cyrille Henry wrote:
 hello,
 
 the most simple solution is to add a message at startup :
 pd -batch -send testquit bang

thanks, that worked liked a charm. Minor correction though: The command
line is

pd -batch -send testquit bang

 
 [loadbang]
 |
 [message for object(
 |
 [object-to-test]
 |
 [t b a]
 | |
 | [stdout]
 |
 |   [r testquit]
 |   |
 |  [1 
 |   |
 [spigot 0]
 |
 [; pd quit(

And now: Unit testing PuREST JSON,
Thomas
-- 
Ich komme aus dem Staunen nicht heraus.
Dann bleib halt drin, du Seppel
(Dietmar Dath - Die Abschaffung der Arten)
http://www.residuum.org/

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list