From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/31075 Path: news.gmane.org!not-for-mail From: Renaud AUBIN Newsgroups: gmane.comp.tex.context Subject: run a ruby script and use the standard output ??? Date: Wed, 27 Sep 2006 23:08:22 +0200 Message-ID: <451AE846.2090701@nibua-r.org> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1051173129==" X-Trace: sea.gmane.org 1159391475 12487 80.91.229.2 (27 Sep 2006 21:11:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 27 Sep 2006 21:11:15 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Wed Sep 27 23:11:13 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1GSggF-0002jS-1F for gctc-ntg-context-518@m.gmane.org; Wed, 27 Sep 2006 23:10:59 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 8B8A31FE82; Wed, 27 Sep 2006 23:10:55 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 08716-09; Wed, 27 Sep 2006 23:10:52 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 115B61FF1D; Wed, 27 Sep 2006 23:09:01 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 701AC1FF1D for ; Wed, 27 Sep 2006 23:08:56 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 08716-08-5 for ; Wed, 27 Sep 2006 23:08:44 +0200 (CEST) Original-Received: from 42.mail-out.ovh.net (42.mail-out.ovh.net [213.251.189.42]) by ronja.ntg.nl (Postfix) with SMTP id EA0A51FE82 for ; Wed, 27 Sep 2006 23:08:41 +0200 (CEST) Original-Received: (qmail 20351 invoked by uid 503); 27 Sep 2006 21:08:18 -0000 Original-Received: from b6.ovh.net (HELO mail53.ha.ovh.net) (213.186.33.56) by 42.mail-out.ovh.net with SMTP; 27 Sep 2006 21:08:18 -0000 Original-Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 27 Sep 2006 21:08:31 -0000 Original-Received: from d80-170-126-156.cust.tele2.fr (HELO ?192.168.78.10?) (aubin@nibua-r.org@80.170.126.156) by ns0.ovh.net with SMTP; 27 Sep 2006 21:08:30 -0000 User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: fr, en Original-To: ConTeXt Mailing List X-Ovh-Remote: 80.170.126.156 (d80-170-126-156.cust.tele2.fr) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|H 0.500006/N X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:31075 Archived-At: This is a multi-part message in MIME format. --===============1051173129== Content-Type: multipart/alternative; boundary="------------030208090809030802020803" This is a multi-part message in MIME format. --------------030208090809030802020803 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi all, Is it possible to run a ruby script from a context document during its processing (I already know how to do that using \write18 but there is maybe a better way...) then get the output of the script to display or use it into the document. It's a little bit hard to describe so I have a simple example: \starttext \def\vartest{3.124325234543523452435} \write18{ruby ./myscript.rb \vartest XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX} \stoptext with myscript.rb: temp = ARGV[0] puts "\nXXXXXXXXXXXXX " + (Math::sqrt(temp.to_f)).to_s + " XXXXXXXXXXXXX\n" I would store the result of puts into a variable usable within ConTeXt... Renaud --------------030208090809030802020803 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi all,

Is it possible to run a ruby script from a context document during its processing (I already know how to do that using \write18 but there is maybe a better way...) then get the output of the script to display or use it into the document. It's a little bit hard to describe so I have a simple example:

\starttext
\def\vartest{3.124325234543523452435}
\write18{ruby ./myscript.rb \vartest XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}
\stoptext

with myscript.rb:

temp = ARGV[0]
puts "\nXXXXXXXXXXXXX " + (Math::sqrt(temp.to_f)).to_s + " XXXXXXXXXXXXX\n"

I would store the result of puts into a variable usable within ConTeXt...


Renaud
--------------030208090809030802020803-- --===============1051173129== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context --===============1051173129==--