denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] Script to add transpose Clarinet staff to existing mu


From: Richard Shann
Subject: Re: [Denemo-devel] Script to add transpose Clarinet staff to existing music
Date: Sun, 22 Sep 2019 16:20:17 +0100

On Sun, 2019-09-22 at 14:54 +0100, Joe Wilkinson wrote:
> Thanks. That works.
> 
> 1.... I don't get error messages because I don't have a command line 
> interface to receive them in Windows.
> 
> On 22/09/2019 12:42, Richard Shann wrote:
> > 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 -->") )
> 
> I don't get error messages; I probably need a window to receive them!
> > 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))
> 
> this does indeed give me the current setting of the Transpose
> Interval

yes, I gave you this rather roundabout way of getting to see the value
of an expression because I realized you couldn't see the terminal
output. Otherwise you would just put Transpose::Interval into the CLI
box of the Scheme window and hit return - the result of evaluating the
CLI is output to the terminal.
In the expression:

(d-InfoDialog (format #f "~s"Transpose::Interval))

the first procedure d-InfoDialog is a Denemo one, displaying a string
to the user and awaiting dismissal. The second procedure "format" is
built in to Scheme, it takes two or more arguments, the first says
where to output to (#f meaning "output to string") and the second "~s"
is a so-called "format string", where each ~s means that there will be
a further expression to be evaluated and substituted in the format
string. 
So this enables you to see output from Scheme expressions, but
unfortunately there is nothing to help you see the error message when
you throw an error :(

HTH

Richard




reply via email to

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