lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lilypond input filename access (Paul Morris)


From: Patrick or Cynthia Karl
Subject: Re: lilypond input filename access (Paul Morris)
Date: Sun, 31 Aug 2014 08:39:39 -0500


On Aug 31, 2014, at 5:14 AM, Phil Holmes <address@hidden> wrote:

----- Original Message ----- From: "Patrick or Cynthia Karl" <address@hidden>
To: <address@hidden>; "Paul Morris" <address@hidden>
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 <address@hidden>
To: address@hidden
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"

% 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]