<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Scripting Archives | DMC, Inc.</title>
	<atom:link href="https://static.dmcinfo.com/blog/tag/scripting/feed/index.xml" rel="self" type="application/rss+xml" />
	<link></link>
	<description></description>
	<lastBuildDate>Fri, 24 Jul 2026 19:09:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>

<image>
	<url>https://static.dmcinfo.com/wp-content/uploads/2025/04/site-icon-150x150.png</url>
	<title>Scripting Archives | DMC, Inc.</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Getting Started with WinCC OA: Part 8 &#8211; Libraries</title>
		<link>https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/</link>
		
		<dc:creator><![CDATA[Nick Leisle]]></dc:creator>
		<pubDate>Wed, 23 Oct 2019 11:47:40 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Libraries]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/</guid>

					<description><![CDATA[<p>Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, I recommend that you read the respective installments before proceeding: Now that we have a basic understanding of scripting and how to interact with datapoints, we’re ready to move beyond panel scripting environments and create globally accessible code. [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/">Getting Started with WinCC OA: Part 8 &#8211; Libraries</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, I recommend that you read the respective installments before proceeding:</p>



<ul class="wp-block-list">
<li><a href="/latest-thinking/blog/id/9870/getting-started-with-wincc-oa-part-1--creating-opening-a-project">Part 1: Creating and Opening a Project</a></li>



<li><a href="/latest-thinking/blog/id/9871/getting-started-with-wincc-oa-part-2--folder-structure-gedi-layout">Part 2: Folder Structure and Gedi Layout</a></li>



<li><a href="/latest-thinking/blog/id/9884/getting-started-with-wincc-oa-part-3--panels-the-basics">Part 3: Panels | The Basics</a></li>



<li><a href="/latest-thinking/blog/id/9893/getting-started-with-wincc-oa-part-4--panel-scripting-environments-and-quicktest">Part 4: Panel Scripting Environments and QuickTest</a></li>



<li><a href="/latest-thinking/blog/id/9906/getting-started-with-wincc-oa-part-5--scripting-syntax">Part 5: Scripting Syntax</a></li>



<li><a href="/latest-thinking/blog/id/9921/getting-started-with-wincc-oa-part-6--para-overview-and-datapoint-creation">Part 6: Para Overview and Datapoint Creation</a></li>



<li><a href="/latest-thinking/blog/id/9944/getting-started-with-wincc-oa-part-7--interacting-with-datapoints-via-scripting">Part 7: Interacting with Datapoints via Scripting</a></li>
</ul>



<p class="wp-block-paragraph">Now that we have a basic understanding of scripting and how to interact with datapoints, we’re ready to move beyond panel scripting environments and create globally accessible code. In Part 8 of “Getting Started with WinCC OA,” we’ll explore how we can use libraries to create globally accessible functions, enumerations, constants, etc.</p>



<h2 class="wp-block-heading" id="h-what-are-libraries">What are Libraries?</h2>



<p class="wp-block-paragraph">Control libraries are files that hold code that may be accessed by other scripts within a project. Simply put, they hold globally usable code. One may ask, “Why would we want to use libraries?”</p>



<p class="wp-block-paragraph">Libraries prevent developers from having to rewrite or copy/paste existing code, allow changes to be made quickly and efficiently, and ensure consistency within a project. Let’s jump back quickly to the example used in “Part 7: Interacting with Datapoints via Scripting.” Say we used the same enumeration “StatusType” in several panels in addition to the one we created.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/enum-status-type.png" alt="status type"/></figure>



<p class="wp-block-paragraph">Without libraries, we’d need to copy and paste this enumeration in all of our panels’ ScopeLibs for further use. If we wanted to alter the enumeration to:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/enum-alteration.png" alt="altering enumination"/></figure>



<p class="wp-block-paragraph">We’d need to remember every instance of where this function was used, go back in the code, and modify StatusType appropriately. When the number of places we use StatusType increases, the more re-work would be needed to make the change.</p>



<h2 class="wp-block-heading" id="h-how-are-libraries-made">How are Libraries Made?</h2>



<p class="wp-block-paragraph">To create a control library, simply right click “Libraries” in the project view tree and select “Add New CTRL Library.”</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/add-new-lib.png" alt="add new library"/></figure>



<p class="wp-block-paragraph">Anything created in the resulting .ctl file can be appropriately referenced throughout the program. To continue from Part 7&#8217;s example, we’ll generate two .ctl files: one for a global<strong> StatusType</strong> and another for <strong>device colors.</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/ctl-files.png" alt="ctl files"/></figure>



<p class="wp-block-paragraph"><strong>StatusType.ctl should contain:</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/statustype-ctl.png" alt="status type stl"/></figure>



<p class="wp-block-paragraph"><strong>ColorConst.ctl should have:</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/color-ctl.png" alt="color const ctl"/></figure>



<p class="wp-block-paragraph">None of these libraries do anything, however, if they’re not implemented within a program.</p>



<h2 class="wp-block-heading" id="h-how-is-library-content-implemented">How is Library Content Implemented?</h2>



<p class="wp-block-paragraph">Libraries are not initially accessible from a program’s script. The control library file must first be loaded into a project for it to be usable. To do so, you must implement the following line:</p>



<pre class="wp-block-code"><code>
	#uses &lt;.ctl file&gt;
</code></pre>



<p class="wp-block-paragraph">Once a control file is specified, a script may use any and all items within said .ctl file. To implement our control libraries within our example, we’ll modify our ScopeLib’s code as follows:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Python</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>#uses "StatusType"
#uses "ColorConst"

//=============================== Panel initialization =========================================
initializePanel()
{
  //Whenever rSpeed or rMaxSpeed changes, call the function "onSpeedChange"
  dpConnect("onSpeedChange", "myMotor.rSpeed", "myMotor.rMaxSpeed");

  //Whenever iStatus changes, call the function "onStatusChange"
  dpConnect("onStatusChange", "myMotor.iStatus");
}


//=============================== Text Field Command =========================================
//Textbox is selected and user keys "Enter"
void textboxCmd()
{
  //Assign the textbox's text value to rMaxSpeed
  dpSet("myMotor.rMaxSpeed", maxSpeedTextbox.text);
}


//=============================== On Speed / Max Speed Value Change =================================
void onSpeedChange(string speedDp, float speedValue, string maxSpeedDp, float maxSpeedValue)
{
  //Define the variable whose value will be assigned to iStatus
  int iStatusValue;

  //Determine what value to assign iStatusValue (and subsequently "myMotor.iStatus")
  switch (speedValue)
  {
    //If "myMotor.rSpeed" is 0, set iStatusValue to 0
    case 0:
      iStatusValue = (int)StatusType::Stopped;
      break;

    //Otherwise, if "myMotor.rSpeed" > "myMotor.rMaxSpeed", set iStatusValue to Estop status int
    //           if not, set iStatusValue to Forward status int
    default:
      iStatusValue = (speedValue >= maxSpeedValue) ? (int)StatusType::Estop : (int)StatusType::Forward;
      break;
  }

  //Assign iStatusValue's value to "myMotor.iStatus"
  dpSet("myMotor.iStatus", iStatusValue);

  //Set the maxSpeedTextbox and speedTextbox's test to their respective values
  //NOTE: dpValToString ensures the units we assigned earlier in the series are displayed.
  //      Simply using &lt;Textbox>.text = &lt;speedValue> will work, but will not display appropriate units
  maxSpeedTextbox.text = dpValToString("myMotor.rMaxSpeed", maxSpeedValue, true);
  speedTextbox.text = dpValToString("myMotor.rSpeed", speedValue, true);
}

//=============================== On Status Change =========================================
void onStatusChange(string statusDp, int statusValue)
{
  //Define the variable whose value will be assigned to the rectangle's color property
  string rectangleColor;

  //Determine color to assign to rectangle based off iStatus
  if (statusValue == (int)StatusType::Stopped)
  {
    rectangleColor = STOPPED_COLOR;
  }

  if (statusValue == (int)StatusType::Estop)
  {
    rectangleColor = ESTOPPED_COLOR;
  }

  if (statusValue == (int)StatusType::Forward)
  {
    rectangleColor = FORWARD_COLOR;
  }

  //Assign selected color to rectangle
  setValue("rectangle", "backCol", rectangleColor);
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #6A9955">#uses &quot;StatusType&quot;</span></span>
<span class="line"><span style="color: #6A9955">#uses &quot;ColorConst&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">//=============================== Panel initialization =========================================</span></span>
<span class="line"><span style="color: #D4D4D4">initializePanel()</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  //Whenever rSpeed </span><span style="color: #569CD6">or</span><span style="color: #D4D4D4"> rMaxSpeed changes, call the function </span><span style="color: #CE9178">&quot;onSpeedChange&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  dpConnect(</span><span style="color: #CE9178">&quot;onSpeedChange&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;myMotor.rSpeed&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;myMotor.rMaxSpeed&quot;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Whenever iStatus changes, call the function </span><span style="color: #CE9178">&quot;onStatusChange&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  dpConnect(</span><span style="color: #CE9178">&quot;onStatusChange&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;myMotor.iStatus&quot;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">//=============================== Text Field Command =========================================</span></span>
<span class="line"><span style="color: #D4D4D4">//Textbox </span><span style="color: #569CD6">is</span><span style="color: #D4D4D4"> selected </span><span style="color: #569CD6">and</span><span style="color: #D4D4D4"> user keys </span><span style="color: #CE9178">&quot;Enter&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">void textboxCmd()</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  //Assign the textbox</span><span style="color: #CE9178">&apos;s text value to rMaxSpeed</span></span>
<span class="line"><span style="color: #D4D4D4">  dpSet(</span><span style="color: #CE9178">&quot;myMotor.rMaxSpeed&quot;</span><span style="color: #D4D4D4">, maxSpeedTextbox.text);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">//=============================== On Speed / Max Speed Value Change =================================</span></span>
<span class="line"><span style="color: #D4D4D4">void onSpeedChange(string speedDp, </span><span style="color: #4EC9B0">float</span><span style="color: #D4D4D4"> speedValue, string maxSpeedDp, </span><span style="color: #4EC9B0">float</span><span style="color: #D4D4D4"> maxSpeedValue)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  //Define the variable whose value will be assigned to iStatus</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4"> iStatusValue;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Determine what value to assign iStatusValue (</span><span style="color: #C586C0">and</span><span style="color: #D4D4D4"> subsequently </span><span style="color: #CE9178">&quot;myMotor.iStatus&quot;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">  switch (speedValue)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #D4D4D4">    //If </span><span style="color: #CE9178">&quot;myMotor.rSpeed&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">is</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">, </span><span style="color: #4EC9B0">set</span><span style="color: #D4D4D4"> iStatusValue to </span><span style="color: #B5CEA8">0</span></span>
<span class="line"><span style="color: #D4D4D4">    case </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">:</span></span>
<span class="line"><span style="color: #D4D4D4">      iStatusValue = (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Stopped;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #C586C0">break</span><span style="color: #D4D4D4">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    //Otherwise, </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;myMotor.rSpeed&quot;</span><span style="color: #D4D4D4"> &gt; </span><span style="color: #CE9178">&quot;myMotor.rMaxSpeed&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #4EC9B0">set</span><span style="color: #D4D4D4"> iStatusValue to Estop status </span><span style="color: #4EC9B0">int</span></span>
<span class="line"><span style="color: #D4D4D4">    //           </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">not</span><span style="color: #D4D4D4">, </span><span style="color: #4EC9B0">set</span><span style="color: #D4D4D4"> iStatusValue to Forward status </span><span style="color: #4EC9B0">int</span></span>
<span class="line"><span style="color: #D4D4D4">    default:</span></span>
<span class="line"><span style="color: #D4D4D4">      iStatusValue = (speedValue &gt;= maxSpeedValue) </span><span style="color: #F44747">?</span><span style="color: #D4D4D4"> (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Estop : (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Forward;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #C586C0">break</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Assign iStatusValue</span><span style="color: #CE9178">&apos;s value to &quot;myMotor.iStatus&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  dpSet(</span><span style="color: #CE9178">&quot;myMotor.iStatus&quot;</span><span style="color: #D4D4D4">, iStatusValue);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Set the maxSpeedTextbox </span><span style="color: #569CD6">and</span><span style="color: #D4D4D4"> speedTextbox</span><span style="color: #CE9178">&apos;s test to their respective values</span></span>
<span class="line"><span style="color: #D4D4D4">  //NOTE: dpValToString ensures the units we assigned earlier </span><span style="color: #569CD6">in</span><span style="color: #D4D4D4"> the series are displayed.</span></span>
<span class="line"><span style="color: #D4D4D4">  //      Simply using &lt;Textbox&gt;.text = &lt;speedValue&gt; will work, but will </span><span style="color: #569CD6">not</span><span style="color: #D4D4D4"> display appropriate units</span></span>
<span class="line"><span style="color: #D4D4D4">  maxSpeedTextbox.text = dpValToString(</span><span style="color: #CE9178">&quot;myMotor.rMaxSpeed&quot;</span><span style="color: #D4D4D4">, maxSpeedValue, true);</span></span>
<span class="line"><span style="color: #D4D4D4">  speedTextbox.text = dpValToString(</span><span style="color: #CE9178">&quot;myMotor.rSpeed&quot;</span><span style="color: #D4D4D4">, speedValue, true);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">//=============================== On Status Change =========================================</span></span>
<span class="line"><span style="color: #D4D4D4">void onStatusChange(string statusDp, </span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4"> statusValue)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  //Define the variable whose value will be assigned to the rectangle</span><span style="color: #CE9178">&apos;s color property</span></span>
<span class="line"><span style="color: #D4D4D4">  string rectangleColor;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Determine color to assign to rectangle based off iStatus</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (statusValue == (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Stopped)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #D4D4D4">    rectangleColor = STOPPED_COLOR;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (statusValue == (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Estop)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #D4D4D4">    rectangleColor = ESTOPPED_COLOR;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (statusValue == (</span><span style="color: #4EC9B0">int</span><span style="color: #D4D4D4">)StatusType::Forward)</span></span>
<span class="line"><span style="color: #D4D4D4">  {</span></span>
<span class="line"><span style="color: #D4D4D4">    rectangleColor = FORWARD_COLOR;</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  //Assign selected color to rectangle</span></span>
<span class="line"><span style="color: #D4D4D4">  setValue(</span><span style="color: #CE9178">&quot;rectangle&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;backCol&quot;</span><span style="color: #D4D4D4">, rectangleColor);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<p class="wp-block-paragraph"><strong>Note that:</strong></p>



<ul class="wp-block-list">
<li>I added the #uses prompts</li>



<li>I removed StatusType enum definition from ScopeLib (since it’s applied via library)</li>



<li>I added color constants (also applied via library)</li>
</ul>



<p class="wp-block-paragraph">With the color constants and StatusType enum defined in libraries, other panels and scripts may use them at will.</p>



<p class="wp-block-paragraph">Now that we have a solid understanding of how to make and implement control libraries, we’ll continue in our OA exploration by investigating color databases and learning how we can use them to create and use custom colors.</p>



<p class="wp-block-paragraph"><strong>Topics to look forward to in this series:&nbsp;</strong></p>



<ul class="wp-block-list">
<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10093/getting-started-with-wincc-oa-part-9--color-database-and-high-performance-best-practices">Part 9: Color Database &amp; High-Performance Best Practices</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10138/getting-started-with-wincc-oa-part-10--panel-nesting-and-parameters">Part 10: Panels | Panel Nesting and $-Parameters</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10184/getting-started-with-wincc-oa-part-11--panels-child-panels-popups">Part 11:&nbsp;Panels | Child Panels (Popups)</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10313/getting-started-with-wincc-oa-part-12--modules-and-embedded-modules">Part 12: Modules &amp; Embedded Modules</a></li>
</ul>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/contact">Contact</a>&nbsp;DMC to get started on your next WinCC project and learn more about our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">Siemens SIMATIC WinCC Programming</a>&nbsp;as well as our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/wincc-open-architecture-development">WinCC Open Architecture Development.</a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/">Getting Started with WinCC OA: Part 8 &#8211; Libraries</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Getting Started with WinCC OA: Part 7 &#8211; Interacting with Datapoints via Scripting</title>
		<link>https://static.dmcinfo.com/blog/21113/getting-started-with-wincc-oa-part-7-interacting-with-datapoints-via-scripting/</link>
		
		<dc:creator><![CDATA[Nick Leisle]]></dc:creator>
		<pubDate>Fri, 16 Aug 2019 13:38:21 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21113/getting-started-with-wincc-oa-part-7-interacting-with-datapoints-via-scripting/</guid>

					<description><![CDATA[<p>Welcome back to &#8220;Getting Started with WinCC OA&#8221;! If you aren&#8217;t familiar with the series&#8217; previous topics, it&#8217;s recommended that you read the respective installments before proceeding: Now that we have a solid understanding of datapoints and basic scripting, it&#8217;s time to combine the two! In Part 7 of the &#8220;Getting Started with WinCC OA,&#8221; [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21113/getting-started-with-wincc-oa-part-7-interacting-with-datapoints-via-scripting/">Getting Started with WinCC OA: Part 7 &#8211; Interacting with Datapoints via Scripting</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">Welcome back to &ldquo;Getting Started with WinCC OA&rdquo;! If you aren&rsquo;t familiar with the series&rsquo; previous topics, it&rsquo;s recommended that you read the respective installments before proceeding:</p>

<ul class="wp-block-list">
 <li><a href="/latest-thinking/blog/id/9870/getting-started-with-wincc-oa-part-1--creating-opening-a-project">Part 1: Creating and Opening a Project</a></li>
 <li><a href="/latest-thinking/blog/id/9871/getting-started-with-wincc-oa-part-2--folder-structure-gedi-layout">Part 2: Folder Structure and Gedi Layout</a></li>
 <li><a href="/latest-thinking/blog/id/9884/getting-started-with-wincc-oa-part-3--panels-the-basics">Part 3: Panels | The Basics</a></li>
 <li><a href="/latest-thinking/blog/id/9893/getting-started-with-wincc-oa-part-4--panel-scripting-environments-and-quicktest">Part 4: Panel Scripting Environments and QuickTest</a></li>
 <li><a href="/latest-thinking/blog/id/9906/getting-started-with-wincc-oa-part-5--scripting-syntax">Part 5: Scripting Syntax</a></li>
 <li><a href="/latest-thinking/blog/id/9921/getting-started-with-wincc-oa-part-6--para-overview-and-datapoint-creation">Part 6: Para Overview and Datapoint Creation</a></li>
</ul>

<p class="wp-block-paragraph">Now that we have a solid understanding of datapoints and basic scripting, it&rsquo;s time to combine the two! In Part 7 of the &ldquo;Getting Started with WinCC OA,&rdquo; we&rsquo;ll investigate utilizing and manipulating datapoints within our OA scripts.</p>

<h2 class="wp-block-heading">Referencing A Datapoint Element</h2>

<p class="wp-block-paragraph">A datapoint element is referenced by: <strong>&lt;parent dp(s)&gt;.&lt;dpe&gt;</strong></p>

<p class="wp-block-paragraph">For example, the elements of the dp &ldquo;myMotor&rdquo; are given by:</p>

<ul class="wp-block-list">
 <li>&ldquo;myMotor.iStatus&rdquo;</li>
 <li>&ldquo;myMotor.rSpeed&rdquo;</li>
 <li>&ldquo;myMotor.rMaxSpeed&rdquo;</li>
</ul>

<h2 class="wp-block-heading">Using Datapoint Values within Scripts</h2>

<p class="wp-block-paragraph">Using scripts, we can link items in our panels to the datapoints that live in the db folder. The fundamental functions utilized in datapoint-scripting interaction include:</p>

<ul class="wp-block-list">
 <li>dpGet()</li>
 <li>dpSet()</li>
 <li>dpConnect()</li>
</ul>

<p class="wp-block-paragraph"><u><strong>dpGet()</strong></u></p>

<p class="wp-block-paragraph">dpGet() is used to assign a datapoint element&rsquo;s value to an existing script variable and takes the form: <strong>dpGet(&lt;dpe&gt;, &lt;variable&gt;);</strong></p>

<figure class="wp-block-image"><img decoding="async" alt="motor status" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/motor-istatus.png"  /></figure>

<p class="wp-block-paragraph">With this dpGet, the variable iStatus will take on the value of myMotor.iStatus.</p>

<p class="wp-block-paragraph"><u><strong>dpSet()</strong></u></p>

<p class="wp-block-paragraph">dpSet() is used to assign a value or a script variable&rsquo;s value to a datapoint value and takes the form: <strong>dpSet(&lt;dpe&gt;, &lt;value&gt;);</strong></p>

<figure class="wp-block-image"><img decoding="async" alt="dpe equal to 1" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/dpe-equal-1.png"  /></figure>

<p class="wp-block-paragraph">With this dpSet, the dpe value of myMotor.iStatus will be set to 1.</p>

<p class="wp-block-paragraph"><u><strong>dpConnect()</strong></u></p>

<p class="wp-block-paragraph">dpConnect() is used to call a function whenever a specified dp value changes. It takes the form:<br />
<strong>dpConnect(string &lt;callback function&gt;, string &lt;dpe&gt;)</strong></p>

<p class="wp-block-paragraph">The callback function of a dpConnect must be defined in a specific manner:<br />
<strong>&lt;returnType&gt; &lt;callbackFunction&gt;(string &lt;dpe&gt;, &lt;type&gt; &lt;dpeValue&gt;)</strong></p>

<figure class="wp-block-image"><img decoding="async" alt="connect datapoint" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/dpConnect.png"  /></figure>

<p class="wp-block-paragraph">With this dpConnect, the function <strong>&ldquo;onStatusChange&rdquo;</strong> will execute when the value of <strong>myMotor</strong>. <strong>iStatus </strong>changes. When <strong>&ldquo;onStatusChange&rdquo;</strong> executes, the function will have the string <strong>&ldquo;myMotor.iStatus&rdquo;</strong>&nbsp;(given by the variable <strong>statusDp</strong>) and the value of&nbsp;<strong>myMotor. iStatus</strong>&nbsp;(given by the variable <strong>statusValue</strong>) at its disposal.</p>

<h2 class="wp-block-heading">Example</h2>

<p class="wp-block-paragraph"><span style="font-size:larger;"><u><strong>Setting Up the Panel</strong></u></span></p>

<p class="wp-block-paragraph">Let&rsquo;s revisit our lovely red/green square example and pair it with our newly-created datapoints! Our example will include the following three main objects and their respective behavioral objectives:</p>

<ul class="wp-block-list">
 <li>Rectangle (i.e. our motor device icon)
 <ul class="wp-block-list" style="list-style-type:circle;">
  <li>Color is blue (stopped color) when rSpeed is 0</li>
  <li>Color is green (forward color) when 0 &lt; rSpeed &lt; rMaxSpeed</li>
  <li>Color is red (errored color) when rSpeed &gt; rMaxSpeed</li>
 </ul>
 </li>
 <li>Speed textbox
 <ul class="wp-block-list" style="list-style-type:circle;">
  <li>Displays rSpeed</li>
 </ul>
 </li>
 <li>Max speed textbox
 <ul class="wp-block-list" style="list-style-type:circle;">
  <li>Displays rMaxSpeed</li>
  <li>User can set rMaxSpeed value</li>
 </ul>
 </li>
</ul>

<p class="wp-block-paragraph">We&rsquo;ll start out by removing the previously-used buttons and adding in some primitive text, a label (used for value display), and text field (used for value display and modification).</p>

<figure class="wp-block-image"><img decoding="async" alt="para test panel" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/para-test-panel.png"  /></figure>

<p class="wp-block-paragraph"><span style="font-size:larger;"><u><strong>Writing the Script</strong></u></span></p>

<ol class="wp-block-list">
 <li>Ensure the panel&rsquo;s <strong>&ldquo;Initialize&rdquo; event</strong> still has the following code:

 <pre class="wp-block-code"><code>
	main()
{
  initializePanel();
}
</code></pre>
 </li>
 <li>Insert the following code within <strong>maxSpeedTextbox&rsquo;s &ldquo;Command&rdquo; event</strong>:
 <pre class="wp-block-code"><code>
	main()
{
  textboxCmd();
}
</code></pre>
 </li>
 <li>Add the following script to the panel&rsquo;s <strong>&ldquo;ScopeLib&rdquo;</strong>:
 <pre class="wp-block-code"><code>
enum StatusType
{
  Stopped = 0,
  Estop   = 1,
  Forward = 2
};

//=============================== Panel initialization =========================================
initializePanel()
{
  //Whenever rSpeed or rMaxSpeed changes, call the function &quot;onSpeedChange&quot;
  dpConnect(&quot;onSpeedChange&quot;, &quot;myMotor.rSpeed&quot;, &quot;myMotor.rMaxSpeed&quot;);

  //Whenever iStatus changes, call the function &quot;onStatusChange&quot;
  dpConnect(&quot;onStatusChange&quot;, &quot;myMotor.iStatus&quot;);
}


//=============================== Text Field Command =========================================
//Textbox is selected and user keys &quot;Enter&quot;
void textboxCmd()
{
  //Assign the textbox&apos;s text value to rMaxSpeed
  dpSet(&quot;myMotor.rMaxSpeed&quot;, maxSpeedTextbox.text);
}


//=============================== On Speed / Max Speed Value Change =================================
void onSpeedChange(string speedDp, float speedValue, string maxSpeedDp, float maxSpeedValue)
{
  //Define the variable whose value will be assigned to iStatus
  int iStatusValue;

  //Determine what value to assign iStatusValue (and subsequently &quot;myMotor.iStatus&quot;)
  switch (speedValue)
  {
    //If &quot;myMotor.rSpeed&quot; is 0, set iStatusValue to 0
    case 0:
      iStatusValue = (int)StatusType::Stopped;
      break;

    //Otherwise, if &quot;myMotor.rSpeed&quot; &gt; &quot;myMotor.rMaxSpeed&quot;, set iStatusValue to 1
    //           if not, set iStatusValue to 2
    default:
      iStatusValue = (speedValue &gt;= maxSpeedValue) ? (int)StatusType::Estop : (int)StatusType::Forward;
      break;
  }

  //Assign iStatusValue&apos;s value to &quot;myMotor.iStatus&quot;
  dpSet(&quot;myMotor.iStatus&quot;, iStatusValue);

  //Set the maxSpeedTextbox and speedTextbox&apos;s test to their respective values
  //NOTE: dpValToString ensures the units we assigned earlier in the series are displayed.
  //      Simply using &lt;Textbox&gt;.text = &lt;speedValue&gt; will work, but will not display appropriate units
  maxSpeedTextbox.text = dpValToString(&quot;myMotor.rMaxSpeed&quot;, maxSpeedValue, true);
  speedTextbox.text = dpValToString(&quot;myMotor.rSpeed&quot;, speedValue, true);
}

//=============================== On Status Change =========================================
void onStatusChange(string statusDp, int statusValue)
{
  //Define the variable whose value will be assigned to the rectangle&apos;s color property
  string rectangleColor;

  //Determine color to assign to rectangle based off iStatus
  if (statusValue == (int)StatusType::Stopped)
  {
    rectangleColor = &quot;blue&quot;;
  }

  if (statusValue == (int)StatusType::Estop)
  {
    rectangleColor = &quot;red&quot;;
  }

  if (statusValue == (int)StatusType::Forward)
  {
    rectangleColor = &quot;green&quot;;
  }

  //Assign selected color to rectangle
  setValue(&quot;rectangle&quot;, &quot;backCol&quot;, rectangleColor);
}
</code></pre>
 </li>
 <li>Be sure to review and understand the example script</li>
</ol>

<h2 class="wp-block-heading">Running the Example Code</h2>

<p class="wp-block-paragraph">Run the panel in QuickTest Module and open/view the<strong> &ldquo;myMotor&rdquo;</strong> datapoint in Para. Upon modifying the Motor Speed Limit textbox and pressing &apos;Enter&apos; on the keyboard, we can see the <strong>rMaxSpeed </strong>value change in Para.</p>

<figure class="wp-block-image"><img decoding="async" alt="motor speeds" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/motor-speed-1-2.png"  /></figure>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/original-value.png"  /></figure>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/original-value-500.png"  /></figure>

<p class="wp-block-paragraph">Upon modifying <strong>rSpeed</strong> in Para (simulating a linked PLC tag change), we can see the rectangle&rsquo;s color change from green as <strong>0 &lt; rSpeed &lt; rMaxSpeed</strong> and then to red as <strong>rSpeed &gt; rMaxSpeed</strong>:</p>

<figure class="wp-block-image"><img decoding="async" alt="rspeed -" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/rspeed-original-value.png"  /></figure>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/original-value-400.png"  /></figure>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/original-value-600.png"  /></figure>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/all-color-panels.png"  /></figure>

<p class="wp-block-paragraph">Now that we have a basic understanding of scripting and how to interact with datapoints, we&rsquo;re ready to expand our horizons beyond the boundaries of panel scripting environments and write code that is accessible globally in our OA program.</p>

<p class="wp-block-paragraph"><strong>Topics to look forward to in this series:&nbsp;</strong></p>

<ul class="wp-block-list">
 <li><a href="/latest-thinking/blog/id/10014/getting-started-with-wincc-oa-part-8--libraries">Part 8: Libraries</a></li>
 <li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10093/getting-started-with-wincc-oa-part-9--color-database-and-high-performance-best-practices">Part 9: Color Database &amp; High-Performance Best Practices</a></li>
 <li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10138/getting-started-with-wincc-oa-part-10--panel-nesting-and-parameters">Part 10: Panels | Panel Nesting and $-Parameters</a></li>
 <li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10184/getting-started-with-wincc-oa-part-11--panels-child-panels-popups">Part 11:&nbsp;Panels | Child Panels (Popups)</a></li>
 <li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10313/getting-started-with-wincc-oa-part-12--modules-and-embedded-modules">Part 12: Modules &amp; Embedded Modules</a></li>
  <li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10313/getting-started-with-wincc-oa-part-12--modules-and-embedded-modules">Part 12: Modules &amp; Embedded Modules</a></li>
</ul>

<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/contact">Contact</a>&nbsp;DMC to get started on your next WinCC project and learn more about our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">Siemens SIMATIC WinCC Programming</a>&nbsp;as well as our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/wincc-open-architecture-development">WinCC Open Architecture Development.</a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/21113/getting-started-with-wincc-oa-part-7-interacting-with-datapoints-via-scripting/">Getting Started with WinCC OA: Part 7 &#8211; Interacting with Datapoints via Scripting</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Getting Started with WinCC OA: Part 5 &#8211; Scripting Syntax</title>
		<link>https://static.dmcinfo.com/blog/21377/getting-started-with-wincc-oa-part-5-scripting-syntax/</link>
		
		<dc:creator><![CDATA[Nick Leisle]]></dc:creator>
		<pubDate>Tue, 25 Jun 2019 14:33:24 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Syntax]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21377/getting-started-with-wincc-oa-part-5-scripting-syntax/</guid>

					<description><![CDATA[<p>Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, it’s recommended that you read the respective installments before proceeding: In Part 5 of the “Getting Started with WinCC OA,” we’ll investigate the basics of OA’s scripting syntax. Once scripting syntax is understood, we can begin programming and [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21377/getting-started-with-wincc-oa-part-5-scripting-syntax/">Getting Started with WinCC OA: Part 5 &#8211; Scripting Syntax</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Welcome back to “Getting Started with WinCC OA”! If you aren’t familiar with the series’ previous topics, it’s recommended that you read the respective installments before proceeding:</p>



<ul class="wp-block-list">
<li><a href="/latest-thinking/blog/id/9870/getting-started-with-wincc-oa-part-1--creating-opening-a-project">Part 1: Creating and Opening a Project</a></li>



<li><a href="/latest-thinking/blog/id/9871/getting-started-with-wincc-oa-part-2--folder-structure-gedi-layout">Part 2: Folder Structure and Gedi Layout</a></li>



<li><a href="/latest-thinking/blog/id/9884/getting-started-with-wincc-oa-part-3--panels-the-basics">Part 3: Panels &amp; The Basics</a></li>



<li><a href="/latest-thinking/blog/id/9893/getting-started-with-wincc-oa-part-4--panel-scripting-environments-and-quicktest">Part 4: Panel Scripting Environments and QuickTest</a></li>
</ul>



<p class="wp-block-paragraph">In Part 5 of the “Getting Started with WinCC OA,” we’ll investigate the basics of OA’s scripting syntax. Once scripting syntax is understood, we can begin programming and adding functionality to our panels.</p>



<h2 id="h-the-basics" class="wp-block-heading">The Basics</h2>



<ul class="wp-block-list">
<li>Every executable statement must end with a semicolon;</li>



<li>// Use two forward slashes to comment out the remaining portion of a line</li>



<li>Ctrl + D will comment out a line of code</li>



<li>Ctrl + Shift + D will un-comment out a line of code</li>



<li>Ctrl + E will open all of a selected panel’s scripts</li>
</ul>



<h2 id="h-variables" class="wp-block-heading">Variables</h2>



<p class="wp-block-paragraph">OA supports many types of variables. The most used of which are:</p>


<table style="width:100%; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; margin-bottom:40px;">
<tbody>
<tr style="text-align:center;">
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>Type</strong></th>
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>OA Name</strong></th>
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>Array of &lt;type&gt;</strong></th>
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>Comment</strong></th>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Any Type</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">anytype</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_anytype</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Adapts to the type of the first variable assigned to it</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Boolean</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">bool</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_bool</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">0, 1, true, or false</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Character</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">char</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_char</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Enumeration</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">enum</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&#8212;&#8211;</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Floating Point</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">float</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_float</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Integer</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">int</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_int</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">String</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">string</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_string</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Time</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">time</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_time</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Shape</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">shape</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">dyn_shape</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Pointer to a graphic element</td>
</tr>
</tbody>
</table>


<p class="wp-block-paragraph">Variable definitions take the form of:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Type> &lt;variableName>;</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">&lt;Type&gt; &lt;variableName&gt;;</span></span></code></pre></div>



<p class="wp-block-paragraph">Variables can be given initial values:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Type> &lt;variableName> = &lt;intialValue>;</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">&lt;Type&gt; &lt;variableName&gt; = &lt;intialValue&gt;;</span></span></code></pre></div>



<p class="wp-block-paragraph">Multiple variables can be defined for a single type:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Type> &lt;variable1Name>, &lt;variable2Name>, …;</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">&lt;Type&gt; &lt;variable1Name&gt;, &lt;variable2Name&gt;, …;</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/bool-function-1.png" alt="bool function"/></figure>



<p class="wp-block-paragraph">Variables must be defined before use, but can be so:</p>



<ul class="wp-block-list">
<li>At the beginning of a script</li>



<li>Within a function</li>



<li>Within a statement</li>



<li>Within a function’s parameter structure</li>
</ul>



<p class="wp-block-paragraph">Best practice tip: Variable names should utilize camelCase or PascalCase and clearly indicate the variable’s function.</p>



<p class="wp-block-paragraph"><strong>Casting</strong><br>
Casting is a way of interpreting a variable or value as an alternate type. This is done simply by preceding the target variable with “(&lt;target type&gt;)”. Casting is especially helpful with enumerations (which will be discussed later in this blog post).</p>



<p class="wp-block-paragraph"><strong>Constants</strong><br>
Constants are defined in a manner similar to that of variables. However, by designating something as a constant, OA ensures that the value cannot be modified within a script. To designate a variable as a constant, simply place “const” before the type name.</p>



<p class="wp-block-paragraph"><u>Note:</u><strong>&nbsp;</strong>DMC’s best practice standards include capitalizing all constants.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/const-function-2.png" alt="const function"/></figure>



<p class="wp-block-paragraph"><strong>Functions</strong><br><br>Functions take the following form:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;returnType> &lt;functionName>(&lt;parameterType> &lt;parameter>, ...)
{
    // Function content

    return &lt;returnedItem>;
    // Required unless the return type is "void"
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">&lt;returnType&gt; &lt;functionName&gt;(&lt;parameterType&gt; &lt;parameter&gt;, ...)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #6A9955">    // Function content</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">return</span><span style="color: #D4D4D4"> &lt;returnedItem&gt;;</span></span>
<span class="line"><span style="color: #6A9955">    // Required unless the return type is &quot;void&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/myfunction-3.png" alt="function"/></figure>



<p class="wp-block-paragraph"><strong>Note:&nbsp;returnType</strong> takes the form of any variable type or is “void”</p>



<p class="wp-block-paragraph"><strong>Logic Operators</strong><br>
The following operators can be used in WinCC OA scripting:</p>


<table style="width:100%; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; margin-bottom:20px;">
<tbody>
<tr style="text-align:center;">
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>Operator</strong></th>
<th style="border-collapse:collapse; border-style:solid; border-width:medium; border-spacing: 20px; border:1px solid black; height:100px; font-size:24px; border-right-style:solid; border-right-width:medium; border-left-style:solid; border-left-width:medium;"><strong>Symbol</strong></th>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">AND</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&amp;&amp;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">OR</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">||</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">NOT</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">!</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Equal to</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">==</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Greater than</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&gt;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Greater than or equal to</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&gt;=</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Less than</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&lt;</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Less than or equal to</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">&lt;=</td>
</tr>
<tr>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">Not equal to</td>
<td style="text-align:center; vertical-align:middle; border-collapse:collapse; border:1px solid black; border-style:solid; border-width:medium; font-size:24px;">!=</td>
</tr>
</tbody>
</table>


<p class="wp-block-paragraph"><strong>Statements</strong><br><br>WinCC utilizes the traditional of IF, ELSE, FOR, WHILE, and SWITCH statements as follows:<br><br><u>IF and ELSE statements:</u></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly> if(&lt;Boolean condition>)
{
    &lt;code>;
}
else
{
    &lt;code>;
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4"> </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4">(&lt;Boolean condition&gt;)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">    &lt;code&gt;;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"><span style="color: #C586C0">else</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">    &lt;code&gt;;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/if-else-4.png" alt="if else statement"/></figure>



<p class="wp-block-paragraph"><u>FOR Loop:</u></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>for(&lt;initialization of condition>; &lt;Boolean testing condition>; &lt;target variable modification>)
{
    &lt;code>;
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #C586C0">for</span><span style="color: #D4D4D4">(&lt;initialization of condition&gt;; &lt;Boolean testing condition&gt;; &lt;target variable modification&gt;)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">    &lt;code&gt;;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/for-loop-5.png" alt="for loop"/></figure>



<p class="wp-block-paragraph"><u>WHILE Loop:</u></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>while(&lt;Boolean condition>)
{
    &lt;code>;
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #C586C0">while</span><span style="color: #D4D4D4">(&lt;Boolean condition&gt;)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">    &lt;code&gt;;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/while-function-6.png" alt="while statement"/></figure>



<p class="wp-block-paragraph"><u>SWITCH Statement</u></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>switch(&lt;target variable>)
{
    case &lt;value 1>:
        &lt;code>
        break;
    •••
    case &lt;value n>:
        &lt;code>
        break;
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #C586C0">switch</span><span style="color: #D4D4D4">(&lt;target variable&gt;)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">case</span><span style="color: #D4D4D4"> &lt;value </span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">&gt;:</span></span>
<span class="line"><span style="color: #D4D4D4">        &lt;code&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">break</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">    •••</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">case</span><span style="color: #D4D4D4"> &lt;value n&gt;:</span></span>
<span class="line"><span style="color: #D4D4D4">        &lt;code&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">break</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/strings-integers.png" alt="switch function"/></figure>



<p class="wp-block-paragraph"><u>Bonus Round: Ternary Statements</u><br><br>Ternary statements are condensed ways of writing simple if-else statements. They take the form:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">C++</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;conditional statement> ? &lt;value returned if true> : &lt;value returned if false> </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">&lt;conditional statement&gt; ? &lt;value returned </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">&gt; : &lt;value returned </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">false</span><span style="color: #D4D4D4">&gt; </span></span></code></pre></div>



<p class="wp-block-paragraph"><strong>Enumerations</strong><br>
Enumerations should be used to make code easier to interpret. For example, say there exists an integer variable, called iStatus, that indicates the condition of a motor where:</p>



<ul class="wp-block-list">
<li>0 = stopped</li>



<li>1 = Error</li>



<li>2 = Running Forward</li>
</ul>



<p class="wp-block-paragraph">Say we want the rectangle from our prior example (representing the motor) to change color based on the iStatus variable. A series of IF statements could be written:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/rectangle-color-8.png" alt="if function"/></figure>



<p class="wp-block-paragraph">The program will work as expected, setting the rectangle’s background color to either grey, red, or white depending on the iStatus value. But someone troubleshooting or reviewing the code may be slowed as the code isn’t explicit as to what each iStatus case represents. This is where enumerations come in.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/enum-function-9.png" alt="enum function"/></figure>



<p class="wp-block-paragraph">The enumeration <strong>“StatusType”</strong> has been implemented to make the code more explicit. Note that the enumeration has been cast as an integer to ensure that iStatus is given an integer to which it can compare.</p>



<p class="wp-block-paragraph">Even further, constants have also been utilized for redundant clarity and (for reasons we’ll discuss later in this series) consistency.</p>



<p class="wp-block-paragraph">What would even improve the code further? If you guessed “switch statement”, you’d be correct. While, in theory, this would be true, an unfortunate “feature” of WinCC OA is that its switch statements can’t handle casting. So while the following code would be optimal, saving and implementing it is not possible.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/open-library-function-10_1.png" alt="istatus"/></figure>



<p class="wp-block-paragraph">Now that the basics of scripting syntax have been covered, we’re ready to progress to the next aspect of scripting in WinCC OA: Para. In the next installment of “Getting Started with WinCC OA”, we’ll investigate the Para tool, OA tags, and how to interact with said tags.</p>



<p class="wp-block-paragraph"><strong>Topics to look forward to in this series:&nbsp;</strong></p>



<ul class="wp-block-list">
<li><a href="/latest-thinking/blog/id/9921/getting-started-with-wincc-oa-part-6--para-overview-and-datapoint-creation">Part 6: Para Overview and Datapoint Creation</a></li>



<li><a href="/latest-thinking/blog/id/9944/getting-started-with-wincc-oa-part-7--interacting-with-datapoints-via-scripting">Part 7: Interacting with Datapoints via Scripting</a></li>



<li><a href="https://static.dmcinfo.com/blog/20658/getting-started-with-wincc-oa-part-8-libraries/">Part 8: Libraries</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10093/getting-started-with-wincc-oa-part-9--color-database-and-high-performance-best-practices">Part 9: Color Database &amp; High-Performance Best Practices</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10138/getting-started-with-wincc-oa-part-10--panel-nesting-and-parameters">Part 10: Panels | Panel Nesting and $-Parameters</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10184/getting-started-with-wincc-oa-part-11--panels-child-panels-popups">Part 11:&nbsp;Panels | Child Panels (Popups)</a></li>



<li><a href="https://static.dmcinfo.com/latest-thinking/blog/id/10313/getting-started-with-wincc-oa-part-12--modules-and-embedded-modules">Part 12: Modules &amp; Embedded Modules</a></li>
</ul>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/contact">Contact</a>&nbsp;DMC to get started on your next WinCC project and learn more about our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">Siemens SIMATIC WinCC Programming</a>&nbsp;as well as our&nbsp;<a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/wincc-open-architecture-development">WinCC Open Architecture Development.</a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/21377/getting-started-with-wincc-oa-part-5-scripting-syntax/">Getting Started with WinCC OA: Part 5 &#8211; Scripting Syntax</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WinCC 7: Disable Global Color Scheme &#038; Global Shadow</title>
		<link>https://static.dmcinfo.com/blog/21515/wincc-7-disable-global-color-scheme-global-shadow/</link>
		
		<dc:creator><![CDATA[John Michael Frullo]]></dc:creator>
		<pubDate>Wed, 22 May 2019 09:02:39 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Visual Basic Script]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21515/wincc-7-disable-global-color-scheme-global-shadow/</guid>

					<description><![CDATA[<p>Have you ever been trying to change the color properties (ex. background color) of an object in WinCC 7, and it just won’t budge? Are you already familiar with the global color scheme property and constantly find yourself turning it off? Are you looking for a better way to customize objects during development without having [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21515/wincc-7-disable-global-color-scheme-global-shadow/">WinCC 7: Disable Global Color Scheme &#038; Global Shadow</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Have you ever been trying to change the color properties (ex. background color) of an object in <a href="/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">WinCC 7</a>, and it just won’t budge? Are you already familiar with the global color scheme property and constantly find yourself turning it off? Are you looking for a better way to customize objects during development without having to change this property all the time?</p>



<p class="wp-block-paragraph">Well then, I have a solution for you!</p>



<h2 id="h-the-good-solution" class="wp-block-heading">The Good Solution</h2>



<p class="wp-block-paragraph">Sure, you can disable global color scheme (and while we’re at it, global shadow) on each object by selecting that object on the screen, selecting <strong>“Effects”</strong> under the <strong>Properties tab</strong>, and changing the global color scheme and global shadow to<strong> “No.”</strong> Now, you can change the properties of that object all you want.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Disable-global-schema-good.png" alt="Global color scheme in porta"/></figure>



<h2 id="h-the-better-solution" class="wp-block-heading">The Better Solution</h2>



<p class="wp-block-paragraph">Now, if you’re doing any serious development and adding many items to screens, then this individualized property changing gets old pretty quickly.&nbsp;Well, luckily, you can create default properties for items before they are placed on the screen. Select the object you’re going to put on the screen in the item navigator pane. Then, <strong>before</strong> you place the item, go to <strong>“Effects”</strong> again, and <strong>disable </strong>the global color scheme and global shadow.</p>



<p class="wp-block-paragraph">Now, you can place as many circles as you like without having to change those properties each time.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/global-schema-better.png" alt="the better way to disable"/></figure>



<p class="wp-block-paragraph">This change persists after you close the project and restart your computer, so the project default settings will be there for you the next time you’re ready to continue development.</p>



<h2 id="h-the-best-solution" class="wp-block-heading">The Best Solution</h2>



<p class="wp-block-paragraph">The above step is nice and easy, but it suffers from some drawbacks. First, you have to do this for every object type that you’ll be adding (circles, rectangles, I/O Fields, etc.). Second, this setting only applies to the project you’re working on.</p>



<p class="wp-block-paragraph">So, if you have several projects that you are working on – say if you’re a developer or you have one engineering station for multiple or distributed projects in your plant – then you would need to do this every time you open a different project. If you are ready to be rid of the global color scheme for all projects on your computer, let me introduce you to <strong>VBA in WinCC 7</strong>.</p>



<p class="wp-block-paragraph">VBA can be used within WinCC 7 for automatic configuration of the <strong>Graphics Designer</strong> (create and edit pictures, objects, menus, and dynamics) and other editors (Tag Management, Alarm Logging, etc.). By modifying the Global Template, we can perform a check when an object is created, or a picture is opened to disable the global color scheme and shadow properties.</p>



<p class="wp-block-paragraph">To open the VBA editor, open Graphics Designer. Then under <strong>Tools &gt; Macros</strong>, select <strong>Visual Basic Editor</strong> (or hit Alt + F11).</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/global-schema-best.png" alt="macros in graphics designer"/></figure>



<p class="wp-block-paragraph">Once the Visual Basic Editor opens, we will select the Global Template to make our modifications.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/disable-global-schema-in-portal.png" alt="VBA editor"/></figure>



<p class="wp-block-paragraph">To disable the global color scheme and global shadow for <strong>objects</strong>, add the following code to the Global Template.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">VB</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>Private Sub Document_HMIObjectAdded( _
    ByVal ThisObject As IHMIObject, _
    CancelForwarding As Boolean)

    ' Any errors received are likely because a device
    ' (for example, a faceplate) does not have these properties.
    ' Continue execution if an error occurs.
    On Error Resume Next

    ' Disable the global color scheme
    ThisObject.GlobalColorScheme.Value = False

    ' Disable the global shadow effect
    ThisObject.GlobalShadow.Value = False

End Sub</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">Private Sub </span><span style="color: #DCDCAA">Document_HMIObjectAdded</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE"> _</span></span>
<span class="line"><span style="color: #D4D4D4">    ByVal ThisObject As </span><span style="color: #4EC9B0">IHMIObject</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> _</span></span>
<span class="line"><span style="color: #D4D4D4">    CancelForwarding As </span><span style="color: #4EC9B0">Boolean</span><span style="color: #D4D4D4">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos; Any errors received are likely because a device</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos; (for example, a faceplate) does not have these properties.</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos; Continue execution if an error occurs.</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #569CD6">On Error Resume Next</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos; Disable the global color scheme</span></span>
<span class="line"><span style="color: #D4D4D4">    ThisObject.GlobalColorScheme.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> =</span><span style="color: #569CD6"> False</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos; Disable the global shadow effect</span></span>
<span class="line"><span style="color: #D4D4D4">    ThisObject.GlobalShadow.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> =</span><span style="color: #569CD6"> False</span></span>
<span class="line"></span>
<span class="line"><span style="color: #569CD6">End Sub</span></span></code></pre></div>



<p class="wp-block-paragraph">To disable the global color scheme for <strong>pictures</strong>, add the following code to the Global Template.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">VB</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>Private Sub Document_Activated(CancelForwarding As Boolean)

    ' The faceplate editor does not support the GlobalColorScheme property.
    ' Ignore any errors that occur while attempting to disable it.
    On Error Resume Next

    ' Disable the global color scheme for the active document
    Application.ActiveDocument.GlobalColorScheme.Value = False

End Sub</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">Private Sub </span><span style="color: #DCDCAA">Document_Activated</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">CancelForwarding</span><span style="color: #D4D4D4"> As </span><span style="color: #4EC9B0">Boolean</span><span style="color: #D4D4D4">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos; The faceplate editor does not support the GlobalColorScheme property.</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos; Ignore any errors that occur while attempting to disable it.</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #569CD6">On Error Resume Next</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos; Disable the global color scheme for the active document</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #4EC9B0">Application</span><span style="color: #D4D4D4">.ActiveDocument.GlobalColorScheme.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> =</span><span style="color: #569CD6"> False</span></span>
<span class="line"></span>
<span class="line"><span style="color: #569CD6">End Sub</span></span></code></pre></div>



<p class="wp-block-paragraph">Save the <strong>Global Template</strong>, and you are all finished! You can now open/add pictures and add objects to those pictures to test out your additions.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/full-code-to-disable.png" alt="full code in vba"/></figure>



<p class="wp-block-paragraph"><strong>Note:</strong> if you only want to make these changes on the project level rather than for your computer, you can add the above code to the <strong>Project Template</strong> file instead.</p>



<p class="wp-block-paragraph"><strong>From the WinCC 7 Manual: (Working with WinCC/VBA for Automated Configuration/Introduction: Using VBA in WinCC/Organizing VBA Code in a WinCC Project)</strong></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/wincc-manual-instructions.png" alt="manual in wincc instructions"/></figure>



<p class="wp-block-paragraph">You can reference the help files for more details about what you can do with VBA in WinCC 7.</p>



<p class="wp-block-paragraph">Learn more about DMC&#8217;s <a href="/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/siemens-simatic-wincc-programming">WinCC Expertise</a> and <a href="/contact">contact us today</a> to get started on your next project!</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21515/wincc-7-disable-global-color-scheme-global-shadow/">WinCC 7: Disable Global Color Scheme &#038; Global Shadow</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Dynamically Specifying the Folder for Importing &#038; Exporting Siemens HMI Recipes</title>
		<link>https://static.dmcinfo.com/blog/21522/dynamically-specifying-the-folder-for-importing-exporting-siemens-hmi-recipes/</link>
		
		<dc:creator><![CDATA[Zachary Gracia]]></dc:creator>
		<pubDate>Mon, 20 May 2019 13:42:40 +0000</pubDate>
				<category><![CDATA[PLC]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Recipe Management]]></category>
		<category><![CDATA[Scripting]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21522/dynamically-specifying-the-folder-for-importing-exporting-siemens-hmi-recipes/</guid>

					<description><![CDATA[<p>One way to implement tasks when using Siemens products is to utilize the built-in recipe functionality. For applications in which the same PLC/HMI code is used across multiple standalone projects, it can be useful to configure a recipe on one PLC and then transfer it to other devices. To effectively transfer recipes between the PLC [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21522/dynamically-specifying-the-folder-for-importing-exporting-siemens-hmi-recipes/">Dynamically Specifying the Folder for Importing &#038; Exporting Siemens HMI Recipes</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">One way to implement tasks when using Siemens products is to utilize the built-in recipe functionality. For applications in which the same PLC/HMI code is used across multiple standalone projects, it can be useful to configure a recipe on one PLC and then transfer it to other devices. To effectively transfer recipes between the PLC and HMI, please refer to <a href="/latest-thinking/blog/id/9770/importing-csv-recipe-files-into-siemens-hmi-and-iteratively-downloading-multiple-data-records-from-hmi-into-plc">this blog</a> instead. This blog will cover dynamically setting the location of import files and export folders.</p>



<p class="wp-block-paragraph"><strong>It is important to note that this implementation will not work with basic panels!</strong></p>



<h2 id="h-exporting-and-importing-files" class="wp-block-heading">Exporting and Importing Files</h2>



<p class="wp-block-paragraph">Siemens HMI’s have built-in functions for importing and exporting files that are relatively easy to implement. Both functions are triggered by events that are named<strong> ExportDataRecords</strong> and <strong>ImportDataRecords, </strong>which are built-in Siemens functions.&nbsp;The events can trigger on a large variety of actions, but for this example, I had them trigger on HMI button presses.&nbsp;</p>



<p class="wp-block-paragraph">These events can be set by going to a component&#8217;s properties and clicking on the events tab (shown below).&nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" alt="recipe components" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Recipes-4-R.png"><br>
<em><span style="font-size:12px">Component Properties on the HMI interface</span></em></p>



<p class="wp-block-paragraph"><img decoding="async" alt="Figure 1" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Recipes-1-R.png"><br>
<em><span style="font-size:12px">Sample Configuration for ExportDataRecords</span></em></p>



<p class="wp-block-paragraph"><img decoding="async" alt="Figure 2" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Recipes-2-R.png"><br>
<em><span style="font-size:12px">Sample Configuration for ImportDataRecords</span></em></p>



<p class="wp-block-paragraph">For both importing and exporting data records, the input that specifies the desired pathing is the <strong>filename</strong> input. This parameter is the system path to the file in the form of a string. The string containing the <strong>import</strong> variable, and the string containing the <strong>export</strong> variable can be set using the same built-in HMI event function called <strong>OpenFileBrowser</strong>. Note that for this implementation, the export path and the import will need to be held in separate variables.</p>



<p class="wp-block-paragraph"><img decoding="async" alt="Figure 3" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Recipes-3-R.png"><br>
<em><span style="font-size:12px">Sample Configuration for OpenFileBrowser</span></em></p>



<p class="wp-block-paragraph">This event lets the user navigate to a desired folder/file and save the computer pathing of that file to the tag passed into the Path input. In this application, a specific file is used for importing recipes, and a folder is specified for exporting recipes. To do this, toggle the file input of the open file browser event.</p>



<p class="wp-block-paragraph">When this parameter is set to true, the file browser will return a path to a file, when it is false it will return the path to a folder. When this field is set to true, you can also mask the browser to only show specific file extensions such as .csv or .ap by using the mask field. This can be useful for ignoring irrelevant files.</p>



<p class="wp-block-paragraph">The event that exports recipes needs a file pathing to export, and since our file browsing event is grabbing a folder pathing, some basic scripting is needed to create an export file path we can use. The script below concatenates the folder pathing we got from the file browser with a name tag I created for the current recipe. This script should be triggered on the value change of either the folder path or the recipe name.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">VB</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>Sub ExportPathing()

    HmiRuntime.SmartTags("sExportPath") = _
        HmiRuntime.SmartTags("sExportPathFolder") &amp; _
        HmiRuntime.SmartTags("dbRecipes_udtCurrentRecipe_sRecipeName") &amp; _
        ".csv"

End Sub</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">Sub</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">ExportPathing</span><span style="color: #D4D4D4">()</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    HmiRuntime.</span><span style="color: #DCDCAA">SmartTags</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;sExportPath&quot;</span><span style="color: #D4D4D4">) =</span><span style="color: #9CDCFE"> _</span></span>
<span class="line"><span style="color: #D4D4D4">        HmiRuntime.</span><span style="color: #DCDCAA">SmartTags</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;sExportPathFolder&quot;</span><span style="color: #D4D4D4">) &amp;</span><span style="color: #9CDCFE"> _</span></span>
<span class="line"><span style="color: #D4D4D4">        HmiRuntime.</span><span style="color: #DCDCAA">SmartTags</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;dbRecipes_udtCurrentRecipe_sRecipeName&quot;</span><span style="color: #D4D4D4">) &amp;</span><span style="color: #9CDCFE"> _</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #CE9178">&quot;.csv&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #569CD6">End Sub</span></span></code></pre></div>



<p class="wp-block-paragraph">Once the correct path is specified for importing and exporting, the import and export event are ready to be triggered. By using the tips outlined for importing and exporting recipes, you should be able to specify computer locations for importing and exporting recipes easily. I hope this will help in your future endeavors.</p>



<p class="wp-block-paragraph">Learn more about DMC&#8217;s <a href="/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming">HMI and SCADA Expertise</a> and our partnership with <a href="/about/partners/siemens-solution-partner">Siemens</a>.</p>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://static.dmcinfo.com/blog/21522/dynamically-specifying-the-folder-for-importing-exporting-siemens-hmi-recipes/">Dynamically Specifying the Folder for Importing &#038; Exporting Siemens HMI Recipes</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How To Make a Simple Time-lapse IP Web Camera Using a Raspberry Pi</title>
		<link>https://static.dmcinfo.com/blog/22333/how-to-make-a-simple-time-lapse-ip-web-camera-using-a-raspberry-pi/</link>
		
		<dc:creator><![CDATA[Jirka Hladis]]></dc:creator>
		<pubDate>Mon, 07 Jan 2019 19:32:16 +0000</pubDate>
				<category><![CDATA[Culture]]></category>
		<category><![CDATA[Scripting]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/22333/how-to-make-a-simple-time-lapse-ip-web-camera-using-a-raspberry-pi/</guid>

					<description><![CDATA[<p>When it comes to capturing time-lapse videos, there are numerous off-the-shelf solutions and libraries out there. For last year’s FedEx Day project, I decided to implement a minimalist solution on a Raspberry Pi&#160;using only the default image capture API that ships with Raspbian (raspistill), the built-in UNIX task-scheduler (cron), a video conversion utility (avconv), and [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/22333/how-to-make-a-simple-time-lapse-ip-web-camera-using-a-raspberry-pi/">How To Make a Simple Time-lapse IP Web Camera Using a Raspberry Pi</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">When it comes to capturing time-lapse videos, there are numerous off-the-shelf solutions and libraries out there. For <a href="https://static.dmcinfo.com/blog/24406/cooking-up-new-ideas-and-bbq-at-dmcs-fedex-day/">last year’s FedEx Day project</a>, I decided to implement a minimalist solution on a Raspberry Pi&nbsp;using only the default image capture API that ships with Raspbian (<a href="https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md">raspistill</a>), the built-in UNIX task-scheduler (<a href="https://en.wikipedia.org/wiki/Cron">cron</a>), a video conversion utility (<a href="https://sourceforge.net/projects/avconv/" target="_blank" rel="noreferrer noopener">avconv</a>), and a lightweight web server (<a href="https://www.lighttpd.net/" target="_blank" rel="noreferrer noopener">lighttpd</a>).</p>



<ul class="wp-block-list">
<li>Set up your Raspberry Pi with the latest version of Raspbian by <a href="https://www.raspberrypi.org/documentation/installation/installing-images/">burning the image to an SD card</a>.</li>



<li>Connect the camera and power on the Pi. Connect to your Wi-Fi or wired network, and open a terminal session, either <a href="https://www.raspberrypi.org/documentation/remote-access/ssh/">via SSH</a> or directly on the Pi.</li>



<li>(Optional) <a href="https://www.raspberrypi.com/documentation/computers/configuration.html#assign-a-static-ip-address" target="_blank" rel="noreferrer noopener">Set up a static IP address</a>. This will let you find your server in the same place every time. If you&#8217;re feeling fancy, you can even set up a DNS server to resolve a URL (e.g. myraspitimelapse.local) to this IP address.</li>



<li>Install <strong>libav</strong>, which contains avconv. This is the tool we will use to create a video from the captured stills: </li>
</ul>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Bash</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>sudo apt-get install libav-tools</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #DCDCAA">sudo</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">apt-get</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">install</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">libav-tools</span></span></code></pre></div>



<ul class="wp-block-list">
<li>Install <strong>lighttpd</strong>.&nbsp;This will let you view your time-lapse video via a&nbsp;web browser: </li>
</ul>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Bash</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>sudo apt-get install lighttpd</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #DCDCAA">sudo</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">apt-get</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">install</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">lighttpd</span></span></code></pre></div>



<ul class="wp-block-list">
<li>Create a basic web page containing the time-lapse&nbsp;video and save it&nbsp;in the directory where lighttpd will know&nbsp;to serve it. The most straightforward way is to use the built-in text editor nano: </li>
</ul>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Bash</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>sudo nano /var/www/html/index.html</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #DCDCAA">sudo</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">nano</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">/var/www/html/index.html</span></span></code></pre></div>



<ul class="wp-block-list">
<li>Then copy in the following HTML, which tells the browser to automatically play the video on loop (the muted attribute is required for some browsers to autoplay):</li>
</ul>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">HTML</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;!DOCTYPE html>
&lt;html>
&lt;head>
    &lt;title>My Timelapse&lt;/title>
&lt;/head>
&lt;body>

    &lt;video autoplay loop muted>
        &lt;source src="timelapse.mp4" type="video/mpt support the video tag.
    &lt;/video>

&lt;/body>
&lt;/html></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;!</span><span style="color: #569CD6">DOCTYPE</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">html</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">html</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">head</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">title</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">My Timelapse</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">title</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">head</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">body</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">video</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">autoplay</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">loop</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">muted</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">source</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">src</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;timelapse.mp4&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">type</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;video/mpt support the video tag.</span></span>
<span class="line"><span style="color: #CE9178">    </span><span style="color: #F44747">&lt;</span><span style="color: #CE9178">/video&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F44747">&lt;</span><span style="color: #CE9178">/body&gt;</span></span>
<span class="line"><span style="color: #F44747">&lt;</span><span style="color: #CE9178">/html&gt;</span></span></code></pre></div>



<ul class="wp-block-list">
<li>To create the video, we&#8217;ll use a simple shell script. Open a new file using nano as before:
 <pre style="font-family: monospace;background-color: #333;color: #f0f2f1;"> sudo nano /home/pi/timelapse/timelapse.sh</pre>
 and paste in the following script, which saves a&nbsp;new still photo and generates a video file from all the existing stills every time it runs. It takes an input argument that specifies the number of seconds for the video duration.

 
 </li>



<li>Next, change the file permissions so that the script can be executed:
 <pre style="font-family: monospace;background-color: #333;color: #f0f2f1;"> sudo chmod +x /home/pi/timelapse/timelapse.sh</pre>
 You should now be able to run your script as:

 <pre style="font-family: monospace;background-color: #333;color: #f0f2f1;"> /home/pi/timelapse/timelapse.sh 5</pre>
 and see the timelapse.mp4 file get created in the directory. Enter the Pi&#8217;s IP address into your browser, and you should be able to play the 5-second long video. For now, it won&#8217;t be too exciting, since it will just be a single frame.</li>



<li>Finally, set up the cron job that will trigger shell script. Open the cron table file:
 <pre style="font-family: monospace;background-color: #333;color: #f0f2f1;"> crontab -e</pre>
 Add the following line to the end of the file:

 <pre style="font-family: monospace;background-color: #333;color: #f0f2f1;"> 0 * * * * /home/pi/timelapse/timelapse.sh 30 &gt; /home/pi/timelapse/timelapse.log</pre>
 This runs the shell script once per minute, and the input argument of 30 means that the video will be 30 seconds long. The <strong>&gt;</strong> symbol redirects any errors to the specified log file. You can, of course, use other time intervals as well, and <a href="https://crontab.guru/">this handy website</a> helps explain the syntax, which can be a little confusing.</li>



<li>And that&#8217;s it! You can change all the parameters as needed, and you can&nbsp;even try making some tweaks to the script. For example, maybe you want the time-lapse video to show each frame for a set amount of time rather than keeping a fixed duration for the whole video, in which case you can get rid of the input argument and simply set the framerate to a constant.</li>
</ul>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-0e47273b wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="FedEx Day Timelapse 1" width="500" height="375" src="https://www.youtube.com/embed/jfp4BhVoWIA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="FedEx Day Timelapse 2" width="500" height="375" src="https://www.youtube.com/embed/V9R65scuHj0?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>
</div>
</div>



<p class="wp-block-paragraph">Learn more about DMC&#8217;s <a href="https://static.dmcinfo.com/services/embedded-development-and-embedded-programming"><strong>embedded design expertise</strong></a>.&nbsp;</p>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://static.dmcinfo.com/blog/22333/how-to-make-a-simple-time-lapse-ip-web-camera-using-a-raspberry-pi/">How To Make a Simple Time-lapse IP Web Camera Using a Raspberry Pi</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>BlueGecko BGScript Development with VScode</title>
		<link>https://static.dmcinfo.com/blog/24770/bluegecko-bgscript-development-with-vscode/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Tue, 10 Jan 2017 11:48:13 +0000</pubDate>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[IoT]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/24770/bluegecko-bgscript-development-with-vscode/</guid>

					<description><![CDATA[<p>This tutorial will outline the process to configure Visual Studio Code for developing Blue Gecko script code. It assumes you have some familiarity with the BlueGecko scripting language. If not, check out the developer guide. Blue Gecko scripting is a high level programming language designed for the Silicon Labs line of Blue Gecko Bluetooth modules. Installation Configure Tools [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/24770/bluegecko-bgscript-development-with-vscode/">BlueGecko BGScript Development with VScode</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">This tutorial will outline the process to configure Visual Studio Code for developing Blue Gecko script code. It assumes you have some familiarity with the BlueGecko scripting language. If not, check out the <a href="https://www.silabs.com/documents/public/user-guides/ug209-bgscript-scripting-language.pdf" target="_blank" rel="noreferrer noopener">developer guide</a>. Blue Gecko scripting is a high level programming language designed for the Silicon Labs line of Blue Gecko Bluetooth modules.</p>



<h2 class="wp-block-heading" id="h-installation">Installation</h2>



<ol class="wp-block-list">
<li>Download and install the BLE <a href="http://www.silabs.com/products/wireless/bluetooth/bluetooth-smart-modules/Pages/bluegiga-bluetooth-smart-software-stack.aspx" target="_blank">SDK</a> and the <a href="http://www.silabs.com/products/wireless/bluetooth/bluetooth-smart-modules/Pages/bluegiga-bluetooth-smart-software-stack.aspx" target="_blank">BLE Update Tool</a> using the default location and agree&nbsp;to licenses.&nbsp;

 

 
 
<p class="wp-block-paragraph">These installs provide&nbsp;the complier and some example code as well as the download tool to push the compiled code to the Bluetooth chip. Wait to restart your system until you have completed the next step of installing Visual Studio Code.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/BGS-Blog-Download-Page.png" alt="Screenshot of download page "/></figure>
</li>



<li>Download and install <a href="https://code.visualstudio.com/download">Visual Studio Code</a> using the default location and agree&nbsp;to licenses.&nbsp;
 

 
 
<p class="wp-block-paragraph">I recommend selecting <strong>Add &#8220;Open with Code&#8221; action to Windows Explorer file context menu </strong>and <strong>Add &#8220;Open with Code&#8221; action to Windows Explorer directory context menu</strong> from the list of Additional Tasks. This will provide quick right-click functionality to open our BGScript project later.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/BGS-Blog-VSCode-Config.png" alt="Screenshot of Setup Configuration for Visual Studio Code"/></figure>
</li>



<li>Restart your system now so that the BLE SDK, the BLE Update Tool, and Visual Studio Code can finish their installations.&nbsp;</li>
</ol>



<h2 class="wp-block-heading" id="h-configure-tools">Configure Tools</h2>



<p class="wp-block-paragraph">Now that all our tools are installed, let’s configure VScode so that we can compile and download our BGScript code straight from the editor.&nbsp;</p>



<ol class="wp-block-list">
<li>Open Windows explorer, and navigate to:&nbsp;
 

 

 
 
<p class="wp-block-paragraph"><strong><span style="font-family: courier new;">C:\Bluegiga\ble-1.4.2-130\example\&lt;your device&gt;\bgdemo&nbsp;</span></strong></p>



<p class="wp-block-paragraph">If you didn&#8217;t use the default location for the BLE SDK, or if the version of the SDK has been updated, your path will be different. I&#8217;m using the BLE113, so my path is:</p>



<p class="wp-block-paragraph"><strong><span style="font-family: courier new;">C:\Bluegiga\ble-1.4.2-130\example\dkble113\bgdemo</span></strong></p>
</li>



<li>Right click in the window and select <strong>Open with Code</strong>. This will open all of the files in the folder in a new instance of VScode.&nbsp;
 
 
<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/BGS-Blog-Open-With-Code.png" alt="Screenshot of Windows Explorer, Open with Code menu selection"/></figure>
</li>



<li>In VScode, type the hot key <strong>Ctrl+Shift+P</strong> to open the Command Palette, and then type <strong>Task </strong>to bring up the options with the keyword &#8220;Task&#8221;.
 
 
<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/BGS-Blog-Configure-Task-Runner.png" alt="Visual Studio Code Command Palette - selecting Tasks: Configure Task Runner"/></figure>
</li>



<li>Select <strong>Tasks: Configure Task Runner</strong>. This opens some of the defaults tasks in VSCode, but we want to create a custom one, so select <strong>Others</strong>. This will create a .vscode folder in our working directory with a tasks.json file.&nbsp;
 

 

 
 
<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/BGS-Blog-Select-Other-Task.png" alt="Selecting Others in the Visual Studio Code Command Palette "/></figure>



<p class="wp-block-paragraph">The task.json defines all the parameters and functionality of the task. It is configured by default to print &#8220;Hello World&#8221; to the terminal in VScode.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/BGS-Blog-Hello-World.png" alt="Visual Studio Code display output of &quot;Hello World&quot;"/></figure>
</li>



<li>Type <strong>Ctrl+Shift+B</strong>. This will run our new task, and you should see the terminal open in VScode and display &#8220;Hello World&#8221;
 
 
<p class="wp-block-paragraph">We&#8217;ll update this task to compile our BGScript software instead of the default functionality when we type Ctrl+Shift+B. Since we&#8217;ll also need a task to download the compiled hex file to the Bluetooth module, we&#8217;ll need to modify this single task to handle multiple tasks.&nbsp;</p>
</li>



<li>Download the attached task.json file and replace your current tasks.json file. With this new file, instead of calling the &#8216;echo&#8217; command, we&#8217;ll call the Windows ‘cmd’ command and pass it different executables and files based on which task we want to run.&nbsp;</li>
</ol>



<h2 class="wp-block-heading" id="h-running-tasks">Running Tasks</h2>



<p class="wp-block-paragraph">For the top level ‘args’, we use /C as a placeholder for the actual arguments we&#8217;ll pass based on the task we want to run. Each task inside the main task has an arbitrary name and arguments to pass back to the cmd command.&nbsp;</p>



<ol class="wp-block-list">
<li>Pass the first task, defined as <strong>Build</strong>

 
 
<p class="wp-block-paragraph">The <strong><span style="font-family: courier new;">&#8220;isBuildCommand&#8221;: true</span></strong> tells VScode that if we type Ctrl+Shift+B, it should run this specific task. There are a few other hot key tasks, but this is the only one we&#8217;ll use.&nbsp;</p>
</li>



<li>Pass the next task, defined as <strong>Download</strong>. This task will download the compiled code to the module.&nbsp;</li>



<li><strong>Remember to change the path if you didn&#8217;t keep the default installation directory.&nbsp;</strong>
 
 
<p class="wp-block-paragraph">Looking back at the args for the Build command, we can see that it will call the bgbuild executable that was installed with the SDK.</p>
</li>



<li><strong>Make sure you don&#8217;t have multiple BGScript projects in a single directory.&nbsp;</strong></li>
</ol>



<p class="wp-block-paragraph">When the bgbuild.exe is called, it expects a bgproj file that it will compile. The *.bgproj gets the first bgproj file from the working directory.</p>



<h3 class="wp-block-heading" id="h-download-task">Download Task</h3>



<p class="wp-block-paragraph">The args for the Download task are in the&nbsp;command line update tool (bleupdate-cli.exe), which was part of the SDK installation.&nbsp;</p>



<p class="wp-block-paragraph">The bleupdate-cli.exe takes a command, (list, update, get, set) as its first argument. Since we want to update the module, we&#8217;ll pass &#8216;update&#8217; as the command and pass the compiled hex&nbsp;file which was created from our Build task.&nbsp;</p>



<p class="wp-block-paragraph"><strong>Again, make sure there is only a single .hex file in the working directory to ensure we&#8217;re downloading the correct hex file</strong>.&nbsp;</p>



<h3 class="wp-block-heading" id="h-viewing-the-output">Viewing the Output</h3>



<p class="wp-block-paragraph">The last task combines both features into a single task that will build the project and then immediately download it to the Bluetooth module.</p>



<p class="wp-block-paragraph">Now, if you type <strong>Ctrl+Shift+B</strong>, you should see the output of bgbuild.exe for the demo application that we&#8217;re working with.&nbsp;</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/BGS-Blog-bgbuild.png" alt="Visual Studio Code bgbuild.exe output"/></figure>



<ol class="wp-block-list">
<li>Type <strong>Ctrl+Shift+P</strong> to download the hex file so we can run the task from the command palette, then type <strong>Tasks: Run Task</strong> and click <strong>Enter</strong>. You&#8217;ll then see a list of the three tasks that we have defined.&nbsp;</li>



<li>Select <strong>Download</strong> to download the already compiled hex file, or select <strong>Build &amp; Download</strong> to recompile the project before downloading.&nbsp;</li>
</ol>



<h3 class="wp-block-heading" id="h-keybinding-shortcut">Keybinding Shortcut</h3>



<p class="wp-block-paragraph">Now we can quickly compile our BGScript project with <strong>Ctrl+Shift+B</strong>, but it&#8217;s quite a bit of typing to run the other tasks, so let’s create a quick key binding shortcut so that when we press the F6 key, we&#8217;ll immediately be presented with our available tasks, and then we can select the one we want.</p>



<ol class="wp-block-list">
<li>Open the command palette again with <strong>Ctrl+Shift+P</strong> and type <strong>Keyboard</strong>. The only option should be <strong>Preferences: Open Keyboard Shortcuts.</strong>&nbsp;Select it, and two files should open next to each other.

 
 
<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/BGS-Blog-Keybinding.png" alt="Visual Studio Code Command Palette - selecting open keyboard shortcuts"/></figure>
</li>



<li>In the keybindings.json file on the right, enter <strong><span style="font-family: courier new;">{&#8220;key&#8221;: &#8220;f6&#8221;, &#8220;command&#8221;: &#8220;workbench.action.tasks.runTask&#8221;}</span></strong> inside the square brackets.</li>



<li>Save the keybindings.json and close it. Close the Default Keyboard Shortcuts file as well.</li>
</ol>



<p class="wp-block-paragraph">Pressing F6 will now open the command palette with our available tasks available to select.</p>



<p class="wp-block-paragraph">Now that VScode functions more like an IDE rather than a basic text editor, in the next blog I&#8217;ll go through setting up text highlighting to make development easier.</p>



<p class="wp-block-paragraph">Learn more about&nbsp;<a href="/services/embedded-development-and-embedded-programming">DMC&#8217;s Custom Software and Hardware Services</a>.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/24770/bluegecko-bgscript-development-with-vscode/">BlueGecko BGScript Development with VScode</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Automatically Change Windows System Sounds</title>
		<link>https://static.dmcinfo.com/blog/24878/automatically-change-windows-system-sounds/</link>
		
		<dc:creator><![CDATA[Frank May]]></dc:creator>
		<pubDate>Mon, 21 Nov 2016 08:21:33 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Scripting]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/24878/automatically-change-windows-system-sounds-2/</guid>

					<description><![CDATA[<p>Have you ever said: “UGH, these Windows system sounds are so bland” And then wished you could change them to something better, and do it to all your company computers, but didn’t want to go through the hassle of clicking through Windows system settings while explaining to your coworkers what you’re doing to their computer? [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/24878/automatically-change-windows-system-sounds/">Automatically Change Windows System Sounds</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Have you ever said:</p>



<p class="wp-block-paragraph">“UGH, these Windows system sounds are so bland”</p>



<p class="wp-block-paragraph">And then wished you could change them to something better, and do it to all your company computers, but didn’t want to go through the hassle of clicking through Windows system settings while explaining to your coworkers what you’re doing to their computer?</p>



<p class="wp-block-paragraph">ME TOO!</p>



<p class="wp-block-paragraph"><iframe frameborder="0" height="144" scrolling="no" src="https://www.youtube.com/embed/bp-CF1FM5e0" width="256"></iframe></p>



<p class="wp-block-paragraph">That’s why I made an executable that does all this with a double click. Below is how you can do it, too:</p>



<ol class="wp-block-list">
<li>Find the sound clips you want to use for system sounds, and convert them to a .wav file format. There are a bunch of free sites online that do this for you.</li>



<li>Trim down the sound clips using any audio editor. I used Audacity. I recommend sounds clips no longer than 3 seconds, but there’s nothing stopping you from having the full Kanye album play whenever you open a file/get an email/empty the recycle bin.</li>



<li>Create a text file in the same folder that has your sound clips. Give it whatever name you want, but change the file extension to .bat. If you can’t see the file extension, you’ll have to enable viewing system file extensions.</li>



<li>Open a text editor and open this file in the text editor. I like to use Notepad++.</li>



<li>What you have now is a .bat file that you can write code in and it will execute that code whenever it’s double clicked, we’ll put in some code that changes system sounds.</li>



<li>Copy and paste the code below into your bat file, and change the file names to items that you have.</li>
</ol>



<p class="wp-block-paragraph">REM The line of code below plays a sound whenever this script runs. Not necessary, but I like it<br>Start powershell -WindowStyle hidden -c (New-Object Media.SoundPlayer &#8220;aheh.wav&#8221;).PlaySync();<br>REM&nbsp;&nbsp; &nbsp;Start powershell&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Starts a powershell window that will run an audio player, just&nbsp;<br>REM -WindowStyle hidden &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Makes the window that this code runs in hidden from view<br>REM -c&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>REM (New-Object Media.SoundPlayer &nbsp;&nbsp; &nbsp;Creates a new object that&#8217;s a sound player&nbsp;<br>REM &#8220;aheh.wav&#8221;).PlaySync();&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Specifies the sound clip &#8220;aheh.wav&#8221; and tell our sound player to play it</p>



<p class="wp-block-paragraph">REM The line of code below makes a file path to store the sounds in, only if it doesn&#8217;t already exist<br>if not exist &#8220;C:\WindowsKanyeSounds&#8221; mkdir &#8220;C:\WindowsKanyeSounds&#8221;&nbsp;<br>REM if not exist &#8220;C:\WindowsKanyeSounds&#8221;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Checks if the file location exists<br>REM This copies the local .exe files to the new file path in the music folder.</p>



<p class="wp-block-paragraph">REM The next few lines of code copy local files &#8220;uh.wav&#8221; and &#8220;oo.wav&#8221; to the new file path we made on earlier line<br>echo f | xcopy /f &#8220;%~dp0\uh.wav&#8221; &#8220;C:\WindowsKanyeSounds&#8221;<br>echo f | xcopy /f &#8220;%~dp0\oo.wav&#8221; &#8220;C:\WindowsKanyeSounds&#8221;&nbsp;<br>REM echo f &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;This bypasses having a user answer yes/no/all if asked to overwrite existing files<br>REM xcopy &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Copies files and directories, including subdirectories.<br>REM /f &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;displays full source and destination file names when copying<br>REM &#8220;%~dp0&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;This gets the file path of the folder the file is running in</p>



<p class="wp-block-paragraph">REM This changes the system sounds to the new files<br>REM It gets into the registry, adds a new scheme, and changes two of the sounds to the sounds we just made<br>@reg add &#8220;HKEY_CURRENT_USER\AppEvents\Schemes&#8221; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /t REG_SZ /d &#8220;.KanyeTest&#8221; &nbsp;/f<br>@reg add &#8220;HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\.Current&#8221; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /t REG_SZ /d &#8220;&#8221; &nbsp; &nbsp; &nbsp; /f<br>@reg add &#8220;HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\DeviceConnect\.Current&#8221; &nbsp; &nbsp; &nbsp; &nbsp;/t REG_SZ /d &#8220;C:\WindowsKanyeSounds\uh.wav&#8221; &nbsp; &nbsp; &nbsp; /f<br>@reg add &#8220;HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\DeviceDisconnect\.Current&#8221; &nbsp; &nbsp; &nbsp;/t REG_SZ /d &#8220;C:\WindowsKanyeSounds\oo.wav&#8221; &nbsp; &nbsp; &nbsp; /f<br>REM @reg add &#8220;item&#8221;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;this goes to the item in the registry&nbsp;<br>REM /t &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;this parameter specifies the type for the registry entry<br>REM REG_SZ&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;this the registry type, a null-terminated string<br>REM /d &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;this parameter specifies the data for the new registry entry&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>REM /f&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;this adds the registry entry without prompting for confirmation.</p>



<p class="wp-block-paragraph">REM waits for 3sec so Kanye laughs when the code completes<br>REM this was a quick fix for something I didn&#8217;t want to troubleshoot<br>TIMEOUT 3</p>



<p class="wp-block-paragraph">7. Save the file and double click to run it.</p>



<p class="wp-block-paragraph">You’re free to drag &amp; drop all these files onto a USB stick and run whenever you want. BUT. You can streamline the process even more by converting this .bat file into an .exe file. I used this <a href="http://download.cnet.com/Bat-To-Exe-Converter-Portable/3000-2069_4-10555897.html">free .bat to .exe file converter </a>and had the settings so it ran as an invisible application in a temporary directory and deleted temporary files at exit. I had to also click the &#8220;include&#8221; tab and include the sound files I was using. </p>



<p class="wp-block-paragraph">If you want to change system sound settings back to defaults, type “change system sounds” in the Windows search bar, and change the Sound Scheme from (modified) to Windows Default.</p>



<p class="wp-block-paragraph">&nbsp;</p>
<p>The post <a href="https://static.dmcinfo.com/blog/24878/automatically-change-windows-system-sounds/">Automatically Change Windows System Sounds</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Hide Fields on a SharePoint Form</title>
		<link>https://static.dmcinfo.com/blog/25912/how-to-hide-fields-on-a-sharepoint-form/</link>
		
		<dc:creator><![CDATA[Curtis Weir]]></dc:creator>
		<pubDate>Tue, 02 Feb 2016 12:23:02 +0000</pubDate>
				<category><![CDATA[Digital Workplace Solutions]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Scripting]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/25912/how-to-hide-fields-on-a-sharepoint-form/</guid>

					<description><![CDATA[<p>Hiding fields in a SharePoint form can be tedious, or sometimes not even possible using out-of-the-box features. One common solution is to modify the forms in SharePoint Designer. However, this takes time and is prone to user error. A simpler solution is to use Javascript &amp; jQuery, and the following code outlines how to hide [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/25912/how-to-hide-fields-on-a-sharepoint-form/">How to Hide Fields on a SharePoint Form</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Hiding fields in a SharePoint form can be tedious, or sometimes not even possible using out-of-the-box features. One common solution is to modify the forms in SharePoint Designer. However, this takes time and is prone to user error.</p>



<p class="wp-block-paragraph">A simpler solution is to use Javascript &amp; jQuery, and the following code outlines how to hide any field on your SharePoint form. If you are unfamiliar with Javascript, no problem! Just edit the <em>fieldsToHide</em> line with whatever fields you wish to hide. Separate fields using commas, and surround each field with quotations.</p>



<p class="wp-block-paragraph">If you would like to understand how the code works in detail, read the following section. If not, skip to Adding the Code to Your SharePoint Site.</p>



<h2 class="wp-block-heading" id="h-the-code">The Code</h2>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;script src="//code.jquery.com/jquery-latest.min.js">&lt;/script>
&lt;script>
	function HideFields() {
		//Enter the fields you would like to hide here.
		fieldsToHide = &#91;"Enter", "Field Names", "Here"&#93;;
	
		//Get all SharePoint fields
		var formFieldTitles = $(".ms-formtable td.ms-formlabel h3.ms-standardheader");

		//Iterate over each row in the form
		formFieldTitles.each(function () {
			//Get the text of the field title
			var textToMatch = $(this).text();
			//Get the table row associated with this title
			var currentRow = $(this).closest('tr');

			//Iterate over our list of fields we wish to hide
			for (var i = 0; i &lt; fieldsToHide.length; i++){
				var field = fieldsToHide&#91;i&#93;;
				//Match the SharePoint field name to our field name
				if (textToMatch.toLowerCase().replace("*", "").trim() === field.toLowerCase().replace("*", "").trim()){
					//Hide this field
					$(currentRow).hide();
				}
			}
		});
	}

	function AddToBodyOnLoad(){
		//Ensure that our function is called last by pushing it again
		_spBodyOnLoadFunctionNames.push("HideFields");
	}

	//Add our function to the array of onload functions
	_spBodyOnLoadFunctionNames.push("AddToBodyOnLoad");
&lt;/script></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">script</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">src</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;//code.jquery.com/jquery-latest.min.js&quot;</span><span style="color: #808080">&gt;&lt;/</span><span style="color: #569CD6">script</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">script</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	function HideFields() </span><span style="color: #569CD6">{</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #6A9955">//Enter the fields you would like to hide here.</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #9CDCFE">fieldsToHide</span><span style="color: #D4D4D4"> = &#91;</span><span style="color: #CE9178">&quot;Enter&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;Field Names&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;Here&quot;</span><span style="color: #D4D4D4">&#93;;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #6A9955">//Get all SharePoint fields</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #9CDCFE">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">formFieldTitles</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">$</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;.ms-formtable td.ms-formlabel h3.ms-standardheader&quot;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #6A9955">//Iterate over each row in the form</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #9CDCFE">formFieldTitles</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">each</span><span style="color: #D4D4D4">(</span><span style="color: #569CD6">function</span><span style="color: #D4D4D4"> () {</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #6A9955">//Get the text of the field title</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #569CD6">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">textToMatch</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">$</span><span style="color: #D4D4D4">(</span><span style="color: #569CD6">this</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">text</span><span style="color: #D4D4D4">();</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #6A9955">//Get the table row associated with this title</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #569CD6">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">currentRow</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">$</span><span style="color: #D4D4D4">(</span><span style="color: #569CD6">this</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">closest</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&apos;tr&apos;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #6A9955">//Iterate over our list of fields we wish to hide</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #C586C0">for</span><span style="color: #D4D4D4"> (</span><span style="color: #569CD6">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4"> = </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">; </span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4"> &lt; </span><span style="color: #9CDCFE">fieldsToHide</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">length</span><span style="color: #D4D4D4">; </span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4">++){</span></span>
<span class="line"><span style="color: #D4D4D4">				</span><span style="color: #569CD6">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">field</span><span style="color: #D4D4D4"> = </span><span style="color: #9CDCFE">fieldsToHide</span><span style="color: #D4D4D4">&#91;</span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4">&#93;;</span></span>
<span class="line"><span style="color: #D4D4D4">				</span><span style="color: #6A9955">//Match the SharePoint field name to our field name</span></span>
<span class="line"><span style="color: #D4D4D4">				</span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (</span><span style="color: #9CDCFE">textToMatch</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">toLowerCase</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">replace</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;*&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;&quot;</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">trim</span><span style="color: #D4D4D4">() === </span><span style="color: #9CDCFE">field</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">toLowerCase</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">replace</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;*&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;&quot;</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">trim</span><span style="color: #D4D4D4">()){</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #6A9955">//Hide this field</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #DCDCAA">$</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">currentRow</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">hide</span><span style="color: #D4D4D4">();</span></span>
<span class="line"><span style="color: #D4D4D4">				}</span></span>
<span class="line"><span style="color: #D4D4D4">			}</span></span>
<span class="line"><span style="color: #D4D4D4">		});</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #569CD6">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">	function AddToBodyOnLoad()</span><span style="color: #569CD6">{</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #6A9955">//Ensure that our function is called last by pushing it again</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #9CDCFE">_spBodyOnLoadFunctionNames</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">push</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;HideFields&quot;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #569CD6">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">	//Add our function to the array of onload functions</span></span>
<span class="line"><span style="color: #D4D4D4">	_spBodyOnLoadFunctionNames.push(&quot;AddToBodyOnLoad&quot;);</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">script</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">The first line imports the jQuery library, which makes it easier to select and hide elements on a page. To learn more about jQuery, visit <a href="https://jquery.com/" target="_blank">their official website</a>.</p>



<p class="wp-block-paragraph">The first line in <em>HideFields()</em> defines which fields we are going to hide. This is the line that you should change to match the fields on your form, and add additional fields if desired.</p>



<p class="wp-block-paragraph">The <em>AddToBodyOnLoad()</em> function forces our function to be loaded last on the page. This ensures that the fields have been created and are viewable in the DOM.</p>



<p class="wp-block-paragraph">The <em>HideFields()</em> function iterates over each field on the form, then iterates over each field in our list of fields we want to hide. If there’s a match, the entire row is hidden from view. Unfortunately, we cannot remove this row from the DOM, since there will be unintended side-effects, and SharePoint will not be able to save the list item.</p>



<h2 class="wp-block-heading" id="h-adding-the-code-to-your-sharepoint-site">Adding the Code to Your SharePoint Site</h2>



<h3 class="wp-block-heading" id="h-sharepoint-2013-amp-office-365">SharePoint 2013 &amp; Office 365</h3>



<ol class="wp-block-list">
<li>Navigate to your SharePoint list.</li>



<li>In your browser url, replace <em>AllItems.aspx</em> with the name of the form (default forms are NewForm.aspx, EditForm.aspx, and DispForm.aspx).</li>



<li>Click the Gear icon in the top right, then “Edit Page”.</li>



<li>Click “Add a Web Part”.</li>



<li>Under “Categories”, select “Media and Content”.</li>



<li>Under “Parts”, select “Script Editor”.</li>



<li>On the new Web part, click “Edit Snippet”.</li>



<li>Copy the code from above, and paste the contents into the dialog.</li>



<li>Edit the 5<sup>th</sup> line with the fields you want to hide on this form.</li>



<li>Click “Insert”.</li>



<li>In the top left, click “Page”, then “Stop Editing”.</li>



<li>Your fields should now be hidden from view.</li>
</ol>



<h3 class="wp-block-heading" id="h-sharepoint-2010">SharePoint 2010</h3>



<ol class="wp-block-list">
<li>Navigate to your SharePoint list.</li>



<li>In your browser URL, replace <em>AllItems.aspx</em> with the name of the form (default forms are NewForm.aspx, EditForm.aspx, and DispForm.aspx).</li>



<li>Click the “Site Actions” in the top left, then “Edit Page”.</li>



<li>Click “Add a Web Part”.</li>



<li>Under “Categories”, select “Media and Content”.</li>



<li>Under “Parts”, select “Content Editor”.</li>



<li>On the new Web part, click “Click here to add new content”.</li>



<li>In the “Editing Tools” ribbon section, click “Format Text”.</li>



<li>In the “Markup” section, click “HTML”, then click “Edit HTML Source”.</li>



<li>Copy the code from above, and paste the contents into the dialog.</li>



<li>Edit the 5<sup>th</sup> line with the fields you want to hide on this form.</li>



<li>Click “OK”.</li>



<li>In the top left, click “Page”, then “Stop Editing”.</li>



<li>Your fields should now be hidden from view.</li>
</ol>



<p class="wp-block-paragraph"><a href="/services/digital-workplace-solutions/microsoft-consulting-services/sharepoint">Learn more about DMC&#8217;s SharePoint services.</a></p>



<p class="wp-block-paragraph"><a href="/contact">Contact us</a> for <a href="/services/digital-workplace-solutions/microsoft-consulting-services/sharepoint">SharePoint</a> consulting.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/25912/how-to-hide-fields-on-a-sharepoint-form/">How to Hide Fields on a SharePoint Form</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Automating Web Development &#8211; Tools</title>
		<link>https://static.dmcinfo.com/blog/26709/automating-web-development-tools/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Tue, 07 Apr 2015 12:27:34 +0000</pubDate>
				<category><![CDATA[Web Application Development]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Dot Net Nuke]]></category>
		<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/26709/automating-web-development-tools/</guid>

					<description><![CDATA[<p>I’ve been working on a new DNN skin for a while now and much progress is being made. Along the way, I’ve learned about tools that can help speed up website development drastically. In this blog post, I’ll give an overview of these tools and how to use them by themselves and together to harness [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/26709/automating-web-development-tools/">Automating Web Development &#8211; Tools</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I’ve been working on a new DNN skin for a while now and much progress is being made. Along the way, I’ve learned about tools that can help speed up website development drastically. In this blog post, I’ll give an overview of these tools and how to use them by themselves and together to harness the power of automation and simplify development tasks.</p>



<h2 id="h-tools" class="wp-block-heading">Tools</h2>



<ul class="wp-block-list">
<li><a href="#ruby">Ruby</a></li>



<li><a href="#sass-or-less">Sass (or Less)</a></li>



<li><a href="#nodejs">Node.js</a></li>



<li><a href="#npm">npm</a></li>



<li><a href="#bower">Bower</a></li>



<li><a href="#grunt-or-gulp">Grunt or gulp</a></li>
</ul>



<h3 id="ruby" class="wp-block-heading">Ruby</h3>



<p class="wp-block-paragraph">We won’t be using Ruby as a programming language, but we will be needing it to install SASS.</p>



<p class="wp-block-paragraph">If you’re on Windows, download the <a href="https://rubyinstaller.org/" type="link" id="https://rubyinstaller.org/" target="_blank" rel="noreferrer noopener">latest version of Ruby</a></p>



<p class="wp-block-paragraph">If you’re on Linux or OS X, there are <a href="https://rvm.io/rvm/install" type="link" id="https://rvm.io/rvm/install" target="_blank" rel="noreferrer noopener">instructions you can follow</a></p>



<p class="wp-block-paragraph">Or, after installing cURL, run this in a terminal window:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Bash</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>\curl -sSL https://get.rvm.io/ | bash</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #DCDCAA">\curl</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-sSL</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">https://get.rvm.io/</span><span style="color: #D4D4D4"> | </span><span style="color: #DCDCAA">bash</span></span></code></pre></div>



<p class="wp-block-paragraph">Once Ruby has finished installing, no matter what platform you’re on, open a terminal window and run</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Bash</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>ruby -v</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #DCDCAA">ruby</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-v</span></span></code></pre></div>



<p class="wp-block-paragraph">to ensure it has installed properly.</p>



<h3 id="sass-or-less" class="wp-block-heading">Sass (Syntactically Awesome Style Sheets) or Less</h3>



<p class="wp-block-paragraph">Sass is basically CSS with a ton of awesome features layered on top. Using Sass, which compiles to clean and efficient CSS, one can make use of extended abilities like variables, mixing, inline imports, and more.</p>



<p class="wp-block-paragraph">There is another CSS extension called Less, which is an alternative to Sass. I prefer Sass, but you could definitely adapt this tutorial to work with Less as well.</p>



<p class="wp-block-paragraph">Anyhow, now that Ruby is installed and ready to go, installing Sass is easy.</p>



<p class="wp-block-paragraph">In a terminal window, type</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Bash</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>gem install sass</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #DCDCAA">gem</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">install</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">sass</span></span></code></pre></div>



<p class="wp-block-paragraph">Once that is finished, run</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Bash</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>sass -v</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #DCDCAA">sass</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">-v</span></span></code></pre></div>



<p class="wp-block-paragraph">to ensure it has installed properly.</p>



<h3 id="nodejs" class="wp-block-heading">Node.js</h3>



<p class="wp-block-paragraph">Node.js is tool that allows one to write simple JavaScript programs that create powerful applications.</p>



<p class="wp-block-paragraph">We’ll be using Node.js to power npm (node package manager), Bower, and Grunt.</p>



<p class="wp-block-paragraph"><a href="https://nodejs.org/download/" type="link" id="https://nodejs.org/download/" target="_blank" rel="noreferrer noopener">Grab the proper download for your platform</a></p>



<p class="wp-block-paragraph">To install Node.js on Windows or OS X, simply run the installers.</p>



<p class="wp-block-paragraph">On Linux, you can build Node.js by using these steps:</p>



<p class="wp-block-paragraph">Extract the downloaded archive and open a terminal window</p>



<p class="wp-block-paragraph">1. Navigate to where you extracted the archive</p>



<p class="wp-block-paragraph">2. Run</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>./configure</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">./</span><span style="color: #9CDCFE">configure</span></span></code></pre></div>



<p class="wp-block-paragraph">3. Run and wait patiently</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>make</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #9CDCFE">make</span></span></code></pre></div>



<p class="wp-block-paragraph">4. Run</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>sudo make install</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #9CDCFE">sudo</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">make</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">install</span></span></code></pre></div>



<p class="wp-block-paragraph">And you’ll be all set with Node.js.</p>



<h3 id="npm" class="wp-block-heading">npm</h3>



<p class="wp-block-paragraph">npm is the official package manager for Node.js. What this means is that using npm, one can install hundreds of different applications and tools that are built with Node.js.</p>



<p class="wp-block-paragraph">We’ll be using npm to install Bower and Grunt.</p>



<p class="wp-block-paragraph">npm comes installed with Node.js, so there are no additional steps required to install it.</p>



<h3 id="bower" class="wp-block-heading">Bower</h3>



<p class="wp-block-paragraph">Bower, much like npm, is a package manager. However, npm only deals with Node.js packages while Bower titles itself “a package manager for the web.” Using Bower, one can run a simple terminal command to download and install many different web libraries or frameworks, such as jQuery, Bootstrap, FontAwesome, and more.</p>



<p class="wp-block-paragraph">To install Bower, open a terminal window and type:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>npm install -g bower</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #9CDCFE">npm</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">install</span><span style="color: #D4D4D4"> -</span><span style="color: #9CDCFE">g</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">bower</span></span></code></pre></div>



<p class="wp-block-paragraph">(The -g flag is to install bower globally, so we can call it from the command line anywhere)</p>



<h3 id="grunt-or-gulp" class="wp-block-heading">Grunt or gulp</h3>



<p class="wp-block-paragraph">Grunt is a task runner that performs the time-consuming, repetitive tasks that come along with website development like minification, SASS compilation, and more.&nbsp;</p>



<p class="wp-block-paragraph">Thanks to npm, Grunt is just as easy to install as Bower:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>npm install -g grunt-cli</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #9CDCFE">npm</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">install</span><span style="color: #D4D4D4"> -</span><span style="color: #9CDCFE">g</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">grunt</span><span style="color: #D4D4D4">-</span><span style="color: #9CDCFE">cli</span></span></code></pre></div>



<p class="wp-block-paragraph">gulp (don’t you ever capitalize that g) is a similar tool that <em>should</em> provide better performance than Grunt because it uses Node.js’s streams.</p>



<p class="wp-block-paragraph">npm comes in handy once again. Install gulp with:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>npm install -g gulp</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #9CDCFE">npm</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">install</span><span style="color: #D4D4D4"> -</span><span style="color: #9CDCFE">g</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">gulp</span></span></code></pre></div>



<h2 id="h-beginning-automation" class="wp-block-heading">Beginning Automation</h2>



<p class="wp-block-paragraph">Now that we have all of the tools we need to begin, we can finally start creating an automated build system.</p>



<p class="wp-block-paragraph">There are tasks associated with web development that quickly become repetitive and mundane. Thankfully, we will no longer have to do these manually!</p>



<p class="wp-block-paragraph">The tasks that we can now automate are (in no particular order):</p>



<ul class="wp-block-list">
<li>Sass (or Less) compilation (converting our Sass or Less to standard CSS)</li>



<li>Concatenation (combining multiple files into one)</li>



<li>Minification (smushing text together to reduce the size, making it load faster)</li>



<li>Linting (automatically checking code for errors)</li>



<li>Copying of files (like fonts)</li>



<li>Adding vendor-specific prefixes to our CSS (ensuring compatibility across browsers)</li>



<li>Detecting features that we require a user’s browser to have</li>



<li>More that I can’t think of!</li>
</ul>



<p class="wp-block-paragraph">And best of all, the build system will be smart enough to understand when a particular file changes to prevent rebuilding the entire thing.</p>



<p class="wp-block-paragraph">Stay tuned for the next article! For now, you can always take a look at DMC&#8217;s <a href="/services/application-development/web-application-development">Web Application Development</a> services, where we can harness the technologies outlined above for your needs.</p>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://static.dmcinfo.com/blog/26709/automating-web-development-tools/">Automating Web Development &#8211; Tools</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
