[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: lilypond input filename access (Paul Morris)
From:       Patrick or Cynthia Karl <pckarl () me ! com>
Date:       2014-08-31 13:39:39
Message-ID: D9D68B85-3EE1-4666-B69A-5DDECA408C30 () me ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Aug 31, 2014, at 5:14 AM, Phil Holmes <mail@philholmes.net> wrote:

> ----- Original Message ----- From: "Patrick or Cynthia Karl" <pckarl@me.com>
> To: <lilypond-user@gnu.org>; "Paul Morris" <paul@paulwmorris.com>
> Sent: Saturday, August 30, 2014 8:27 PM
> Subject: Re:lilypond input filename access (Paul Morris)
> 
> 
> 
> > Message: 8
> > Date: Sat, 30 Aug 2014 08:34:40 -0700 (PDT)
> > From: Paul Morris <paul@paulwmorris.com>
> > To: lilypond-user@gnu.org
> > Subject: Re: lilypond input filename access
> > 
> > Patrick or Cynthia Karl wrote
> > > Is there a way to access the input filename that lilypond was invoked with
> > > in order to include it in text output to the pdf file generated?
> > 
> > This snippet shows how:
> > http://lsr.di.unimi.it/LSR/Item?id=197
> > 
> > HTH
> 
> That helps a lot.  However,  that snippet begins:
> 
> % originally made for
> % \version "2.14.0"
> % Modified by David Kastrup for V:2.18 on Feb. 2014
> and doesn’t compile without errors.  I added a '\version “2.14.0” ‘ statement and \
> ran the version 2.18.2 convert-ly on it and the result compiles without error.  It \
> looks like David’s actual mods have gotten lost somehow. 
> ================================================================
> 
> Could you let us have a copy of the working version, please?

Yes, appended.

Note that although the result compiles without error, there appear to be defects in \
the generated pdf in that several text strings lie partially outside the page.

(It’s also curious that the comment in line 6 was changed from <% \version “2.14.0”> \
to <% \version “2.18.0”>.  I have manually changed this back to the original comment.

The modified snippet:

\version "2.18.0"
%% http://lsr.dsi.unimi.it/LSR/Item?id=197
%% see also http://lilypond.1069038.n5.nabble.com/LSR-v-2-18-quot-File-Information-quot-strange-warnings-tc159399.html


% originally made for
% \version "2.14.0"
% Modified by David Kastrup for V:2.18 on Feb. 2014

%{ Display ly file information on the score, including file name, file size,
 LilyPond version, date processed, time processed, time last modified, and
 the LilyPond command line. %}

#(define comml    (object->string (command-line)))
#(define loc      (+ (string-rindex comml #\space ) 2)) 
#(define commllen (- (string-length comml) 2))
#(define filen    (substring comml loc commllen))
#(define siz      (object->string (stat:size (stat filen))))
#(define ver      (object->string (lilypond-version)))
#(define dat      (strftime "%m/%d/%Y" (localtime (current-time))))
#(define tim      (strftime "%H:%M:%S" (localtime (current-time))))
#(define modt     (stat:mtime (stat filen)))
#(define modts    (strftime "%m/%d/%Y %H:%M:%S" (localtime modt)))
		\header { dedication = \markup \column {
{ "- - - - - - Using Scheme \"define\"-  - - - - -" } % "
\line { "File Name = "        \filen }
\line { "File Size = "        \siz   }
\line { "LilyPond Version = " \ver   }
\line { "Date Processed = "   \dat   }
\line { "Time Processed = "   \tim   }
\line { "Last Modified = "    \modts }
\line { "Command Line = "     \comml }
{ "" }
{ "- - - - - - Using \"ly:export\" - - - - - -" } % "
{ $(string-append    "File Name = "
              (substring (object->string (command-line))
           (+ (string-rindex (object->string (command-line)) #\sp ) 1)
           (- (string-length (object->string (command-line))) 1))) }
{ $(string-append    "File Size = "
              (object->string (stat:size (stat filen)))) } 
{ $(string-append    "LilyPond Version = "
              (lilypond-version)) } 
{ $(string-append    "Date Processed = "
              (strftime "%m/%d/%Y" (localtime (current-time)))) }
{ $(string-append    "Time Processed = "
              (strftime "%H:%M:%S" (localtime (current-time)))) }
{ $(string-append    "Last Modified = "
              (strftime "%m/%d/%Y %H:%M:%S"
              (localtime (stat:mtime (stat filen))))) }
{ $(string-append    "Command Line = "
              (object->string (command-line))) } 
	}	}
{ c''1_\markup { \column {
{ "- - - - - - In \"markup\" - - - - - -" } % "
\line { "File Name = "        \filen }
\line { "File Size = "        \siz   }
\line { "LilyPond Version = " \ver   }
\line { "Date Processed = "   \dat   }
\line { "Time Processed = "   \tim   }
\line { "Last Modified = "    \modts }
\line { "Command Line = "     \comml }
}}}



> 
> --
> Phil Holmes 


[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html \
charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: \
space; -webkit-line-break: after-white-space;"><br><div><div>On Aug 31, 2014, at 5:14 \
AM, Phil Holmes &lt;<a href="mailto:mail@philholmes.net">mail@philholmes.net</a>&gt; \
wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">----- \
Original Message ----- From: "Patrick or Cynthia Karl" &lt;<a \
href="mailto:pckarl@me.com">pckarl@me.com</a>&gt;<br>To: &lt;<a \
href="mailto:lilypond-user@gnu.org">lilypond-user@gnu.org</a>&gt;; "Paul Morris" \
&lt;<a href="mailto:paul@paulwmorris.com">paul@paulwmorris.com</a>&gt;<br>Sent: \
Saturday, August 30, 2014 8:27 PM<br>Subject: Re:lilypond input filename access (Paul \
Morris)<br><br><br><br><blockquote type="cite">Message: 8<br>Date: Sat, 30 Aug 2014 \
08:34:40 -0700 (PDT)<br>From: Paul Morris &lt;<a \
href="mailto:paul@paulwmorris.com">paul@paulwmorris.com</a>&gt;<br>To: <a \
href="mailto:lilypond-user@gnu.org">lilypond-user@gnu.org</a><br>Subject: Re: \
lilypond input filename access<br><br>Patrick or Cynthia Karl wrote<br><blockquote \
type="cite">Is there a way to access the input filename that lilypond was invoked \
with<br>in order to include it in text output to the pdf file \
generated?<br></blockquote><br>This snippet shows how:<br><a \
href="http://lsr.di.unimi.it/LSR/Item?id=197">http://lsr.di.unimi.it/LSR/Item?id=197</a><br><br>HTH<br></blockquote><br>That \
helps a lot. &nbsp;However, &nbsp;that snippet begins:<br><br>% originally made \
for<br>% \version "2.14.0"<br>% Modified by David Kastrup for V:2.18 on Feb. \
2014<br>and doesn’t compile without errors. &nbsp;I added a '\version “2.14.0” ‘ \
statement and ran the version 2.18.2 convert-ly on it and the result compiles without \
error. &nbsp;It looks like David’s actual mods have gotten lost \
somehow.<br><br>================================================================<br><br>Could \
you let us have a copy of the working version, \
please?<br></blockquote><div><br></div>Yes, appended.</div><div><br></div><div>Note \
that although the result compiles without error, there appear to be defects in the \
generated pdf in that several text strings lie partially outside the \
page.</div><div><br></div><div>(It’s also curious that the comment in line 6 was \
changed from &lt;% \version “2.14.0”&gt; to &lt;% \version “2.18.0”&gt;. &nbsp;I have \
manually changed this back to the original comment.</div><div><br></div><div>The \
modified snippet:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; \
font-family: Menlo; background-color: rgb(183, 254, 255);">\version \
"2.18.0"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">%% <a \
href="http://lsr.dsi.unimi.it/LSR/Item?id=197">http://lsr.dsi.unimi.it/LSR/Item?id=197</a></div><div \
style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, \
254, 255);">%% see also <a \
href="http://lilypond.1069038.n5.nabble.com/LSR-v-2-18-quot-File-Information-quot-stra \
nge-warnings-tc159399.html">http://lilypond.1069038.n5.nabble.com/LSR-v-2-18-quot-File-Information-quot-strange-warnings-tc159399.html</a></div><div \
style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, \
254, 255); min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; \
font-family: Menlo; background-color: rgb(183, 254, 255);">% originally made \
for</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">% \version "2.14.0"</div><div style="margin: \
0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, 254, 255);">% \
Modified by David Kastrup for V:2.18 on Feb. 2014</div><div style="margin: 0px; \
font-size: 11px; font-family: Menlo; background-color: rgb(183, 254, 255); \
min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: \
Menlo; background-color: rgb(183, 254, 255);">%{ Display ly file information on the \
score, including file name, file size,</div><div style="margin: 0px; font-size: 11px; \
font-family: Menlo; background-color: rgb(183, 254, 255);">&nbsp;LilyPond version, \
date processed, time processed, time last modified, and</div><div style="margin: 0px; \
font-size: 11px; font-family: Menlo; background-color: rgb(183, 254, 255);">&nbsp;the \
LilyPond command line. %}</div><div style="margin: 0px; font-size: 11px; font-family: \
Menlo; background-color: rgb(183, 254, 255); min-height: 13px;"><br></div><div \
style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, \
254, 255);">#(define comml&nbsp; &nbsp; (object-&gt;string (command-line)))</div><div \
style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, \
254, 255);">#(define loc&nbsp; &nbsp; &nbsp; (+ (string-rindex comml #\space ) \
2))&nbsp;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">#(define commllen (- (string-length comml) \
2))</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">#(define filen&nbsp; &nbsp; (substring comml \
loc commllen))</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">#(define siz&nbsp; &nbsp; &nbsp; \
(object-&gt;string (stat:size (stat filen))))</div><div style="margin: 0px; \
font-size: 11px; font-family: Menlo; background-color: rgb(183, 254, 255);">#(define \
ver&nbsp; &nbsp; &nbsp; (object-&gt;string (lilypond-version)))</div><div \
style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, \
254, 255);">#(define dat&nbsp; &nbsp; &nbsp; (strftime "%m/%d/%Y" (localtime \
(current-time))))</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">#(define tim&nbsp; &nbsp; &nbsp; (strftime \
"%H:%M:%S" (localtime (current-time))))</div><div style="margin: 0px; font-size: \
11px; font-family: Menlo; background-color: rgb(183, 254, 255);">#(define modt &nbsp; \
&nbsp; (stat:mtime (stat filen)))</div><div style="margin: 0px; font-size: 11px; \
font-family: Menlo; background-color: rgb(183, 254, 255);">#(define modts&nbsp; \
&nbsp; (strftime "%m/%d/%Y %H:%M:%S" (localtime modt)))</div><div style="margin: 0px; \
font-size: 11px; font-family: Menlo; background-color: rgb(183, 254, 255);"><span \
class="Apple-tab-span" style="white-space:pre">		</span>\header { dedication = \
\markup \column {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">{ "- - - - - - Using Scheme \"define\"-&nbsp; \
- - - - -" } % "</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "File Name = "&nbsp; &nbsp; &nbsp; \
&nbsp; \filen }</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "File Size = "&nbsp; &nbsp; &nbsp; \
&nbsp; \siz &nbsp; }</div><div style="margin: 0px; font-size: 11px; font-family: \
Menlo; background-color: rgb(183, 254, 255);">\line { "LilyPond Version = " \ver \
&nbsp; }</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "Date Processed = " &nbsp; \dat &nbsp; \
}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "Time Processed = " &nbsp; \tim &nbsp; \
}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "Last Modified = "&nbsp; &nbsp; \modts \
}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "Command Line = " &nbsp; &nbsp; \comml \
}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">{ "" }</div><div style="margin: 0px; \
font-size: 11px; font-family: Menlo; background-color: rgb(183, 254, 255);">{ "- - - \
- - - Using \"ly:export\" - - - - - -" } % "</div><div style="margin: 0px; font-size: \
11px; font-family: Menlo; background-color: rgb(183, 254, 255);">{ \
$(string-append&nbsp; &nbsp; "File Name = "</div><div style="margin: 0px; font-size: \
11px; font-family: Menlo; background-color: rgb(183, 254, 255);">&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; (substring (object-&gt;string (command-line))</div><div \
style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, \
254, 255);">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (+ (string-rindex \
(object-&gt;string (command-line)) #\sp ) 1)</div><div style="margin: 0px; font-size: \
11px; font-family: Menlo; background-color: rgb(183, 254, 255);">&nbsp;&nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; (- (string-length (object-&gt;string (command-line))) 1))) \
}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">{ $(string-append&nbsp; &nbsp; "File Size = \
"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; (object-&gt;string (stat:size (stat filen)))) }&nbsp;</div><div style="margin: \
0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, 254, 255);">{ \
$(string-append&nbsp; &nbsp; "LilyPond Version = "</div><div style="margin: 0px; \
font-size: 11px; font-family: Menlo; background-color: rgb(183, 254, 255);">&nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (lilypond-version)) }&nbsp;</div><div \
style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, \
254, 255);">{ $(string-append&nbsp; &nbsp; "Date Processed = "</div><div \
style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, \
254, 255);">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (strftime "%m/%d/%Y" \
(localtime (current-time)))) }</div><div style="margin: 0px; font-size: 11px; \
font-family: Menlo; background-color: rgb(183, 254, 255);">{ $(string-append&nbsp; \
&nbsp; "Time Processed = "</div><div style="margin: 0px; font-size: 11px; \
font-family: Menlo; background-color: rgb(183, 254, 255);">&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; (strftime "%H:%M:%S" (localtime (current-time)))) \
}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">{ $(string-append&nbsp; &nbsp; "Last Modified \
= "</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; (strftime "%m/%d/%Y %H:%M:%S"</div><div style="margin: 0px; font-size: 11px; \
font-family: Menlo; background-color: rgb(183, 254, 255);">&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; (localtime (stat:mtime (stat filen))))) }</div><div \
style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, \
254, 255);">{ $(string-append&nbsp; &nbsp; "Command Line = "</div><div style="margin: \
0px; font-size: 11px; font-family: Menlo; background-color: rgb(183, 254, \
255);">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (object-&gt;string \
(command-line))) }&nbsp;</div><div style="margin: 0px; font-size: 11px; font-family: \
Menlo; background-color: rgb(183, 254, 255);"><span class="Apple-tab-span" \
style="white-space:pre">	</span>}<span class="Apple-tab-span" \
style="white-space:pre">	</span>}</div><div style="margin: 0px; font-size: 11px; \
font-family: Menlo; background-color: rgb(183, 254, 255);">{ c''1_\markup { \column \
{</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">{ "- - - - - - In \"markup\" - - - - - -" } % \
"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "File Name = "&nbsp; &nbsp; &nbsp; \
&nbsp; \filen }</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "File Size = "&nbsp; &nbsp; &nbsp; \
&nbsp; \siz &nbsp; }</div><div style="margin: 0px; font-size: 11px; font-family: \
Menlo; background-color: rgb(183, 254, 255);">\line { "LilyPond Version = " \ver \
&nbsp; }</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "Date Processed = " &nbsp; \dat &nbsp; \
}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "Time Processed = " &nbsp; \tim &nbsp; \
}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "Last Modified = "&nbsp; &nbsp; \modts \
}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, 255);">\line { "Command Line = " &nbsp; &nbsp; \comml \
}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; \
background-color: rgb(183, 254, \
255);">}}}</div><div><br></div></div><div><br></div><div><br><blockquote \
type="cite"><br>--<br>Phil Holmes <br></blockquote></div><br></body></html>



_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic