On Sun, 2019-09-22 at 12:09 +0100, Joe Wilkinson wrote: > > Hi Richard, > > I am trying to write a scheme script to automatically add a Clarinet > line below and to copy existing music. It needs to be transposed on > print up a tone. I'd rather it did not ask me each time for the > interval > with a dialogue box. > > I have played with the script from the Transpose on Print button, but > it > either gives me a dialogue box, if I leave it alone, or nothing > happens > if I change > > (set! Transpose::Interval (d-GetNoteNamesFromUser 2 > Transpose::Interval > (_ "--> Transpose to -->") ))) > > to > > (set! Transpose::Interval ( "c d" 2 Transpose::Interval (_ "--> > Transpose to -->") )))
without testing it looks like that should throw an error in Scheme when you try to set! the variable Transpose::Interval to the expression following, which is ( "c d" 2 Transpose::Interval (_ "-->> Transpose to -->") ) That expression can't evaluate to anything because the first thing in this list, the string "c d", is not a procedure - a list is evaluated by executing the first element with the following elements as parameters. It looks like you would mean to write (set! Transpose::Interval "c d") where the first element set! is a procedure that sets the second element (a variable) to the value of the third element (a string). > > I assume there is more to it than a simple kludge. Apart from > anything > else when the interval is changed the system remembers. Is > Transpose::Interval some sort of Global variable? Not sure, but it looks like it. Try evaluating (d-InfoDialog (format #f "~s" Transpose::Interval)) in the Scheme window to find out... But I don't think changing that value will help - what you need to do is create an example of this staff and then clone the staff directive(**) as a button to be clicked to apply that transposition to the current staff. Then you can copy(*) the Scheme script that this button executes and use it in your script to set the transposition of the current staff. Richard (*) right click the button and choose Get Script into Scheme Window (**) you will find the staff directives under the staff properties editor - click on the staff number right at the start of the staff. _______________________________________________ Denemo-devel mailing list Denemo-devel@gnu.org https://lists.gnu.org/mailman/listinfo/denemo-devel