From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/86687 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: issue with \processaction Date: Tue, 18 Mar 2014 22:40:31 +0100 Message-ID: References: <5328894F.1040208@gmx.es> <532896B1.2040502@wxs.nl> <5328B601.908@gmx.es> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1395178839 3529 80.91.229.3 (18 Mar 2014 21:40:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Mar 2014 21:40:39 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Mar 18 22:40:50 2014 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WQ1ke-0006FO-EF for gctc-ntg-context-518@m.gmane.org; Tue, 18 Mar 2014 22:40:48 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 6C208101EB; Tue, 18 Mar 2014 22:40:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id yInL0ho-8fM7; Tue, 18 Mar 2014 22:40:45 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id C4F27101E8; Tue, 18 Mar 2014 22:40:45 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BF2A7101E8 for ; Tue, 18 Mar 2014 22:40:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NI6ObTtN6Hjv for ; Tue, 18 Mar 2014 22:40:43 +0100 (CET) Original-Received: from filter4-ams.mf.surf.net (filter4-ams.mf.surf.net [192.87.102.72]) by balder.ntg.nl (Postfix) with ESMTP id 08C40101E1 for ; Tue, 18 Mar 2014 22:40:43 +0100 (CET) Original-Received: from mail-bk0-x22e.google.com (mail-bk0-x22e.google.com [IPv6:2a00:1450:4008:c01::22e]) by filter4-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s2ILvkq2024496 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 18 Mar 2014 22:57:57 +0100 Original-Received: by mail-bk0-f46.google.com with SMTP id v15so509472bkz.5 for ; Tue, 18 Mar 2014 14:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=urJm3C3lr1tpwDbeao2R67ZsrMnv3+5EtisrQ31ZJMU=; b=pb4SbhQLHxgYXXFmRZey2dMjoJcmPjcVA9lgMjWe/+Vxp38wj2cUdtaTDgZNk8dWyd nV3mYN8f0MQ62WC089mBOI4BZZZY/G+jbPs3VPXiHQJXAL/qmTUM0RVtG1xsuZV6WGp6 pdeKMB3grJ6BTRgEUNEfjz7U901Qlxzq2o8eeUXumqEzYeOLFYuibl9y5NRFgIY1WFbF uhbxCwVhVpOL11yYe5NznapUqhBrpoQfZQqhALuRAIwqqAXkpUH6hT1+eSW56o56iyLp SwVZycbpOu+lZ/o0KOyaBAVv5zvo23qzaBYsrvGcq7f65rhxLU+7z6JUerIdF67XoP+6 wiFQ== X-Received: by 10.204.101.199 with SMTP id d7mr16874179bko.10.1395178832004; Tue, 18 Mar 2014 14:40:32 -0700 (PDT) Original-Received: from keima.localdomain (x2f22934.dyn.telefonica.de. [2.242.41.52]) by mx.google.com with ESMTPSA id v12sm17658321bko.17.2014.03.18.14.40.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Mar 2014 14:40:31 -0700 (PDT) In-Reply-To: <5328B601.908@gmx.es> X-Mailer: Apple Mail (2.1874) X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=2a00:1450:4008:c01::22e; country=IE X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 01LD9VKQC - 26fe32925e24 - 20140318 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:86687 Archived-At: Am 18.03.2014 um 22:09 schrieb Pablo Rodriguez : > On 03/18/2014 07:55 PM, Hans Hagen wrote: >> On 3/18/2014 6:58 PM, Pablo Rodriguez wrote: >>> = >>> \def\CheckUser{\cldcommand{sprint(tex.vrbcatcodes,os.resultof"whoami")}} >>> \def\UserNumber{\processaction[\CheckUser][ousia=3D>1, unknown=3D>user = unknown]} >>> = >>> \starttext >>> This is user \CheckUser\ with number \UserNumber. >>> \stoptext >>> = >>> What am I doing wrong here? >> = >> you output vrbcatcodes strings while you test using ctx catcodesn >> = >> of course i'd use lua for all of it: >> = >> \startluacode >> local user =3D "" >> local users =3D { >> ["oasi"] =3D 1, >> } >> function document.CheckUser() >> user =3D os.resultof("whoami") >> context.verbatim(user) >> end >> = >> function document.UserNumber(name) >> context.verbatim(users[name or user] or 0) >> end >> \stopluacode >> = >> \def\CheckUser {\ctxlua{document.CheckUser ()}} >> \def\UserNumber{\ctxlua{document.UserNumber()}} >> = >> \starttext >> This is user \CheckUser\ with number \UserNumber. >> \stoptext > = > Many thanks for your reply, Hans. > = > I=92m afraid that the user doesn=92t get recognized (I corrected the user > name above). The same applies to your examples because your test won=92t work on our mac= hines ;) > Is there no way to do it with \processaction? Only when you ensure the text you get from Lua has the normal cathode regim= e and when you special characters like \ in the result you have to convert them to \le= tterbackslash etc. which isn=92t simpler than Hans solution. The advantage of Hans solution is= that you don=92t have to care about expansion. Wolfgang ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________