<?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=SWITCH</id>
	<title>SWITCH - 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=SWITCH"/>
	<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=SWITCH&amp;action=history"/>
	<updated>2026-04-09T15:59:01Z</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=SWITCH&amp;diff=850&amp;oldid=prev</id>
		<title>ConvertBot: Define static switches or get a switch value into a results parameter</title>
		<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=SWITCH&amp;diff=850&amp;oldid=prev"/>
		<updated>2020-04-27T22:05:17Z</updated>

		<summary type="html">&lt;p&gt;Define static switches or get a switch value into a results parameter&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Define static switches or get a switch value into a results parameter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;NAME&amp;gt;  Name of the switch&lt;br /&gt;
&amp;lt;VALUE&amp;gt; Switch value for SET; Switch value label for GET (default) and DEL&lt;br /&gt;
&amp;lt;FUNC&amp;gt;  Action to perform (GET[DEF], GETALL, SET, or DEL)&lt;br /&gt;
&amp;lt;DEF&amp;gt;   Default value if switch is not present&lt;br /&gt;
&amp;lt;SDEF&amp;gt;  Default value if only a state switch is present&lt;br /&gt;
&lt;br /&gt;
SWITCH is the mechanism by which macros define their own switches and branch&lt;br /&gt;
in response to switches.&lt;br /&gt;
&lt;br /&gt;
Functions:&lt;br /&gt;
  GET   - Gets a particular switch and stores its value in a result&lt;br /&gt;
&lt;br /&gt;
          Syntax:&lt;br /&gt;
            SWITCH &amp;lt;NAME&amp;gt; &amp;lt;VALUE&amp;gt; GET &amp;lt;DEF&amp;gt; &amp;lt;SDEF&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;NAME&amp;gt;  The name of the switch (e.g. &amp;quot;MYSWITCH&amp;quot;)&lt;br /&gt;
            &amp;lt;VALUE&amp;gt; The label of the result to store the value of the&lt;br /&gt;
                    switch in (e.g. &amp;quot;MYVALUE&amp;quot;)&lt;br /&gt;
            &amp;lt;DEF&amp;gt;   The default value if the switch is not specified&lt;br /&gt;
            &amp;lt;SDEF&amp;gt;  The default value to use if the switch is given as a&lt;br /&gt;
                    state switch (usually &amp;quot;true&amp;quot; or &amp;quot;1&amp;quot;). If not set,&lt;br /&gt;
                    the empty string (&amp;quot;&amp;quot;) will be used.&lt;br /&gt;
&lt;br /&gt;
  SET  - The SET function works the same as the GET, but has the effect of&lt;br /&gt;
         setting the highest precedence for the value of the switch. This was&lt;br /&gt;
         done to allow commands within a macro to NOT inherit values of&lt;br /&gt;
         designated switches. See example. (Since NeXtMidas 2.9.0)&lt;br /&gt;
&lt;br /&gt;
         Syntax:&lt;br /&gt;
            SWITCH &amp;lt;NAME&amp;gt; &amp;lt;VALUE&amp;gt; SET&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;NAME&amp;gt;  The name of the switch (e.g. &amp;quot;MYSWITCH&amp;quot;)&lt;br /&gt;
            &amp;lt;VALUE&amp;gt; The value to set the switch to, or the label of the&lt;br /&gt;
                    result containing the value&lt;br /&gt;
&lt;br /&gt;
  DEL  - The DEL function allows the user to delete any current value for the&lt;br /&gt;
         switch. This also allows for users to not inherit a values of&lt;br /&gt;
         designated switches, but does not set a value in turn.&lt;br /&gt;
         See example. (Since NeXtMidas 2.9.0)&lt;br /&gt;
&lt;br /&gt;
         Syntax:&lt;br /&gt;
            SWITCH &amp;lt;NAME&amp;gt; &amp;lt;VALUE&amp;gt; DEL&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;NAME&amp;gt;  The name of the switch (e.g. &amp;quot;MYSWITCH&amp;quot;)&lt;br /&gt;
            &amp;lt;VALUE&amp;gt; The label of the result to store the previous value of&lt;br /&gt;
                    the switch (since neXtMidas 3.1.3)&lt;br /&gt;
&lt;br /&gt;
  GETALL - Gets all switches and stores their values in a result. Note that&lt;br /&gt;
           this function works by looking at all switches passed in on the&lt;br /&gt;
           macro's command line rather than looking only for a pre-defined&lt;br /&gt;
           set of switches. (Since NeXtMidas 2.9.0)&lt;br /&gt;
&lt;br /&gt;
           Syntax:&lt;br /&gt;
             SWITCH ,, &amp;lt;VALUE&amp;gt; GETALL ,, &amp;lt;SDEF&amp;gt;&lt;br /&gt;
&lt;br /&gt;
             &amp;lt;VALUE&amp;gt; The name of the table to put the switches in. If the table&lt;br /&gt;
                     exists, the contents of the table will be used as default&lt;br /&gt;
                     values (like &amp;lt;DEF&amp;gt; with GET)&lt;br /&gt;
             &amp;lt;SDEF&amp;gt;  The default value to use if the switch is given as a&lt;br /&gt;
                     state switch (usually &amp;quot;true&amp;quot; or &amp;quot;1&amp;quot;). If not set,&lt;br /&gt;
                     the empty string (&amp;quot;&amp;quot;) will be used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In NeXtMidas, most switches can be tested in logical test directly, as with&lt;br /&gt;
&lt;br /&gt;
  if /C then&lt;br /&gt;
    ...&lt;br /&gt;
  else&lt;br /&gt;
    ...&lt;br /&gt;
  endif&lt;br /&gt;
&lt;br /&gt;
The same syntax works on numeric or string values, as with&lt;br /&gt;
&lt;br /&gt;
  if /FN eqs &amp;quot;MYFILE&amp;quot;&lt;br /&gt;
or&lt;br /&gt;
  if /N gt 4&lt;br /&gt;
&lt;br /&gt;
The switch statement is useful for applying defaults to switches that may&lt;br /&gt;
or may not be present, as with&lt;br /&gt;
&lt;br /&gt;
  switch FN fnlabel get &amp;quot;MYFILE&amp;quot;&lt;br /&gt;
or&lt;br /&gt;
  switch N nlabel get 20&lt;br /&gt;
&lt;br /&gt;
which applies the defaults &amp;quot;MYFILE&amp;quot; and 20 to those switches, if they are not&lt;br /&gt;
applied. String valued switches that supply the &amp;lt;SDEF&amp;gt; parameter will set the&lt;br /&gt;
value to &amp;lt;DEF&amp;gt; if the switch is not present, or &amp;lt;SDEF&amp;gt; if the switch is present&lt;br /&gt;
but no =value is given.&lt;br /&gt;
&lt;br /&gt;
SWITCH inheritance:&lt;br /&gt;
  1. Switches right after the command (no space in-between) are inherited by&lt;br /&gt;
     primitive and intrinsic commands called by the command. e.g.&lt;br /&gt;
     MYMACRO/ASWITCH arg1 arg2&lt;br /&gt;
&lt;br /&gt;
  2. Switches at END of argument list are the same as the above but they are&lt;br /&gt;
     also inherited by macro commands called by the command. e.g.&lt;br /&gt;
     MYMACRO arg1 arg2 /ASWITCH&lt;br /&gt;
&lt;br /&gt;
SWITCH precedence (order):&lt;br /&gt;
  1. Macro command line (passed in when macro is run)&lt;br /&gt;
  2. Commands (macros,primitives,intrinsics) in the macro&lt;br /&gt;
  3. Command dictionary (commands.cnf)&lt;br /&gt;
  4. Macro Defaults (on startmacro line)&lt;br /&gt;
     eg. startmacro/switch&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
  1. Set fnlabel to &amp;quot;NOFN&amp;quot; if no switch is present, or &amp;quot;MYFILE&amp;quot; if just /FN is&lt;br /&gt;
    present. If /FN=&amp;lt;text&amp;gt; is present, fnlabel will have the value of &amp;lt;text&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
      switch FN fnlabel get &amp;quot;NOFN&amp;quot; &amp;quot;MYFILE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  2. A switch command with its own switch has the effect of setting the default:&lt;br /&gt;
&lt;br /&gt;
       switch MYSW myres /MYSW=10&lt;br /&gt;
&lt;br /&gt;
  3. Allow child macro to see a pipes created in calling macro&lt;br /&gt;
&lt;br /&gt;
       mymacro/sharemask=pipes&lt;br /&gt;
&lt;br /&gt;
  4. Set the value of a switch regardless of what is passed in on the command&lt;br /&gt;
     line (ignore precedence):&lt;br /&gt;
&lt;br /&gt;
       switch name=&amp;quot;MYSWITCH&amp;quot;  value=15  func=set&lt;br /&gt;
&lt;br /&gt;
  5. Delete a current switch but store its value, if it exists.&lt;br /&gt;
&lt;br /&gt;
        switch name=&amp;quot;MYSWITCH&amp;quot; value=savedVal func=del&lt;br /&gt;
&lt;br /&gt;
  6. Get all switches passed to the macro&lt;br /&gt;
&lt;br /&gt;
        switch ,, mytable ,, GETALL ,, 1&lt;br /&gt;
&lt;br /&gt;
  7. Use the switches passed to the macro to override a set of defaults&lt;br /&gt;
&lt;br /&gt;
        set t:mytable {SWITCH1=&amp;quot;VALUE1&amp;quot;,SWITCH2=&amp;quot;VALUE2&amp;quot;}&lt;br /&gt;
        switch ,, mytable ,, GETALL ,, 1&lt;br /&gt;
&lt;br /&gt;
Switches:&lt;br /&gt;
  /CS     - Get a case-sensitive value (for FUNC=GET) without requiring user to&lt;br /&gt;
            quote strings.                                         (Since 3.1.2)&lt;br /&gt;
  /QUIET  - Disable verbose messages (overrides universal /VERBOSE switch).&lt;br /&gt;
                                                                   (Since 3.3.0)&lt;br /&gt;
&lt;br /&gt;
  Graphical Command Switches:&lt;br /&gt;
    Applies to anything that extends nxm.sys.lib.MWindow, like PLOT, LIST2,&lt;br /&gt;
      GCONTROLS, etc.&lt;br /&gt;
    /DISPLAY=       - Make window come up in specified display mode:&lt;br /&gt;
                        Icon, Back, Front, or Maximized.           (Since 3.1.1)&lt;br /&gt;
    /EVENTFILTER=   - Window event filter mask (e.g. NoMouse,NoKeyboard,NoMove,&lt;br /&gt;
                      NoPushPop,NoMiddleMouse). For complete list of values&lt;br /&gt;
                      see nxm.sys.libg.MWindow.eventFilterList.    (Since 3.3.1)&lt;br /&gt;
    /ICON           - Make window come up in icon state.           (Since 3.1.0)&lt;br /&gt;
    /NOALTTITLE     - Disables automatic updates to the status/title bar text&lt;br /&gt;
                      from events such as mouse hovers.            (Since 3.3.0)&lt;br /&gt;
    /NOPUSHPOP      - Disable window push/pop out/in of panel. The /EVENTFILTER=&lt;br /&gt;
                      switch takes precedence over this.&lt;br /&gt;
    /SHARETHEME     - Whether or not to have all graphical components share&lt;br /&gt;
                      the same Theme.                              (Since 3.3.0)&lt;br /&gt;
    /THEME=         - Specifies the THEME to use. See EXPLAIN LOOKANDFEEL.&lt;br /&gt;
    /WDISP=         - Specifies the Window DISPlay to use (i.e. specifies which&lt;br /&gt;
                      monitor for systems with 2+ monitors).&lt;br /&gt;
    /WFS=           - Window or widget font size.&lt;br /&gt;
    /WIN=           - Specifies the name of WINdow (or panel) in the registry&lt;br /&gt;
                      that will host this window. If the window name is not&lt;br /&gt;
                      specified, or included in panel config, a new frame is&lt;br /&gt;
                      is created.&lt;br /&gt;
    /WIN.&amp;lt;cmd&amp;gt;=     - Similar to /WIN.&lt;br /&gt;
    /WIN.NEW        - Always open in a new frame.&lt;br /&gt;
    /WPOS=(x,y,w,h) - Window position in pixels. Width and height are optional.&lt;br /&gt;
    /WTITLE=        - Window title.&lt;br /&gt;
&lt;br /&gt;
  Macro Switches:&lt;br /&gt;
    /MSGDEBUG=mask  - Enable debugging printout of messages processed (e.g.&lt;br /&gt;
                      received) by macro. Default for just specifying as a state&lt;br /&gt;
                      switch is NAME|INFO|DATA|QUALS|FID|TID.         [DEF=NONE]&lt;br /&gt;
                                                                   (Since 2.7.1)&lt;br /&gt;
    /SHAREMASK=     - Control whether or not a child macro (a macro called from&lt;br /&gt;
                      another macro) can see the parent's (calling macro) pipes.&lt;br /&gt;
                      Currently the only options are &amp;quot;PIPES&amp;quot;.         [DEF=NONE]&lt;br /&gt;
                                                                   (Since 2.7.3)&lt;br /&gt;
&lt;br /&gt;
  Pipe and File Switches:&lt;br /&gt;
    /AUX=           - Specifies which AUX to use for file. The {AUX=&amp;lt;aux_name&amp;gt;}&lt;br /&gt;
                      file qualifier takes precedence over this.&lt;br /&gt;
    /PS=            - Pipe Size in bytes. [DEF=131072]&lt;br /&gt;
    /TLL=           - TimeLine length [DEF=128]&lt;br /&gt;
    /TLT=           - TimeLine tolerance [DEF=0.1]&lt;br /&gt;
&lt;br /&gt;
  Universal Switches for all command (when handled by NeXtMidas proper):&lt;br /&gt;
    /BG             - Run command in BackGround. [DEF=FALSE]&lt;br /&gt;
    /CMDOPENTIMEOUT=- Provides a way for a command run in a pipe section to NOT&lt;br /&gt;
                      wait for a very slow open() to complete before running&lt;br /&gt;
                      the next command in the pipe section.&lt;br /&gt;
                      [DEF=-1 for effectively infinite] (Since NeXtMidas 2.7.4)&lt;br /&gt;
    /CMDRUNMODE=    - Provides a way for a command to override its default run&lt;br /&gt;
                      mode behaviors. An example of this is running a primitive&lt;br /&gt;
                      to completion in a pipe section. Possible values:&lt;br /&gt;
                        Default         - Use default behavior (this is the&lt;br /&gt;
                                          default)&lt;br /&gt;
                        RunToCompletion - Run command to completion rather than&lt;br /&gt;
                                          following the normal pipe section&lt;br /&gt;
                                          rules, note that this does override&lt;br /&gt;
                                          /BG. (Since NeXtMidas 3.5.4)&lt;br /&gt;
    /ID=            - Associate an ID to a command. Only primitive, host&lt;br /&gt;
                      primitive, or macro IDs are used for message passing,&lt;br /&gt;
                      entry in the registry, etc. [DEF=based on command name]&lt;br /&gt;
    /MSGID=         - Sets the ID of the registry entry that will process&lt;br /&gt;
                      messages sent by this command. Using /MSGID=MAIN will&lt;br /&gt;
                      send all messages to the macro's processMessage procedure.&lt;br /&gt;
                      [DEF=none]&lt;br /&gt;
    /POLL=          - Time (in seconds) between process loops (e.g. reads of a&lt;br /&gt;
                      file) when there are no data to process. [DEF=ENV.PAUSE]&lt;br /&gt;
    /VERBOSE        - Produce more screen (verbose) output. [DEF=FALSE in macro,&lt;br /&gt;
                      TRUE at shell prompt]&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>