<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ice-online.com/index.php?action=history&amp;feed=atom&amp;title=MESSAGE</id>
	<title>MESSAGE - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ice-online.com/index.php?action=history&amp;feed=atom&amp;title=MESSAGE"/>
	<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=MESSAGE&amp;action=history"/>
	<updated>2026-04-09T15:54:05Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.ice-online.com/index.php?title=MESSAGE&amp;diff=823&amp;oldid=prev</id>
		<title>ConvertBot: send or get a message to/from a message queue</title>
		<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=MESSAGE&amp;diff=823&amp;oldid=prev"/>
		<updated>2020-04-27T22:05:08Z</updated>

		<summary type="html">&lt;p&gt;send or get a message to/from a message queue&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;send or get a message to/from a message queue&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;FUNC&amp;gt;      function to perform [QUERY]&lt;br /&gt;
&amp;lt;ID&amp;gt;        message queue ID&lt;br /&gt;
&amp;lt;MSG&amp;gt;       name of message object (to be) stored in results table&lt;br /&gt;
&amp;lt;NAME&amp;gt;      message name&lt;br /&gt;
&amp;lt;INFO&amp;gt;      message info field&lt;br /&gt;
&amp;lt;DATA&amp;gt;      message data object&lt;br /&gt;
&lt;br /&gt;
Keyword-Only Parameters:&lt;br /&gt;
[FROM]     sender object template&lt;br /&gt;
[QUALS]    Additional message qualifiers for SEND and REPLACE function.&lt;br /&gt;
                                                         (Since NeXtMidas 2.7.2)&lt;br /&gt;
&lt;br /&gt;
The MESSAGE intrinsic performs numerous message handling functions at the macro&lt;br /&gt;
level according to the value of &amp;lt;FUNC&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Not all parameters are required with every &amp;lt;FUNC&amp;gt;. Common command variations&lt;br /&gt;
include:&lt;br /&gt;
    0. MESSAGE SEND[x] &amp;lt;ID&amp;gt;  &amp;lt;MSG&amp;gt;&lt;br /&gt;
    1. MESSAGE SEND[x] REPLY &amp;lt;MSG&amp;gt;&lt;br /&gt;
    2. MESSAGE SEND[x] &amp;lt;ID&amp;gt;   , ,  &amp;lt;NAME&amp;gt; &amp;lt;INFO&amp;gt; &amp;lt;DATA&amp;gt;&lt;br /&gt;
    3. MESSAGE SEND[x] &amp;lt;ID&amp;gt;  NAME=&amp;lt;NAME&amp;gt; INFO=&amp;lt;INFO&amp;gt; DATA=&amp;lt;DATA&amp;gt;&lt;br /&gt;
    4. MESSAGE GET     , ,   &amp;lt;MSG&amp;gt;&lt;br /&gt;
    5. MESSAGE GET[x]  , ,   &amp;lt;MSG&amp;gt; &amp;lt;NAME&amp;gt;  FROM=  /WAIT=&lt;br /&gt;
    6. MESSAGE PASS    &amp;lt;ID&amp;gt;  &amp;lt;MSG&amp;gt;&lt;br /&gt;
    7. MESSAGE PRUNE   , ,   &amp;lt;MSG&amp;gt;&lt;br /&gt;
    8. MESSAGE SYNC    &amp;lt;ID&amp;gt;&lt;br /&gt;
    9. MESSAGE QUERY&lt;br /&gt;
&lt;br /&gt;
Of the above options, the two most common are #2 and #3 are the most commonly&lt;br /&gt;
used with #2 seen more in older code and #3 seen more in newer code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ID&amp;gt; is the id value given to a target primitive as specified by the /ID=&amp;lt;id&amp;gt;&lt;br /&gt;
switch on the primitive's command line. The id name can a string of any length&lt;br /&gt;
composed of letters, numbers, or the underscore (e.g. &amp;quot;MAP&amp;quot;, &amp;quot;WORLD_MAP&amp;quot;, etc.).&lt;br /&gt;
The use of numeric-only ids (e.g. &amp;quot;7&amp;quot;) is discouraged, except when running an&lt;br /&gt;
X-Midas host primitive via XBC (X-Midas required numeric ids). The id of &amp;quot;MAIN&amp;quot;&lt;br /&gt;
is reserved for the macro that created the local registry. The list of active&lt;br /&gt;
ids can be seen via the REGISTRY command. The id of &amp;quot;REPLY&amp;quot; is reserved for the&lt;br /&gt;
macro to respond back to the sender of the message.&lt;br /&gt;
&lt;br /&gt;
Messages can be sent to:&lt;br /&gt;
    &amp;quot;&amp;lt;id&amp;gt;&amp;quot;        - A command in the macro's registry with /ID=&amp;lt;id&amp;gt; or &amp;quot;MAIN&amp;quot;&lt;br /&gt;
                    for the macro itself.&lt;br /&gt;
    &amp;quot;GLOBAL.&amp;lt;id&amp;gt;&amp;quot; - A command in the global registry.    (Since NeXtMidas 3.3.0)&lt;br /&gt;
    &amp;quot;PARENT.&amp;lt;id&amp;gt;&amp;quot; - A command in the macro's parent's registry or &amp;quot;PARENT.MAIN&amp;quot;.&lt;br /&gt;
                    for the parent macro itself.         (Since NeXtMidas 3.3.0)&lt;br /&gt;
    &amp;quot;XM.&amp;lt;id&amp;gt;&amp;quot;     - The X-Midas global message queue slot number &amp;lt;id&amp;gt;. Note that&lt;br /&gt;
                    this only works when using NeXtOpt; XBC is not restricted to&lt;br /&gt;
                    use of slots in a global message queue and can send messages&lt;br /&gt;
                    directly to X-Midas host primitives.&lt;br /&gt;
    ----------------------------------------------------------------------------&lt;br /&gt;
    &amp;quot;REPLY&amp;quot;       - Sends a reply back to a sender, with optional alteration of&lt;br /&gt;
                    the &amp;lt;NAME&amp;gt;, &amp;lt;INFO&amp;gt;, and &amp;lt;DATA&amp;gt; fields. (&amp;lt;MSG&amp;gt; is required&lt;br /&gt;
                    when &amp;quot;REPLY&amp;quot; is used since MESSAGE it bypasses the normal&lt;br /&gt;
                    registry ID look-up and uses the &amp;lt;MSG&amp;gt;.FROM object as the&lt;br /&gt;
                    destination in this situation, unlike the above options&lt;br /&gt;
                    REPLY only works with the MESSAGE command.)&lt;br /&gt;
    THIS.MSGID    - The registered message handler for this macro as set by the&lt;br /&gt;
                    /MSGID= switch when the macro was called. This is used as a&lt;br /&gt;
                    generic way to send messages back to target message handler&lt;br /&gt;
                    for this macro.                      (Since NeXtMidas 3.3.1)&lt;br /&gt;
&lt;br /&gt;
A message object has the following fields:&lt;br /&gt;
    S: msg.name  the name of the message&lt;br /&gt;
    S: msg.tid   the ID of the message recipient (read-only convenience field)&lt;br /&gt;
    S: msg.fid   the ID of the message sender (read-only convenience field)&lt;br /&gt;
    L: msg.info  message-specific information encoded in an integer&lt;br /&gt;
    O: msg.data  the data object, often a table containing multiple values&lt;br /&gt;
    O: msg.to    the object/command of the message recipient&lt;br /&gt;
    O: msg.from  the object/command of the message sender&lt;br /&gt;
    O: msg.quals the message qualifiers object, often null or a table containing&lt;br /&gt;
                 multiple key/values (since NeXtMidas 2.7.2)&lt;br /&gt;
&lt;br /&gt;
Normally messages sent to a macro are written to a result named MSG and&lt;br /&gt;
processed by the processMessage procedure (see the &amp;quot;NeXtMidas Training&amp;quot; for&lt;br /&gt;
detailed discussion and examples of using processMessage). The MESSAGE command's&lt;br /&gt;
GET[x] function is for special handling and rarely used.&lt;br /&gt;
&lt;br /&gt;
There are several reserved &amp;lt;NAME&amp;gt; values that should not be used, as they can&lt;br /&gt;
cause unexpected behavior in your macro, including:&lt;br /&gt;
    ERROR&lt;br /&gt;
    EXEC&lt;br /&gt;
    EXIT&lt;br /&gt;
    MACRO&lt;br /&gt;
&lt;br /&gt;
Due to legacy behavior, a few messages have special behavior when sent to RMIF,&lt;br /&gt;
including:&lt;br /&gt;
    ADDR - Messages sent to RMIF with this &amp;lt;NAME&amp;gt; are treated as a SENDW&lt;br /&gt;
    OPEN - Messages sent to RMIF with this &amp;lt;NAME&amp;gt; are treated as a SENDW&lt;br /&gt;
&lt;br /&gt;
Special note for XBC users:&lt;br /&gt;
    When using XBC to send messages to/from host primitives the &amp;lt;DATA&amp;gt; will be a&lt;br /&gt;
    Table matching the structure of a configured message or a Table with the&lt;br /&gt;
    values for an unconfigured message. Unconfigured messages need to be sent&lt;br /&gt;
    with TYPE= and ARGS= specified. See the XBC section in the &amp;quot;NeXtMidas User's&lt;br /&gt;
    Guide&amp;quot; for more details. Be sure to set /MSGID=MAIN for the host primitive&lt;br /&gt;
    in order to see the messages in the macro.&lt;br /&gt;
&lt;br /&gt;
Functions:&lt;br /&gt;
  SEND[xwr]   send a message to a message queue&lt;br /&gt;
                SYNTAX:&lt;br /&gt;
                    MESSAGE SEND &amp;lt;ID&amp;gt;  , ,    &amp;lt;NAME&amp;gt;   &amp;lt;INFO&amp;gt;   &amp;lt;DATA&amp;gt;  [QUALS=]&lt;br /&gt;
                    MESSAGE SEND , ,   &amp;lt;MSG&amp;gt; [&amp;lt;NAME&amp;gt;] [&amp;lt;INFO&amp;gt;] [&amp;lt;DATA&amp;gt;] [QUALS=]&lt;br /&gt;
                    MESSAGE SEND REPLY &amp;lt;MSG&amp;gt; [&amp;lt;NAME&amp;gt;] [&amp;lt;INFO&amp;gt;] [&amp;lt;DATA&amp;gt;] [QUALS=]&lt;br /&gt;
&lt;br /&gt;
                - Appending an 'X' causes the message handler to send the&lt;br /&gt;
                  message directly from the current thread, bypassing the&lt;br /&gt;
                  message queue. The handler may put it on its own queue so&lt;br /&gt;
                  this does not guarantee execution of the message.&lt;br /&gt;
&lt;br /&gt;
                - Appending a 'W' causes the command to wait for a maximum time&lt;br /&gt;
                  given in seconds by the value of the /WAIT switch for the&lt;br /&gt;
                  message to be executed. If no /WAIT switch is present, it&lt;br /&gt;
                  defaults to one second. This is the same as following a SEND&lt;br /&gt;
                  with a SYNC.&lt;br /&gt;
&lt;br /&gt;
                - Appending a 'R' causes the command to try to replace first&lt;br /&gt;
                  matching message (name and from) in queue with this message.&lt;br /&gt;
                  If not found, then message is sent normally.&lt;br /&gt;
                  Note, that option 'X' to send message directly to the handler&lt;br /&gt;
                  takes precedence over this and hence cannot be used with this&lt;br /&gt;
                  replace option. If the message was replaced, the replaced&lt;br /&gt;
                  message is put back into results named specified by &amp;lt;MSG&amp;gt;.&lt;br /&gt;
                                                         (Since NeXtMidas 3.3.0)&lt;br /&gt;
&lt;br /&gt;
  GET[wnf]    read a message from a message queue&lt;br /&gt;
                SYNTAX:&lt;br /&gt;
                    MESSAGE GET , , &amp;lt;MSG&amp;gt;&lt;br /&gt;
                    MESSAGE GET , , &amp;lt;MSG&amp;gt; &amp;lt;NAME&amp;gt;  FROM=  /WAIT=&lt;br /&gt;
&lt;br /&gt;
                - Appending a 'W' causes the command to wait for a maximum time&lt;br /&gt;
                  given in seconds by the value of the /WAIT switch before&lt;br /&gt;
                  timing out.&lt;br /&gt;
&lt;br /&gt;
                - Appending an 'N' forces the next message to be fetched to&lt;br /&gt;
                  match &amp;lt;NAME&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                - Appending an 'F' forces the next message to be fetched to&lt;br /&gt;
                  match FROM=&lt;br /&gt;
&lt;br /&gt;
  PASS        Pass a message to a different message queue&lt;br /&gt;
                SYNTAX: MESSAGE PASS &amp;lt;ID&amp;gt; &amp;lt;MSG&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  PRUNE       Purge messages in the queue&lt;br /&gt;
                SYNTAX: MESSAGE PRUNE , , &amp;lt;MSG&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  QUERY       Report owner and availability of command's message queue&lt;br /&gt;
                SYNTAX: MESSAGE QUERY&lt;br /&gt;
&lt;br /&gt;
  REPLACE     Replaces matching message (name and from) in the queue with &amp;lt;MSG&amp;gt;&lt;br /&gt;
                SYNTAX:&lt;br /&gt;
                    MESSAGE REPLACE , , &amp;lt;MSG&amp;gt;&lt;br /&gt;
                    MESSAGE REPLACE &amp;lt;ID&amp;gt; , , &amp;lt;NAME&amp;gt; &amp;lt;INFO&amp;gt; &amp;lt;DATA&amp;gt; [QUALS=]&lt;br /&gt;
&lt;br /&gt;
              Replaced message is put back into results named &amp;lt;MSG&amp;gt;, null if no&lt;br /&gt;
              message was replaced.                      (Since NeXtMidas 3.3.0)&lt;br /&gt;
&lt;br /&gt;
  SYNC        Put a null message on a queue and wait for it to be processed&lt;br /&gt;
                SYNTAX: MESSAGE SYNC &amp;lt;ID&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  More than one suffix letter can be appended to a given SEND or GET command.&lt;br /&gt;
  For example, GETW waits for a message to arrive, and GETN means that the&lt;br /&gt;
  message must have a specific name.  Therefore GETWN means to wait until a&lt;br /&gt;
  message with a specific name arrives.&lt;br /&gt;
&lt;br /&gt;
  In most cases, the MESSAGE intrinsic quietly ignores stray characters&lt;br /&gt;
  following the &amp;lt;FUNC&amp;gt; values shown above; however, dependence on this fact is&lt;br /&gt;
  discouraged to minimize the chance of future macro breakage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
  1. Get the next message off the macro queue:&lt;br /&gt;
        nM&amp;gt; message GET ,, msg&lt;br /&gt;
&lt;br /&gt;
     The message fields are now accessible from the macro language using the&lt;br /&gt;
     standard syntax for keyable objects:&lt;br /&gt;
        nM&amp;gt; say &amp;quot;Got a ^msg.name message from ^msg.fid&amp;quot;&lt;br /&gt;
        nM&amp;gt; say &amp;quot; the info is ^msg.info and data is ^msg.data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  2. Send a message to another primitive, use the /ID= of the receiving&lt;br /&gt;
     primitive:&lt;br /&gt;
        nM&amp;gt; plot/id=plot1 ...&lt;br /&gt;
        nM&amp;gt; message send &amp;quot;PLOT1&amp;quot; ,, &amp;quot;OPENFILE&amp;quot; 1 mapdata&lt;br /&gt;
&lt;br /&gt;
  3. To pass a zoom message from one plot to another:&lt;br /&gt;
        nM&amp;gt; message get ,, msg &amp;quot;ZOOM&amp;quot;&lt;br /&gt;
        nM&amp;gt; if msg.tid eqs &amp;quot;PLOT1&amp;quot; then&lt;br /&gt;
        nM&amp;gt;   set msg.name &amp;quot;ZOOMX&amp;quot;&lt;br /&gt;
        nM&amp;gt;   message pass &amp;quot;PLOT2&amp;quot; msg&lt;br /&gt;
        nM&amp;gt; endif&lt;br /&gt;
&lt;br /&gt;
Switches:&lt;br /&gt;
  /WAIT=&amp;lt;n&amp;gt;     Max number of seconds to wait in GETW (indefinitely if &amp;lt; 0).&lt;br /&gt;
                SENDW wait time &amp;lt; 0 means no wait. [GETW DEF=0; SENDW DEF=1.0]&lt;br /&gt;
  /XMTYPE=&amp;lt;s&amp;gt;   Specifies the message type to use if sending the message&lt;br /&gt;
                to X-Midas (this is ignored for normal NeXtMidas messaging).&lt;br /&gt;
                Options include:&lt;br /&gt;
                  NEXTMIDAS    - Normal NeXtMidas message.&lt;br /&gt;
                  CONFIGURED   - Configured X-Midas message.&lt;br /&gt;
                  UNCONFIGURED - Un-configured X-Midas message.&lt;br /&gt;
                  AUTO         - Automatic configured or un-configured X-Midas&lt;br /&gt;
                                 message. (default)&lt;br /&gt;
&lt;br /&gt;
See Also: SENDTO, REGISTRY, nxm.sys.lib.Message&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:NXM_Explain]]&lt;/div&gt;</summary>
		<author><name>ConvertBot</name></author>
		
	</entry>
</feed>