lilypond-user
[Top][All Lists]
Advanced

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

Re: Retrieve Filename of Current Script


From: Graham King
Subject: Re: Retrieve Filename of Current Script
Date: Tue, 10 Sep 2019 18:38:26 +0100

> On 10 Sep 2019, at 09:26, address@hidden wrote:
> 
> Hi all,
> what would I have to do in order to retrieve the filename of my current 
> lilypond script so that I can use it as a variable and assign it to the 
> title-field?


Here's one way to do it.  There might be other, better, ways.

The snippets repository is your friend:
http://lsr.di.unimi.it/LSR/Search


\version "2.19.82"

% from snippet 197:
#(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))                   % filename

#(define basen (basename filen))

\header {
  %title = \markup { \filen }
  title = \markup { \basen }
}

{ c'1 }




reply via email to

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