[PD] [popen] and PHP on windows

Frank Barknecht fbar at footils.org
Thu Sep 11 00:27:23 CEST 2008


Hallo,
patco hat gesagt: // patco wrote:

> Le mercredi 10 septembre 2008 à 18:16 +0200, Jack a écrit :
> > However, when i enter directely 'C:/wamp/bin/php/php5.2.6/php.exe -f  
> > C:/wamp/www/ADM/arbre.php 10' in a Command Prompt window and press  
> > 'Enter', all works fine and Pd receive the datas.
> 
> it's hard to believe that cmd is able to read slashes like backslashes

I think, some implementations of popen can do that.  Maybe the one
attached written in pdlua works on MS-Windows, too (cannot check for lack
of MS-Windows).

Ciao
-- 
Frank
-------------- next part --------------
#N canvas 0 0 450 300 10;
#X obj 136 123 list prepend run;
#X obj 136 145 list trim;
#X msg 45 129 run ls /tmp;
#X obj 139 170 luaopen;
#X obj 139 227 print luaopen;
#X obj 185 192 print errors;
#X msg 136 92 ls /home/me;
#X connect 0 0 1 0;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 3 1 5 0;
#X connect 6 0 0 0;
-------------- next part --------------
local pdclassname = "luaopen"

local M = pd.Class:new():register(pdclassname)

function M:initialize(name, atoms)
    self.inlets = 1
    self.outlets = 2 
    return true
end

function M:in_1_run(args)
    local cmd = table.concat(args, " ")
    -- instead of io.popen os.execute may be interesting as well.
    local result, err = io.popen(cmd)
    if result then
        for l in result:lines() do
            self:outlet(1, "list", {l})
        end
        result:close()
    else
        self:outlet(2, "error", {err})
    end
end




More information about the Pd-list mailing list