Page 1 of 1

Trouble using COM Object...

Posted: Fri Sep 16, 2005 3:41 pm
by imc1975
feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


I have the following script:

Code: Select all

// pararme en el directorio temporal 
chdir ($tmpdir); 

// Habilitar el camino del ejecutable. 
$cmd = 'movescu.exe'; 

$arg = array(); 
$arg[] = '-S'; 
$arg[] = '-aet'; 
$arg[] = 'MyVServer'; 
$arg[] = '-aec'; 
$arg[] = $aec; 
$arg[] = '-aem'; 
$arg[] = 'MyVServer'; 
$arg[] = '+P'; 
$arg[] = '201'; 
$arg[] = 'localhost'; 
$arg[] = '200'; 
$arg[] = basename($destination); 

$cmdline = "cmd /C $cmd ". implode(' ', $arg); 
$WshShell = new COM("WScript.Shell"); 
$oExec = $WshShell->Run($cmdline, 0, true);
It should run a hidden command shell in windows, execute de binary movescu.exe with the params above, wait until it finish, and close the cmd.

I doesn´t. Even when there are a lot o calls like this one after and before, the one that doesn't works is this one.

Can any buddy help me?


feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Fri Sep 16, 2005 4:53 pm
by feyd
You're lucky you're new here.. cross-posting and not using bbcode for posting code... that's two strikes in one.... ;)

Are you sure that command works?