# Vertical line from top margin of page to current positon

I'm struggling with this really simple (vanilla plainTeX) trick, which I'm not able to crack...

How does one draw a vertical (i.e. perpendicular to the horizon) line that leads from the top (or top margin or as topmost as possible) of the current page to the current position (specifically the position of text at the time where the macro solving this problem is called)?

P. S. It may have unclear but the current position is meant including both the horizontal and vertical position. I. e.

Here I \myruler am...

Another paragraph...


would produce sth like

       |
|
|
|
|
Here I | am...

Another paragraph...

-

One possibility is to use the \pagetotal dimension which holds the accumulated natural height of the current page:

\newdimen\ruleht
\def\myrule{\par
\ruleht=\pagetotal
\vskip-\the\ruleht\llap{\vrule height\the\ruleht}
}

\def\Text{%some filler text for the example
text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text
text text text text text text text text text\par}

\Text\Text\myrule

\bye


-
ThX for the answer. However, can you tell how to do it with regard to horizontal position (viz edited question). Sorry, my bad for previously being unclear... –  mathemage Aug 26 '12 at 11:38

Building on Gonzalo's answer, maybe something like

\hsize=24pc
\def\lipsum{Lorem ipsum dolor sit amet. }
\def\llipsum{\lipsum\lipsum}
\def\lipsumV{\llipsum\llipsum\lipsum}
\def\pgtotrule{\dimen0=\pagetotal
\smash{\vrule height\dimen0 depth\dp\strutbox}}

\lipsumV
\lipsumV

\llipsum \lipsum \pgtotrule \lipsumV

\bye


-
Unfortunately your solution doesn't always work; for example, with your settings and text given by \lipsumV \llipsum \lipsum \pgtotrule \lipsumV it won't give the desired rule. \pagetotal doesn't get the needed value. –  Gonzalo Medina Aug 26 '12 at 15:03
@Gonzalo: Yes, true. I think \pagetotal only updates in vertical mode, but setting a custom dimen inside a \vadjust doesn't seem to have any difference. Puzzling. –  morbusg Aug 26 '12 at 15:27
Yes, puzzling, indeed. I was thinking about using \lastbox for the current paragraph to measure the current depth inside the paragraph, but my attempts failed. –  Gonzalo Medina Aug 26 '12 at 15:34
i suspect this needs \pdfsavepos, then saving the values to a label-like structure, in a file which will be read next time the document is compiled. i know of no support in plain tex for this, but it's pretty trivial if you only need one of these odd constructions; in latex it's supported by heiko oberdiek's zref package, which allows any number of the things, stored in the extended labels that package offers. –  wasteofspace Aug 26 '12 at 16:31