Hi Stefano,

unfortunately, it doesn't increment the counter globally, and the two ids
in the SVG file are identical

On Wed, Dec 18, 2019 at 12:12 AM Stefano Troncaro <stefanotronc...@gmail.com>
wrote:

> Hi Paolo,
>
> After some googling and tweaking I managed to make the counter you wished:
>
> \version "2.19.83"
>
> #(define* (make-counter #:optional (cnt 0) (inc 1))
>    (lambda ()
>      (set! cnt (+ cnt inc))
>      cnt))
>
> #(define serial (make-counter))
>
> token = -\tweak output-attributes #`((id . ,(string-append "foobar_"
> (number->string (serial))))) \etc
>
> \relative { c'4 d8 -\token [ e ] f -\token [ g ] c,4 }
>
> I will test your snippet for modifying beams later! Thank you for the work
> you are doing.
>
> Hope this helps!
> Stéfano
>
> El mar., 17 dic. 2019 a las 19:23, Paolo Prete (<paolopr...@gmail.com>)
> escribió:
>
>> In addition, Stefano, If you have time, please try the snippet for tuning
>> the beams (second attachment). Any test of these things are very helpful
>> for me.
>>
>> On Tue, Dec 17, 2019 at 11:18 PM Stefano Troncaro <
>> stefanotronc...@gmail.com> wrote:
>>
>>> Hi Paolo,
>>>
>>> Look at this:
>>>
>>> \version "2.19.83"
>>>
>>> token = -\tweak output-attributes #'((id . "foobar")) \etc
>>>
>>> \relative { c'4 d8 -\token [ e ] f2 }
>>>
>>> That achieves half of what you want. Now, how to make "foobar"
>>> automatically increment I don't know, perhaps someone else can help with
>>> that.
>>>
>>> Hope that helps!
>>> Stéfano
>>>
>>> El mar., 17 dic. 2019 a las 19:06, Paolo Prete (<paolopr...@gmail.com>)
>>> escribió:
>>>
>>>> Hello all,
>>>>
>>>> In order to automate the reverse process of the lilypond+javascript
>>>> snippets (write the GUI modifications of the grobs to the .ly file) I need
>>>> to make the following code work:
>>>>
>>>> %%%%%%%%%%%%%%%%%%%%%%%%%
>>>> token = \tweak output-attributes  #'((id . "foobar"))
>>>>
>>>> \score
>>>> {
>>>>    {
>>>>       a8 \token [ c' c' c']
>>>>    }
>>>> }
>>>>
>>>> %%%%%%%%%%%%%%%%%%%%%%%%%
>>>>
>>>> But it doesn't compile.
>>>> What's the right way to define the "token" variable?
>>>>
>>>> Note that I can compile on 2.19.84 (but not on 2.19.55) the following
>>>> code
>>>>
>>>> %%%%%%%%%%%%%%%%%%%%%%%%%
>>>>
>>>> \score
>>>> {
>>>>    {
>>>>       a8 \tweak output-attributes  #'((id . "foobar")) [ c' c' c']
>>>>    }
>>>> }
>>>>
>>>> %%%%%%%%%%%%%%%%%%%%%%%%%
>>>>
>>>> In addition: how can replace "foobar" with a global variable (string +
>>>> number) that is incremented at each call of "token"  ?
>>>> The ids must be: foobar_1, foobar_2  etc.
>>>>
>>>> Thanks,
>>>> Paolo
>>>>
>>>>
>>>>
>>>>
>>>>

Reply via email to