lilypond-user
[Top][All Lists]
Advanced

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

Re: AppleScript on OSX


From: Jacob Rus
Subject: Re: AppleScript on OSX
Date: Mon, 18 Dec 2006 13:58:36 -0500
User-agent: Thunderbird 3.0a1 (Macintosh/20060706)

Mats Bengtsson wrote:
> Aaron Mendez wrote:
>> I am a 100% newbie, having just discovered LilyPond last week, but
>> a big see future for it in my work. I would like to request that
>> minimal AppleScriptability be implemented at an appropriate time. I
>> will probably be coding my .ly files in BBEdit or TextWrangler

See "Notes for the MacOS X app" and "Editor support" in the manual.
If you search the mailing list archives, you will find that people have
done these things for lots of different editors and I recall having seen
BBEdit mentioned, for example.

  /Mats

This is the command we're using to run lilypond in TextMate:

    #!/bin/bash

    . "${TM_SUPPORT_PATH}/lib/webpreview.sh"
    html_header 'Engrave & View' "$TM_FILENAME"
    echo '<h2>Engraving…</h2>'

: ${TM_LILYPOND:="$(find_app Lilypond.app)/Contents/Resources/bin/lilypond"}
    [[ ! -f "$TM_LILYPOND" ]] && TM_LILYPOND=lilypond

    if ! type >/dev/null -p "$TM_LILYPOND"; then
       echo "Error locating lilypond on your system."
       exit
    fi

    cd "$TM_DIRECTORY"
    "$TM_LILYPOND" "$TM_FILENAME" | pre

    if [[ -f "${TM_FILEPATH%.*}.pdf" ]];
       then echo "Opening PDF…"; open "${TM_FILEPATH%.*}.pdf"
       else echo "Error generating PDF file."
    fi

This could easily be adapted to work with BBEdit, though you'll have to take some care with the `TM_*` variables. Basically this command sets `TM_LILYPOND` to be the lilypond tool inside the .app bundle, if it isn't otherwise set, then it compiles the document (`TM_FILEPATH`), and then opens the result in the default pdf viewer. The other issue is TextMate's `find_app` command-line tool. You could either hardcode the path to lilypond.app, you could use some other method (an applescript would work, though it's awfully slow), or you could just download the `find_app` tool from TextMate's svn repository:

source: http://macromates.com/svn/Bundles/trunk/Tools/find_app/
binary: http://macromates.com/svn/Bundles/trunk/Support/bin/find_app

Or, of course, you could try out TextMate. The bundle is still far from complete, but it's pretty useful as is, and far more integrated than BBEdit/TextWrangler is ever likely to be. ;)

-Jacob





reply via email to

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