Thanks, this helps a lot!

Matthias

On May 29, 2007, at 1:22 PM, Peter Münster wrote:

> On Mon, 28 May 2007, Matthias Weber wrote:
>
>> is there a simple TeX/ConTeXt way to test in a TeX file whether a
>> link to an external document is broken
>>   so that I get an error message if not?
>
> Quick and dirty:
>
> \def\UseURL[#1][#2]{%
>   \executesystemcommand{%
>     if wget -qO/dev/null #2 \letterbar\letterbar [ -f #2 ]; then
>       echo \letterbackslash\letterbackslash useURL[#1][#2];
>     else
>       echo \letterbackslash\letterbackslash#1DoesNotExist;
>     fi >texcmd.tmp}%
>   \input texcmd.tmp}
>
> \setupcolors[state=start]
> \setupinteraction[state=start]
>
> \UseURL[fileOk][/tmp/real-file]
> \UseURL[fileNotOk][/tmp/not-existing-file]
> \UseURL[urlOk][http://contextgarden.net/]
> \UseURL[urlNotOk][http://no.contextgarden.net/]
>
> \starttext
> existing file: \from[fileOk]
>
> not existing file: \from[fileNotOk]
>
> existing url: \from[urlOk]
>
> not existing url: \from[urlNotOk]
> \stoptext
>
> Cheers, Peter
>
> --  
> http://pmrb.free.fr/contact/
> ______________________________________________________________________ 
> _____________
> 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://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to