Bash scripting with \[shell\]
i *think* you can pass arguments to the script something like [pack f s f]--"/path/to/script.sh $1 $2 $3"--[shell], but i'm not sure, i never used [shell]...
once inside the script you can get the arguments using the same syntax - bash uses $0 for the program file/path - then $1 $2 $3 etc (and some funky things like "all of them" and "count them" that i've never used)
for actual piping streams of data from pd into a running script and back out into pd again, i don't know what solutions exist - maybe something in Python or Lua or something else could make it easier, or if you don't need synchronous results then i guess netsend / netreceive objects with the pdreceive / pdsend tools.
Expr
Sunji,
I'm starting to work with bash scripts, but I can't figure out exactly how to use them with [shell]
I can have [shell] open the script by sending the script name to it, but I cant pass any other variables to it after that.
Is there somewhere I can read about using bash scripts with [shell]?
Fiddle~ and piano
so liquid media seems to be windows only. so see attached.
i wrote an object called [openfile] that is windows only. has worked for me so far but use at you own risk.
the file launches a vbscript in the background that sends keystrokes to a window of your desire.
open the included text file (not minimize but open(can be in the background)
open pd and turn on the metro by hitting the toggle box. the textfile will pop to the front and starting printing "Test"
The script works by calling the window by name in title bar, then sending keystrokes
in case no one wants to open the script:
'''''''''''''''''''''''''''''''''SendKeyToApp.vbs
'May 8, 2008
'JonGrant
'Send text string to desired open window
''''''''''''''''''''''''''''''''
Option Explicit
'On Error Resume Next
Dim objWshShell
Set objWshShell = CreateObject("WScript.Shell")
objWshShell.AppActivate "Test"
objWshShell.SendKeys "Test"
'figure a way to do command line and the command is
'sendkeystoapp.vbs windowTitle string
'e.g. sendkeystoapp.vbs Test.txt Test
'This will send Test to a textfile call Test
'Just replace above with these
'Option Explicit
'On Error Resume Next
'Dim strAppWindowTitle
'Dim strSendString
'Dim objWshShell
'Set objWshShell = CreateObject("WScript.Shell")
'strAppWindowTitle = WScript.Arguments.Item(0)
'strSendString = WScript.Arguments.Item(1)
'WshShell.AppActivate appWindowTitle
'WshShell.SendKeys strSendString
Pd version 0.39.3-extended on Tiger
Hello,
I just installed Pd version 0.39.3-extended on a PPC with Tiger 10.4.2 as operative system. When I launch it, read on the Pd window:
/Applications/AudioSw/Pd-extended.app/Contents/Resources/Scripts/../extra/pdp.pd_darwin: dlopen(/Applications/AudioSw/Pd-extended.app/Contents/Resources/Scripts/../extra/pdp.pd_darwin, 10): Library not loaded: /usr/X11R6/lib/libX11.6.dylib
Referenced from: /Applications/AudioSw/Pd-extended.app/Contents/Resources/Scripts/../extra/pdp.pd_darwin
Reason: image not found
pdp: can't load library
/Applications/AudioSw/Pd-extended.app/Contents/Resources/Scripts/../extra/pidip.pd_darwin: dlopen(/Applications/AudioSw/Pd-extended.app/Contents/Resources/Scripts/../extra/pidip.pd_darwin, 10): Library not loaded: /usr/X11R6/lib/libX11.6.dylib
Referenced from: /Applications/AudioSw/Pd-extended.app/Contents/Resources/Scripts/../extra/pidip.pd_darwin
Reason: image not found
pidip: can't load library
I am a new user of Pd (always used Max-Msp)... what's wrong?
Thank you in advance.
Gpp
A million more \[shell\] issues
This is my most recent attempt to call a perl script using the shell object in osx. I chown the perl script so it should be executable- but I never get any output from the [shell]. has someone found a similar problem? How can I overcome? I need to have a pd perl relationship develop on my computer- but there is some sort of incompatibility... I am frustrato maestoso.
Sunji
<pd code>
#N canvas 0 22 454 304 10;
#X obj 116 191 shell;
#X msg 116 84 add2 \$1;
#X obj 116 34 inlet;
#X obj 117 269 outlet;
#X obj 146 249 outlet;
#X msg 115 148 perl 2appender.pl if;
#X msg 61 112 set perl 2appender.pl;
#X msg 61 69 bang;
#X obj 72 243 print;
#X msg 186 84 add2 \$1;
#X obj 186 34 inlet;
#X msg 256 84 add2 \$1;
#X obj 256 34 inlet;
#X msg 256 121 bang;
#X msg 180 184 perl 2appender.pl friends SECOND 45;
#X msg 30 221 \; \$1;
#X msg 149 219 print err;
#X text 247 209 we are trying to call;
#X text 247 218 my little script;
#X text 246 229 2appender;
#X connect 0 0 3 0;
#X connect 0 0 8 0;
#X connect 0 0 15 0;
#X connect 0 1 4 0;
#X connect 0 1 16 0;
#X connect 1 0 5 0;
#X connect 2 0 7 0;
#X connect 2 0 1 0;
#X connect 5 0 0 0;
#X connect 6 0 5 0;
#X connect 7 0 6 0;
#X connect 9 0 5 0;
#X connect 10 0 9 0;
#X connect 11 0 5 0;
#X connect 11 0 13 0;
#X connect 12 0 11 0;
#X connect 13 0 5 0;
#X connect 14 0 0 0;
</pd code>
<perl code>
#!/usr/bin/perl
# Hi! I take 3 arguments, here;
$Save_Param = $ARGV[0];
$Open_Route = $ARGV[1];
$Save_Value = $ARGV[2];
# and I concactenate (??) here like so;
print "2$Save_Param$Open_Route $Save_Value\n";
# this is a bit of
# format recall voodoo for
# the crazy machine
</perl code>
Py/py-ext throws "signal 4"
Hey,
I want to use python scripts with pd and installed py/py-ext (using flext). When I want to load PD with "pd -lib py -path scripts" it throws
localhost:/usr/local/lib/pd/extra> pd -lib py -path scripts
Pd: signal 4
localhost:/usr/local/lib/pd/extra> pd_gui: pd process exited
flext and py were compiled without errors. There is the py.pd_linux script in the extras- directory. I copied the scripts-directory from the py-source into the extras-directory. Nothing changed .....
So, I have no clue anymore. I searched of course in google for "signal 4" in connection with PD and searched also in this forum but couldn't find anything!
So do you have any idea?
This are my specification:
ubuntu Edgy 4.10
kernel 2.6.17-10-generic
python 2.4
Pd version 0.39.2-extended-RC1
Shell issues
When I try to instantiate the [shell] I get this;
error: shell: can't load abstraction within itself
shell
... couldn't create
error: shell: can't load abstraction within itself
shell
... couldn't create
error: shell: can't load abstraction within itself
shell
... couldn't create
all the other extras work fine, what is up with this??
oh, another thing- are there tutorials for writing objects anywhere? I wouldn't mind c++, but a python or perl would be much better.
gracias!!
sunji
Lib path osx?
hi all
i'm trying to get the pyext objects to work (with the hope of using them to route data from a usb/serial adapter)
i can load the library but not the script path, the readme says to use:
"pd -lib py -path scripts"
so in version 0.39 i opened the startup section and tried adding each of these:
py -path /pyext_scripts/
py -path /pyext_scripts/scripts
(scripts are in "cd /pyext_scripts/")
but it says it can't load the lib. if i exclude the path it will load but then i can't use the objects as they can't find the scripts
is this the correct way to specify paths for libs in pd on osx?
any help appreciated.