lilypond-user
[Top][All Lists]
Advanced

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

Compile your .ly from BBEdit with this AppleScript


From: Basso Ridiculoso
Subject: Compile your .ly from BBEdit with this AppleScript
Date: Wed, 10 Aug 2011 11:47:13 -0700

I use BBedit, the great text editor for MacOS, for all of my editing of .ly files since it gives me things like grep, search and replace over a selection, keyboard shortcuts, and many many other features that make text editing more efficient. Highly recommended.

However, I grew tired of switching back and forth between Lilypond and BBedit to compile output, so I created this small script that lets you assign it a hot key and will compile the front most window using Lilypond from within BBedit.

This script will work with any application that lets you get the name and location of the front most window, but you will need to change that to match the program you are using yourself.

You also will need to add where your copy of Lilypond is (mine is in the applications folder) and this script currently puts the output .pdf file on the Desktop, where Preview then opens it.

To use this script:

1) Copy the text below
2) Paste into "Script Editor"
3) Change the path to your copy of Lilypond
4) Modify the output destination to another folder if you don't want it on the desktop.
5) Place the script in BBedits Scripts folder
6) Edit your file in BBedit and when you want to see the output, select the script

I assigned this script a keyboard command (shift-control-R) so I edit, hit that command, and in a few seconds, my output appears in Preview.

Lilypond does not even launch (the UI anyway). However, I still need to launch Lilypond with the file sometimes, since it offers better error reporting. Usually only at the beginning of a project, just to get the errors are ironed out.

I am trying to figure out how to get the console output of Lilypond back into BBedit, so any errors appear there and that will eliminate the need to have to launch the Lilyond app.

##################################################################

set TheOutputPath to the POSIX path of (path to desktop)
set ThelilyPath to POSIX path of "/Volumes/HD01/Applications/LilyPond.app/Contents/Resources/bin/lilypond -o  "

tell application "BBEdit"
   
    copy file of window 1 to TheFile
    copy name of window 1 to TheFilename
   
end tell


set TheUnixPath to the POSIX path of TheFile
set FinalPath to quoted form of the POSIX path of (TheOutputPath & TheFilename)

set TheCommand to ThelilyPath & FinalPath & " " & quoted form of the POSIX path of TheUnixPath

try
    do shell script TheCommand
end try

set TheOutputFile to TheOutputPath & TheFilename & ".pdf"

try
    do shell script "open " & quoted form of the POSIX path of TheOutputFile
end try

###############################################################################
--


Daniel

reply via email to

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