Page 1 of 1 1
Topic Options
#18533 - 2002-03-12 05:26 PM Pipe result into variable.
BroWniE Offline
Fresh Scripter

Registered: 2001-11-06
Posts: 20
All,

I have a PHP executible that outputs a number when the user logs on. I need to grab this # and use it to determine which part of the script it should do next. Here is what I have so far. any ideas would be appreciated.

$test=RUN "%windir%\system32\php.exe %windir%\system32\test.php"

thanks
Larry

Top
#18534 - 2002-03-12 06:48 PM Re: Pipe result into variable.
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
What you might try to do is send the result to a text file like
$test = RUN "%windir%\system32\php.exe %windir%\system32\test.php > c:\php.txt"

Then you can read the file out by

$rc = open(2,"c:\php.txt",2)
$php = readline(2)
$rc = close(2)
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#18535 - 2002-03-12 07:40 PM Re: Pipe result into variable.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
In our UDF Library you will find Pipe() and I think QPipe(). Either should do it for you.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#18536 - 2002-03-12 08:15 PM Re: Pipe result into variable.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
You did not say if your external program output the number to stdout or as an exit code. If the external program set an exit code, then you can do this:

code:
if @inwin=1
shell "%comspec% /c $CRCprog -v $FileSize $CRC $TargetFile >nul"
else
shell "$CRCprog -v $FileSize $CRC $TargetFile"
endif
$RC = @ERROR

Because KiXtart seems to pipe the exit code of a SHELL'ed program back through to @ERROR. Then check check $RC and do whatever.

[ 12 March 2002, 20:17: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#18537 - 2002-03-12 08:57 PM Re: Pipe result into variable.
BroWniE Offline
Fresh Scripter

Registered: 2001-11-06
Posts: 20
All...Thanks for the response... The output is a stdoutput... not an error code...

les_ligetfalvy Where at in the UDF Section?

thanks
Larry

Top
#18538 - 2002-03-12 09:29 PM Re: Pipe result into variable.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
BroWniE,
We all like to help but you could help yourself a bit too. [Big Grin]

At the top of the page is a 'search' link. Click it, type "pipe" in the Words field, select UDF Library Forum, and you should get three hits.

How hard can it be?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#18539 - 2002-03-12 09:59 PM Re: Pipe result into variable.
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Oh! you mean these 3 links? [Eek!]

Pipe - Submits a shell command and redirects output to an array - Shawn Tassie

CalcLogicalSubnet () - Returns the logical subnet ID - Howard Bullock

Pipe(2) - Submits a shell command and redirects output to an array - AJH

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 641 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.154 seconds in which 0.085 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org