I'll add documentdata.variable so that one can do this: \setupdocument [id=foo] \startluacode luatex.wrapup(function() local id = documentdata.variable("id") if id and id ~= "" then local oldname = file.addsuffix(environment.jobname,"pdf") local newname = file.addsuffix("doc-"..id,"pdf") if lfs.isfile(newname) then -- print("removing",newname) os.remove(newname) end if not lfs.isfile(newname) then -- print("renaming",oldname,newname) os.rename(oldname,newname) end if not lfs.isfile(newname) then -- print("error in renaming") end end end) \stopluacode \starttext test \stoptext -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hello,
just a note:
whilst command line option "--result=..." must point to the dir where the processed file is located, "os.rename()" allows to move files across dirs (at least on Win7), so this might be a way to evade "--result" limitation.
Best regards,
Lukas
On Fri, 21 Sep 2018 13:01:14 +0200, Hans Hagen
I'll add documentdata.variable so that one can do this:
\setupdocument [id=foo]
\startluacode
luatex.wrapup(function() local id = documentdata.variable("id") if id and id ~= "" then local oldname = file.addsuffix(environment.jobname,"pdf") local newname = file.addsuffix("doc-"..id,"pdf") if lfs.isfile(newname) then -- print("removing",newname) os.remove(newname) end if not lfs.isfile(newname) then -- print("renaming",oldname,newname) os.rename(oldname,newname) end if not lfs.isfile(newname) then -- print("error in renaming") end end end)
\stopluacode
\starttext
test
\stoptext
-- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS: nrpt3sn | IČO: 40763439 Bezová 1658 147 14 Praha 4 Mob.: +420 702 033 396
participants (2)
-
Hans Hagen
-
Procházka Lukáš Ing.