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

> ----- Original Message ----- From: "Patrick or Cynthia Karl" <pck...@me.com>
> To: <lilypond-user@gnu.org>; "Paul Morris" <p...@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 <p...@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 

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

Reply via email to