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 <j.ha...@xs4all.nl> wrote:

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:l...@pontex.cz
Pontex s. r. o.      | mailto:pon...@pontex.cz | http://www.pontex.cz | IDDS: 
nrpt3sn | IČO: 40763439
Bezová 1658
147 14 Praha 4

Mob.: +420 702 033 396

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to