On 22 April 2018 at 00:48, Urs Liska <[email protected]> wrote:

>
>
> Am 21.04.2018 um 14:54 schrieb Gianmaria Lari:
>
>
>
> On 21 April 2018 at 09:44, Gianmaria Lari <[email protected]> wrote:
>
>> On 21 April 2018 at 08:39, Urs Liska <[email protected]> wrote:
>>
>>>
>>>
>>> Am 20.04.2018 um 23:06 schrieb Gianmaria Lari:
>>>
>>> When I want to try a lilypond snippet using Frescobaldi, I normally
>>> create a new file and I compile it without save it explicitly. Frescobaldi
>>> saves it for me in a temporary folder (in my Frescobaldi settings I have
>>> "Save the document if possibile" checked).
>>>
>>> For example if I do it now, in the lilypond log window I read:
>>>
>>> Starting lilypond-windows.exe 2.19.81 [Untitled (4)]... Processing 
>>> `*C:/Users/GIANMA~1/AppData/Local/Temp/frescobaldi-n5pqsywf/tmp0fvvk0ae/document.ly
>>> <http://document.ly>*' Parsing... Interpreting music... Preprocessing
>>> graphical objects... Interpreting music...
>>>
>>> .....
>>>
>>> So the termporary path where it is saving my lilypond source is
>>>
>>>   C:/Users/GIANMA~1/AppData/Local/Temp/frescobaldi-n5pqsywf/tmp0fvvk0ae/
>>> document.ly
>>>
>>>
>>> I'm writing a small program that make some processing on the lilypond
>>> source file and the pdf/png file and I would need this path information.
>>> Does Frescobaldi writes this path in any (log) file? Alternatively, is
>>> there any way to make Frescobaldi/lilypond writing the compile result in a
>>> file as well as in the lilypond log window?
>>>
>>>
>>> I'm not sure what you want to achieve here.
>>> It might be possible to access the information you are looking from
>>> through a Frescobaldi Snippet (which may be written in Python), but could
>>> you state more explicitly what your "small program" should be doing with
>>> your unsaved LilyPond code?
>>>
>>
>> (Just to be precise the code *is saved*; Frescobaldi do this
>> automatically when I compile the code. The problem is only to know where it
>> is saved.)
>>
>> The goal of my small application is save the snippet and the generated
>> score. When I press a shortcut key, the snippet source file and the png (or
>> pdf) is put online etc. etc.
>>
>> I can, of course, compile and manually copy and past the path I see in
>> the lilypond log window, but I would like to make this programmatically.
>>
>> Please let me know if I have been clear.
>> Thank you Urs, g.
>>
>
> Dear Urs,
>
> after your message I found in the Frescobaldi documentation the variable
> $FILE_NAME. This can be used in a snippet to get the full name (including
> path) of the file. Unfortunately it returns the document file name only if
> you previously explicitly saved the file. Uhm.... I think I will try
> something different.
>
> Thank you anyway!
> g.
>
>
> Yes, without looking again in the source code I assume that $FILE_NAME
> accesses the corresponding property of the text editor. And that only has a
> file name when the document is actually a file on disk. The temporary file
> name used for compiling unsaved scores is generated in a totally different
> location (of the Frescobaldi code).
>
> I don't have the time to really think this through this weekend.
> But I still don't fully understand why you don't want to save the score to
> an explicit file. I assume that at one point, e.g. when you deploy files to
> a web server you will have to use some fixed files and filenames, don't you?
>

Yes absolutely, this is the alternative that I decided to follow when
discover the issue with the temporary file name!




> Given what I see so far I would do the following:
>
>    - Save the LilyPond code to some explicit file
>    - Have a Frescobaldi snippet with keyboard shortcut that will trigger
>    some external script and pass that script the file name.
>    - This external script can do everything you need with the LilyPond
>    code.
>
> Is that suggestion of any help?
>
Yes Urs this is exactly what I intended to do.

I'm not yet there so I didn't yet check the relative documentation. But I
would appreciate if you could give me some hints for later about the
following things:

- How to make a frescobaldi snippet run an external application
- How can I put some text in the clipboard using a snippet?

Thank you, g.
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to