If you'd like to learn something that you can use in LilyPond activity I
would suggest Java and/or the Java-like script language of jEdit, that
is BeanShell. In BeanShell you can actually write anything that you can
in Java, but can be more lazy. There are excellent Java Tutorials on the
net, like http://java.sun.com/docs/books/tutorial/
If you can afford a 120MB download and have a computer with quite much
memory, I suggest to download JDK 5.0 Update 9 with NetBeans 5.5 at
http://java.sun.com/j2se/1.5.0/download-netbeans.html
Java is a very powerful and versatile system (it's not just a language),
and one of the current standards of enterprise application programming.
Now, here is an example of a macro written in Java/BeanShell used in
LilyPondTool - it will set the score size. This will work only in jEdit
with installed LilyPondTool, because it uses LilyPondTool's and jEdit's
features. But you can see, that it's not too complicated.
firstAsset =
lilytool.macrohelp.MacroUtils.getFirstAsset(view).start.getOffset()); //
LilyPondTool finds the position of the first element in our LilyPond
source file
start=textArea.getLineStartOffset(textArea.getLineOfOffset(firstAsset);
// we find the position of the first character of the first element
textArea.setCaretPosition(start); // set the current caret position at start
size=Macros.input(view, "Global staff size:", "20"); // get the required
staff size from the user
if (size!=null) { // if something has inputted
text="#(set-global-staff-size "+size+")"; // this will be the text
we write
textArea.setSelectedText(text+"\n\n"); // we write the text into the
text area
textArea.setCaretPosition(start+text.length()); // set the caret
position after the newly inserted text
textArea.setSelection(new Selection.Range(start,
start+text.length())); // select the text we inserted
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user