From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/81608 Path: news.gmane.org!not-for-mail From: =?iso-8859-2?B?UHJvY2jhemthIEx1a+G5IEluZy4gLSBQb250ZXggcy4gci4gby4=?= Newsgroups: gmane.comp.tex.context Subject: Number of pages by Lua of a figure to be inserted? Date: Wed, 10 Apr 2013 16:22:24 +0200 Message-ID: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2"; Format="flowed"; DelSp="yes" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1365603819 18887 80.91.229.3 (10 Apr 2013 14:23:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Apr 2013 14:23:39 +0000 (UTC) To: ConTeXt Original-X-From: ntg-context-bounces@ntg.nl Wed Apr 10 16:23:39 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from [195.12.62.10] (helo=balder.ntg.nl) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UPvw3-0003aR-Lj for gctc-ntg-context-518@m.gmane.org; Wed, 10 Apr 2013 16:23:39 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 384DA10433; Wed, 10 Apr 2013 16:22:40 +0200 (CEST) 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 MdMMbjKkP3DA; Wed, 10 Apr 2013 16:22:37 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 9CF2E10418; Wed, 10 Apr 2013 16:22:37 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E74A510418 for ; Wed, 10 Apr 2013 16:22:35 +0200 (CEST) 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 B0U-WVKlXg7R for ; Wed, 10 Apr 2013 16:22:33 +0200 (CEST) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id BE744103F2 for ; Wed, 10 Apr 2013 16:22:33 +0200 (CEST) Original-Received: from mail.pontex.cz (mail.pontex.cz [89.233.168.98]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r3AEMTJC003276 for ; Wed, 10 Apr 2013 16:22:31 +0200 Original-Received: from localhost ([127.0.0.1]) by mail.pontex.cz (Kerio MailServer 6.6.2) for ntg-context@ntg.nl; Wed, 10 Apr 2013 16:22:28 +0200 User-Agent: Opera Mail/12.15 (Win32) X-Bayes-Prob: 0.8731 (Score 2, tokens from: @@RPTN) X-CanIt-Geo: ip=89.233.168.98; country=CZ; region=52; city=Prague; latitude=50.0833; longitude=14.4667; http://maps.google.com/maps?q=50.0833,14.4667&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03JmemuqS - 5ad6d04bc62d - 20130410 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.71 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:81608 Archived-At: Hello, I need to identify number of pages by Lua of an image which is to be insert= ed. The image can be of all various types supported by Ctx - e.g. .png, .pdf. I've been using the following code so far (based on a mailing thread in the= past): ---- function nOfPages(fn) local fig =3D figures.push{name =3D fn} local info =3D figures.identify() figures.check() local n =3D fig.used.pages figures.pop() return n end ---- But the code above break Ctx in the case that the image doesn't exist. I'd need to modify the solution somehow so to return 'nil' or 'false' (or a= error message) in the case the file was not found. How to do it? TIA. Best regards, Lukas (NB: Still "ConTeXt ver: 2012.11.26 13:31 MKIV fmt: 2012.11.27 int: engl= ish/english".) -- = Ing. Luk=E1=B9 Proch=E1zka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezov=E1 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038 ___________________________________________________________________________= ________ 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 ___________________________________________________________________________= ________