ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* playing with Windows drag & drop
@ 2020-10-06 14:18 Pablo Rodriguez
  2020-10-06 15:57 ` Henning Hraban Ramm
  2020-10-07 14:23 ` context
  0 siblings, 2 replies; 7+ messages in thread
From: Pablo Rodriguez @ 2020-10-06 14:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

I have a minimal sample file:

  \starttext
    \insertpages[\env{PDFdocument}]
  \stoptext

I invoke it in Windows, using the following batch file:

  @echo off
  REM ~ context --purgeall --arguments="PDFdocument=%1" b.tex

I’m afraid it only works if the batch file and the PDF document are on
the same directory.

I guess this is related to "\" in Windows paths. Is there a way to make
it work with the sample above?

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: playing with Windows drag & drop
  2020-10-06 14:18 playing with Windows drag & drop Pablo Rodriguez
@ 2020-10-06 15:57 ` Henning Hraban Ramm
  2020-10-06 19:26   ` Pablo Rodriguez
  2020-10-07 14:23 ` context
  1 sibling, 1 reply; 7+ messages in thread
From: Henning Hraban Ramm @ 2020-10-06 15:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> Am 06.10.2020 um 16:18 schrieb Pablo Rodriguez <oinos@gmx.es>:
> 
> Dear list,
> 
> I have a minimal sample file:
> 
>  \starttext
>    \insertpages[\env{PDFdocument}]
>  \stoptext
> 
> I invoke it in Windows, using the following batch file:
> 
>  @echo off
>  REM ~ context --purgeall --arguments="PDFdocument=%1" b.tex
> 
> I’m afraid it only works if the batch file and the PDF document are on
> the same directory.
> 
> I guess this is related to "\" in Windows paths. Is there a way to make
> it work with the sample above?

Did you try with / paths? They usually work on Windows, no need for \s

Hraban
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: playing with Windows drag & drop
  2020-10-06 15:57 ` Henning Hraban Ramm
@ 2020-10-06 19:26   ` Pablo Rodriguez
  0 siblings, 0 replies; 7+ messages in thread
From: Pablo Rodriguez @ 2020-10-06 19:26 UTC (permalink / raw)
  To: ntg-context

On 10/6/20 5:57 PM, Henning Hraban Ramm wrote:
>> Am 06.10.2020 um 16:18 schrieb Pablo Rodriguez <oinos@gmx.es>:
>>  [...]
>>  REM ~ context --purgeall --arguments="PDFdocument=%1" b.tex
>>
>> I’m afraid it only works if the batch file and the PDF document are on
>> the same directory.
>>
>> I guess this is related to "\" in Windows paths. Is there a way to make
>> it work with the sample above?
>
> Did you try with / paths? They usually work on Windows, no need for \s.

Many thanks for your reply, Hraban.

I wish I could do that. I get the paths from a Windows .bat file.

I drop PDF docuemnts to the .bat file, this is the reason I get the
paths with backslashes.

I use something like that:

  for %%A in (%*) do (
   context --purgeall --arguments="PDFDoc={%%~A} b.tex
  )

But to replace backslashes with slashes, I would need something like this:

  for %%A in (%*) do (
   context --purgeall --arguments="PDFDoc={%%%~A:\=/%} b.tex
  )

But that prevents the batch file from working at all.

I don’t know whether there is a workaround for this.

Many thanks for you help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: playing with Windows drag & drop
  2020-10-06 14:18 playing with Windows drag & drop Pablo Rodriguez
  2020-10-06 15:57 ` Henning Hraban Ramm
@ 2020-10-07 14:23 ` context
  2020-10-07 14:45   ` context
  1 sibling, 1 reply; 7+ messages in thread
From: context @ 2020-10-07 14:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello Pablo,

sometimes I do something hacky like the following in similar situations 
(not tested now):

---- .bat
call lua.exe -e "os.execute('echo context --purgeall 
--arguments=PDFdocument=' .. ([[%1]]):gsub([[\]], '/') .. ' b.tex')"
----

Best regards,

Lukas


On 2020-10-06 16:18, Pablo Rodriguez wrote:
> Dear list,
> 
> I have a minimal sample file:
> 
>   \starttext
>     \insertpages[\env{PDFdocument}]
>   \stoptext
> 
> I invoke it in Windows, using the following batch file:
> 
>   @echo off
>   REM ~ context --purgeall --arguments="PDFdocument=%1" b.tex
> 
> I’m afraid it only works if the batch file and the PDF document are on
> the same directory.
> 
> I guess this is related to "\" in Windows paths. Is there a way to make
> it work with the sample above?
> 
> Many thanks for your help,
> 
> Pablo
> --
> http://www.ousia.tk
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: playing with Windows drag & drop
  2020-10-07 14:23 ` context
@ 2020-10-07 14:45   ` context
  2020-10-07 17:10     ` Pablo Rodriguez
  0 siblings, 1 reply; 7+ messages in thread
From: context @ 2020-10-07 14:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello Pablo,

slight correction:

---- .bat
call lua.exe -e "os.execute('echo context --purgeall 
--arguments=PDFdocument=' .. ([[%1]]):gsub([[\]], '/') .. ' b.tex')"
----

"echo" should be omitted, of course, or be placed just for debugging 
purposes.

Best regards,

Lukas


On 2020-10-07 16:23, context@vivaldi.net wrote:
> Hello Pablo,
> 
> sometimes I do something hacky like the following in similar
> situations (not tested now):
> 
> ---- .bat
> call lua.exe -e "os.execute('echo context --purgeall
> --arguments=PDFdocument=' .. ([[%1]]):gsub([[\]], '/') .. ' b.tex')"
> ----
> 
> Best regards,
> 
> Lukas
> 
> 
> On 2020-10-06 16:18, Pablo Rodriguez wrote:
>> Dear list,
>> 
>> I have a minimal sample file:
>> 
>>   \starttext
>>     \insertpages[\env{PDFdocument}]
>>   \stoptext
>> 
>> I invoke it in Windows, using the following batch file:
>> 
>>   @echo off
>>   REM ~ context --purgeall --arguments="PDFdocument=%1" b.tex
>> 
>> I’m afraid it only works if the batch file and the PDF document are on
>> the same directory.
>> 
>> I guess this is related to "\" in Windows paths. Is there a way to 
>> make
>> it work with the sample above?
>> 
>> Many thanks for your help,
>> 
>> Pablo
>> --
>> http://www.ousia.tk
>> ___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: playing with Windows drag & drop
  2020-10-07 14:45   ` context
@ 2020-10-07 17:10     ` Pablo Rodriguez
  2020-10-08  7:56       ` context
  0 siblings, 1 reply; 7+ messages in thread
From: Pablo Rodriguez @ 2020-10-07 17:10 UTC (permalink / raw)
  To: ntg-context

On 10/7/20 4:45 PM, context@vivaldi.net wrote:
> Hello Pablo,
>
> slight correction:
>
> ---- .bat
> call lua.exe -e "os.execute('echo context --purgeall
> --arguments=PDFdocument=' .. ([[%1]]):gsub([[\]], '/') .. ' b.tex')"
> ----

Many thanks for your reply, Lukas.

I found another workaround at the ConTeXt file (b.tex).

  \cldcontext{string.gsub([[\env{PDFdocument}]], "\\\\", "/")}

I don’t know why I needed to add "\\\\" instead of "\\". (otherwise, I
kept getting "C://Users//username//Desktop//document.pdf" and similar ones).

Many thanks for your help,

Pablo


> On 2020-10-07 16:23, context@vivaldi.net wrote:
>> Hello Pablo,
>>
>> sometimes I do something hacky like the following in similar
>> situations (not tested now):
>>
>> ---- .bat
>> call lua.exe -e "os.execute('echo context --purgeall
>> --arguments=PDFdocument=' .. ([[%1]]):gsub([[\]], '/') .. ' b.tex')"
>> ----
>>
>> Best regards,
>>
>> Lukas
>>
>>
>> On 2020-10-06 16:18, Pablo Rodriguez wrote:
>>> Dear list,
>>>
>>> I have a minimal sample file:
>>>
>>>   \starttext
>>>     \insertpages[\env{PDFdocument}]
>>>   \stoptext
>>>
>>> I invoke it in Windows, using the following batch file:
>>>
>>>   @echo off
>>>   REM ~ context --purgeall --arguments="PDFdocument=%1" b.tex
>>>
>>> I’m afraid it only works if the batch file and the PDF document are on
>>> the same directory.
>>>
>>> I guess this is related to "\" in Windows paths. Is there a way to
>>> make
>>> it work with the sample above?
>>>
>>> Many thanks for your help,
>>>
>>> Pablo
>>> --
>>> http://www.ousia.tk

--
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: playing with Windows drag & drop
  2020-10-07 17:10     ` Pablo Rodriguez
@ 2020-10-08  7:56       ` context
  0 siblings, 0 replies; 7+ messages in thread
From: context @ 2020-10-08  7:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello Pablo,

On 2020-10-07 19:10, Pablo Rodriguez wrote:
> On 10/7/20 4:45 PM, context@vivaldi.net wrote:
>> Hello Pablo,
>> 
>> slight correction:
>> 
>> ---- .bat
>> call lua.exe -e "os.execute('echo context --purgeall
>> --arguments=PDFdocument=' .. ([[%1]]):gsub([[\]], '/') .. ' b.tex')"
>> ----
> 
> Many thanks for your reply, Lukas.
> 
> I found another workaround at the ConTeXt file (b.tex).
> 
>   \cldcontext{string.gsub([[\env{PDFdocument}]], "\\\\", "/")}
> 
> I don’t know why I needed to add "\\\\" instead of "\\". (otherwise, I

I guess that's as Ctx translates "\\" into "\", and you need to have 
"\\" in Lua code.

You could alse write (not tested):

   \cldcontext{string.gsub([[\env{PDFdocument}]], [[\\]], "/")}

Best,

Lukas

> kept getting "C://Users//username//Desktop//document.pdf" and similar 
> ones).
> 
> Many thanks for your help,
> 
> Pablo
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-10-08  7:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 14:18 playing with Windows drag & drop Pablo Rodriguez
2020-10-06 15:57 ` Henning Hraban Ramm
2020-10-06 19:26   ` Pablo Rodriguez
2020-10-07 14:23 ` context
2020-10-07 14:45   ` context
2020-10-07 17:10     ` Pablo Rodriguez
2020-10-08  7:56       ` context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).