Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
Custom Macro Messages (No Buttons)
Macros: Msg, MsgTitle, MsgStyle
Msg="Test Message" shows a simple custom macro message, replacing any prior message. Msg=" removes any prior message.
Macro commands can be used to control features of the message such as title, size, position, and colors. There are two general approaches for this: Explicit named commands such as MsgTitle, and extensions of the Msg macro that use the general format of Msg="<parameters". The latter is the same format used by Custom Meters. It is a bit more cryptic, but generally more powerful because it can use macro expressions instead of simple explicit values for the parameters. It is also the only way MIDI Changes scripts can control macro messages via the Output Display commands.
By default, Msg text is centered in the box, and has a title bar that just says "Macro Message" above the message text. MsgTitle="New Title" or Msg="<<New Title" changes it to "New Title". Titles may be up to 32 characters long, and will be used with subsequent Msg macros until specifically changed.
The message box is automatically sized to the message text. If the message is short, the title may be truncated. You can use MsgTitle= or Msg="<<" to specify an empty title bar.
MsgStyle=TC or Msg="<sTC" is the default message style, where T specifies Title and C specifies Centered. Other options besides Centered are R for Right-justified and L for Left. So, for example MsgStyle=L or Msg="<sL" will show Left-justified text but no Title.
A message without a Title bar has no "handle" to allow the user to drag it to another position. This makes it a good choice to place near a specifc Label, Field, or control as an operator prompt. There are separate position macros for messages with and without titles.
On the other hand you may want to have a title bar and allow dragging, but not allow the user to close the message until some event is detected. This might be true while waiting for a key with WaitKey. You can add a lowercase x to the style options, such as MsgStyle=TCx or Msg="<sTCx", which will show a draggable title bar without the [X] at the upper right to close the message. Don't forget to restore the [X] afterward by setting a style without the x option letter.
Msg text can span multiple lines by using a single pair of quotes to surround the entire message:
MsgStyle=TC ;Title, Center MsgTitle="Test Steps" Msg="1) Select Frequency. 2) Set SPL. 3) Hit StartTest." ;End of 3-line Msg
Note the comments on the first and last lines of the above macro. Comments can't be used within the message quotes, or they will be shown as part of the message.
Msg="1) Set Frequency to ." +F +n +_ ;Start of Msg +"2) Set SPL." +n +_ ;2nd line of Msg +"3) Hit StartTest." ;End of 3-line Msg
String expressions can also use Msg on the right side to append the current message to a string, as in Notes=Notes + Msg. You can also append a string or value to the end of an existing message as in Msg=Msg + UX. (Here the value of UX would be appended without an intervening space... you may prefer Msg=Msg + " " + UX.)
Note that when Msg is used to request that the operator change some Daqarta control or enter data, the WaitChange command can suspend macro processing until that action has taken place.
In the Macro Examples and Mini-Apps included with Daqarta you may notice that each macro definition begins with a comment like like ;<Help=H4900. That sets the Help topic that will be opened by clicking the Help button in the main macro dialog, or in the Edit dialog, for that specific macro.
In addition, that same Help topic will be opened by right-clicking anywhere in any Msg box that the macro may display. However, there may be rare occasions when you want a message box to be linked to a different Help topic. One example might be a message that suggests closing the running macro and running another instead. In that case, just before the message is shown you would use a command like Msg="<H490D", which in this case would open the Help topic for the File Navigator mini-app.
Otherwise, in macros that you write yourself, you probably won't have the initial Help comment line. Likewise, you probably won't need to open Help topics for other mini-apps so you won't be using the above command. Right-clicking the message box will instead open this Custom Macro Messages topic.
To copy a displayed message to the Windows Clipboard, left-click anywhere in the central region of the message window. This pops up a prompt allowing you to save the message to the Clipboard. CTRL+left-click saves it directly, without the prompt. SHIFT+left-click includes the title above the message. CTRL+SHIFT+left-click includes the title and omits the prompt.
The first format uses explicit commands like MsgColr and requires explicit parameter values. The second format uses an extension of the Msg command, plus a code character like C and parameters which may be expressions (except for Style).
Follow the links for detailed information on each command:
Title: MsgTitle="New Title" Msg="<<New Title" Message Style (T, C, L, R, x): MsgStyle=TC Msg="<sTC" Text Color: MsgColr="r,g,b" Msg="<C(r,g,b)" Background Color: MsgBkColr="r,g,b" Msg="<B(r,g,b)" Position re: Average button, in pixels: MsgPos="px,y" Msg="<P(x,y)" Position re: Average button, in dialog units: MsgPos="x,y" Msg="<D(x,y)" Untitled Fixed Position, in pixels: MsgPosFix="px,y" Msg="<p(x,y)" Untitled Fixed Position, in dialog units: MsgPosFix="x,y" Msg="<d(x,y)" Font Height, pixels (0-1000): MsgFont=n Msg="<F(n)" Font Weight (Boldness) (0-1000): MsgWeight=n Msg="<W(n)" Italic Mode (0 or 1): MsgItalic=n Msg="<i(n)" Font Family (0-3): MsgFamily=n Msg="<f(n)" Vertical White Space (0-100): Msg="<v(n)" Horizontal White Space (0-100): Msg="<h(n)"
The Msg command is not intended for really high speeds. Each time it is updated the entire trace display area is redrawn as well. This can greatly reduce the speed of a tight macro loop.
The default Trace Update interval is 10 milliseconds (100 updates per second), so Msg speed only becomes a concern at much higher rates. Since your vision can't even follow values that change at a 100 Hz update rate, what possible need could there be for displaying messages even faster?
One such case can arise when debugging a macro that you are creating or modifying. For example, if the macro has several alternative pathways and you want to know which ones are being taken, and how often, you can increment a different macro variable in each branch, and display it as soon as it changes. This is equivalent to the ancient but tried-and-true "Print statement" method of debugging
If you are debugging live real-time data, such as watching for a particular sound card input event between normal triggered trace updates, using Msg to do this can be much too slow.
The fastest alternative is usually to update a different Daqarta Field for each branch variable. For example, if the variable for the first branch is U1, you can use:
U1=U1 + 1 Field1=U1
If you need more than 6 variables, you can write to their Labels as well to gain 6 more.
A somewhat slower alternative that allows larger displays (with adjustable size) is to use Custom Meters Mtr0 through Mtr3.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2020 by Interstellar Research
All rights reserved