Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
Macro Message Boxes (With Buttons)
Macros: WaitMsg, WaitMsgTitle, WaitMsgType, WaitMsgAns
WaitMsg="Click OK to resume macro..." shows a standard Windows message box with an 'OK' button. After the message is shown, macro processing halts until the user responds to the message. If the message had multiple buttons (see below), you can query to find out which one the user clicked on.
Macro commands given before the main WaitMsg can be used to control features of the message such as title, number of buttons, default button, and icon. There are two general approaches for this: Explicit named commands such as WaitMsgTitle, and extensions of the WaitMsg macro that use the general format of WaitMsg="<parameters". The latter is the same format used by Custom Meters, and is also allowed by the non-button Msg macro.
WaitMsg has a default title bar that shows "Macro Wait" above the message text. WaitMsgTitle="New Wait Title" or WaitMsg="<<New Wait Title" changes it to "New Wait Title". WaitMsgTitle= or WaitMsg="<<" specifies an empty title bar. Titles may be up to 64 characters long, and will be used with subsequent WaitMsg macros until specifically changed.
You can change WaitMsg features with WaitMsgType or WaitMsg="<tparameters". The default is WaitMsgType=O or WaitMsg="<tO" for OK. You can choose an icon for the message, the number and type of buttons, and the default button (the one that is chosen by just hitting the Enter key) by including a character from each of these groups:
So, for example WaitMsgType=EX2 or WaitMsg="<tEX2" will show subsequent WaitMsg text with an Exclamation point icon and Yes, No, Cancel buttons, with the No button the default.
For the Macro Examples and Mini-Apps included with Daqarta that use WaitMsg, there is also a separate Help button that appears to the right of the other buttons. Clicking it will open the specific Help topic for that particular macro. Since there is no way for users to write and integrate their own Help topics, this is not an option for user-written macros.
However, as noted previously, you can use Msg messages (or Mtr0 to Mtr3 Custom Meters) to display your custom help.
WaitMsg is used to wait for a response from the user. If it is just to have the user confirm that he has read the message, the default OK type can be used. Macro processing will stop after the WaitMsg command until the OK button is clicked or the message box is dismissed with the [x] button, then proceed with the next macro command:
WaitMsg="1) Attach electrodes to monster. 2) Raise platform. 3) Turn dial to 'Danger'. 4) Click 'OK' to proceed..." @_Reanimate
The above example shows a multi-line message (note the quote marks at the beginning and end), then waits for 'OK' before running the Reanimate macro. (You can also show multi-line messages using line continuation and string expression methods.)
If you ask the user to make a decision, such as with a Yes/No message, you can provide different macro actions based upon the response. The WaitMsgAns command is used in an IF statement to obtain a number corresponding to the user action:
WaitMsgType=EY2 ;!, Yes/No, No default WaitMsg="Ignore Reactor Warning Alarm?" IF.WaitMsgAns=6 ;6=YES @_MaxPower ELSE. @_ShutDown ENDIF.
The possible response values (depending on message type) are:
To copy a displayed WaitMsg message to the Windows Clipboard, hit CTRL+C while the message window has focus (after it is displayed, without clicking on another non-Daqarta application). This copies the entire message, including the title and button text.
This utilizes a standard Windows feature that was first introduced in Windows 2000. It is available in Windows XP, Vista, and Windows 7, 8, and 10 but not in Windows 98 or earlier.
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