Hello, I tried to make a "more minimal" example. Still we have: files: ./t3.mkiv ./T/Kn.pdf and code: ---- \startluacode test = function(fn) local fig = figures.push{name = fn} if figures.identify().status.status ~= 0 then figures.check() end figures.pop() return fn .. ": " .. (fig.used.pages or "?") .. "\\par" end \stopluacode \starttext AAA \startluacode context(test("T/Kn.pdf")) -- Found - OK context(test("Kn.pdf")) -- Not found - OK \stopluacode \setupexternalfigures[directory=T] \startluacode context(test("Kn.pdf")) -- Not found (or unknown number of pages) - UNEXPECTED - why? ("3rd call") \stopluacode \externalfigure[Kn.pdf][scale=625] % Found - OK \stoptext ---- The 3rd call of 'test()' seems to not locate 'Kn.pdf' although the path was altered by preceding \setupexternalfigures. How to modify the 'test()' to work properly even in the 3rd case? NB: Sorry for repeating the topic "in another coat" - it may not be so interesting for listeners of this mailing list. But the goal is to add figures and PDF files into the document automatically. One of the tasks is to detect number of pages of the figure. The code above is a core cut out; it should work (or: if this part wouldn't work, neither would the rest) even in the 3rd case. Any help to make the piece of code work would be appreciated. Best regards, Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038