<?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>Caleb Stoll, Author at DMC, Inc.</title>
	<atom:link href="https://static.dmcinfo.com/blog/author/calebs/feed/index.xml" rel="self" type="application/rss+xml" />
	<link></link>
	<description></description>
	<lastBuildDate>Tue, 16 Jun 2026 17:35:46 +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>Caleb Stoll, Author at DMC, Inc.</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Mayhem is Loose at DMC St. Louis</title>
		<link>https://static.dmcinfo.com/blog/22063/mayhem-is-loose-at-dmc-st-louis/</link>
		
		<dc:creator><![CDATA[Caleb Stoll]]></dc:creator>
		<pubDate>Wed, 13 Feb 2019 09:21:34 +0000</pubDate>
				<category><![CDATA[Culture]]></category>
		<category><![CDATA[St. Louis]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/22063/mayhem-is-loose-at-dmc-st-louis/</guid>

					<description><![CDATA[<p>Every month, all DMC offices meet via video conferencing to share information and catch up together. The most anticipated part of the meeting is the office update video. Each DMC office takes a turn updating the rest of the company on their new projects and fun events. They typically close out with a hilarious video.&#160; [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/22063/mayhem-is-loose-at-dmc-st-louis/">Mayhem is Loose at DMC St. Louis</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">Every month, all DMC offices meet via video conferencing to share information and catch up together. The most anticipated part of the meeting is the office update video. Each DMC office takes a turn updating the rest of the company on their new projects and fun events. They typically close out with a hilarious video.&nbsp;</p>

<p class="wp-block-paragraph">As a nod to the Allstate &ldquo;Mayhem&rdquo; commercials, DMC St. Louis did a parody of the notorious series, but&nbsp;with a factory automation twist. In what could&rsquo;ve been a completely preventable disaster, a hastily programmed robot on its first unattended shift is ready to wreak havoc on production.</p>

<p class="wp-block-paragraph">It showcases the damage that can be done without the correct integrator on the job, and that dropping &ldquo;The People&rsquo;s Elbow&rdquo; on some cardboard boxes can be fun at any age.</p>

<p class="wp-block-paragraph"><iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/G1twESOMxkA" width="560"></iframe></p>

<p class="wp-block-paragraph"><strong>Learn more about DMC&apos;s <a href="https://static.dmcinfo.com/latest-thinking/blog/articletype/categoryview/categoryid/13/just-plain-fun">company culture</a>.</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/22063/mayhem-is-loose-at-dmc-st-louis/">Mayhem is Loose at DMC St. Louis</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Custom Data Logging using a Siemens Comfort Panel and VB Script</title>
		<link>https://static.dmcinfo.com/blog/22797/custom-data-logging-using-a-siemens-comfort-panel-and-vb-script/</link>
		
		<dc:creator><![CDATA[Caleb Stoll]]></dc:creator>
		<pubDate>Wed, 08 Aug 2018 12:29:20 +0000</pubDate>
				<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[St. Louis]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/22797/custom-data-logging-using-a-siemens-comfort-panel-and-vb-script/</guid>

					<description><![CDATA[<p>I recently worked on a project that required the use of data logging. However, the formatting of Siemens&#8217; data logging was not ideal for this implementation. So, I made my own&#160;version of data logging using Visual Basic scripts on my Comfort Panel that create and append to a CSV file. One of the first things&#160;to [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/22797/custom-data-logging-using-a-siemens-comfort-panel-and-vb-script/">Custom Data Logging using a Siemens Comfort Panel and VB Script</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I recently worked on a project that required the use of data logging. However, the formatting of Siemens&#8217; data logging was not ideal for this implementation. So, I made my own&nbsp;version of data logging using Visual Basic scripts on my Comfort Panel that create and append to a CSV file.</p>



<p class="wp-block-paragraph">One of the first things&nbsp;to think about is where you want to store these logs. For Comfort Panels, you can access the onboard USB drive and the SD card slot via VBScript. You can also access a network shared drive if the HMI has been correctly networked. For this example, we&#8217;ll just be saving the logs to a USB flash drive inserted into the comfort panel, but if you&#8217;d prefer saving to a network folder, Siemens <a href="https://support.industry.siemens.com/cs/document/92346478/integrating-hmi-operator-panels-in-tcp-ip-networks-and-access-to-a-nas-or-to-a-shared-windows-folder?dti=0&amp;lc=en-WW">has a post that explains</a> how to correctly network, set up user administration, and share a folder with the HMI.</p>



<h2 class="wp-block-heading" id="h-step-1-determine-folder-location-and-file-name"><strong>Step 1: Determine Folder Location and File Name</strong></h2>



<p class="wp-block-paragraph">Open up an empty Visual Basic script in TIA Portal&nbsp;and determine the folder location and file name that you would like to use. &#8220;\Storage Card USB\&#8221; and &#8220;\Storage Card SD\&#8221; will be the locations for the onboard USB port and SD card, respectively. I&#8217;ll be creating a file name that includes the current date. Including the current&nbsp;date in the file name will allow us to have a different file for each day, to limit the file size, and also help organize the data a bit better.</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">VBScript</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>Dim fileName, folderName, fileLocation
fileName = Year(Now()) &amp; "_" &amp; Month(Now()) &amp; "_" &amp; Day(Now()) &amp; ".csv"
folderName = "\Storage Card USB\Logs\"
fileLocation = folderName &amp; filename</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">Dim</span><span style="color: #9CDCFE"> fileName, folderName</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> fileLocation</span></span>
<span class="line"><span style="color: #9CDCFE">fileName</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">Year</span><span style="color: #D4D4D4">(</span><span style="color: #DCDCAA">Now</span><span style="color: #D4D4D4">()) &amp; </span><span style="color: #CE9178">&quot;_&quot;</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #DCDCAA">Month</span><span style="color: #D4D4D4">(</span><span style="color: #DCDCAA">Now</span><span style="color: #D4D4D4">()) &amp; </span><span style="color: #CE9178">&quot;_&quot;</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #DCDCAA">Day</span><span style="color: #D4D4D4">(</span><span style="color: #DCDCAA">Now</span><span style="color: #D4D4D4">()) &amp; </span><span style="color: #CE9178">&quot;.csv&quot;</span></span>
<span class="line"><span style="color: #9CDCFE">folderName</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;\Storage Card USB\Logs\&quot;</span></span>
<span class="line"><span style="color: #9CDCFE">fileLocation</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> folderName</span><span style="color: #D4D4D4"> &amp;</span><span style="color: #9CDCFE"> filename</span></span></code></pre></div>



<h2 class="wp-block-heading" id="h-step-2-create-a-new-object-amp-folder-structure"><strong>Step 2: Create a New Object &amp; Folder Structure</strong></h2>



<p class="wp-block-paragraph">Create a new FileCtl.FileSystem object. Now we can create the required folder structure if there is one. We use the Dir method to check if our folder currently exists. If not, then we use the MkDir method to create the folder.&nbsp;</p>



<p class="wp-block-paragraph">I added some error handling to my script so that if there is a problem executing this command, it will get displayed on an alarm window that I have in my project.</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">VBScript</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>'Continue even if there is an error
On Error Resume Next
                
                'Create File System Object
                Set fso = CreateObject("FileCtl.FileSystem")
                'Check if the folder already exists
                If (fso.Dir(folderName)) = "" Then
                                fso.MkDir folderName
                End If
                                
                If Err.Number &lt;> 0 Then
                                ShowSystemAlarm "Error # " &amp; CStr(Err.Number)&amp; " " &amp; Err.Description
                                Err.Clear
                End If</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">&apos;Continue even if there is an error</span></span>
<span class="line"><span style="color: #569CD6">On Error Resume Next</span></span>
<span class="line"><span style="color: #D4D4D4">                </span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #6A9955">&apos;Create File System Object</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">fso</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">CreateObject</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;FileCtl.FileSystem&quot;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #6A9955">&apos;Check if the folder already exists</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #C586C0">If</span><span style="color: #D4D4D4"> (fso.</span><span style="color: #DCDCAA">Dir</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">folderName</span><span style="color: #D4D4D4">)) = </span><span style="color: #CE9178">&quot;&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">Then</span></span>
<span class="line"><span style="color: #D4D4D4">                                fso.MkDir folderName</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #C586C0">End If</span></span>
<span class="line"><span style="color: #D4D4D4">                                </span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #C586C0">If</span><span style="color: #D4D4D4"> Err.</span><span style="color: #9CDCFE">Number</span><span style="color: #D4D4D4"> &lt;&gt; </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">Then</span></span>
<span class="line"><span style="color: #D4D4D4">                                ShowSystemAlarm </span><span style="color: #CE9178">&quot;Error # &quot;</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #DCDCAA">CStr</span><span style="color: #D4D4D4">(Err.</span><span style="color: #9CDCFE">Number</span><span style="color: #D4D4D4">)&amp; </span><span style="color: #CE9178">&quot; &quot;</span><span style="color: #D4D4D4"> &amp; Err.Description</span></span>
<span class="line"><span style="color: #D4D4D4">                                Err.</span><span style="color: #DCDCAA">Clear</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #C586C0">End If</span></span></code></pre></div>



<h2 class="wp-block-heading" id="h-step-3-createobject-type-filectl-file"><strong>Step 3: CreateObject Type FileCtl.File</strong></h2>



<p class="wp-block-paragraph">Now that the folder structure exists, we will again use the “CreateObject” function, this time of type FileCtl.File. You&#8217;ll want to use the Open method, passing in the location and name of the file. The “8” indicates that we are opening this file for appending. This command will open the file if it currently exists, and create a new file if it does not.</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">VBScript</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>'Create FileCtl.File object
                Set fctl = CreateObject("FileCtl.File")
                
                'Open our csv file for appending
                fctl.Open fileLocation, 8
                
                If Err.Number &lt;> 0 Then
                                ShowSystemAlarm "Error # " &amp; CStr(Err.Number)&amp; " " &amp; Err.Description
                                Err.Clear
                End If</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">&apos;Create FileCtl.File object</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">fctl</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">CreateObject</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;FileCtl.File&quot;</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: #6A9955">&apos;Open our csv file for appending</span></span>
<span class="line"><span style="color: #D4D4D4">                fctl.Open fileLocation, </span><span style="color: #B5CEA8">8</span></span>
<span class="line"><span style="color: #D4D4D4">                </span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #C586C0">If</span><span style="color: #D4D4D4"> Err.</span><span style="color: #9CDCFE">Number</span><span style="color: #D4D4D4"> &lt;&gt; </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">Then</span></span>
<span class="line"><span style="color: #D4D4D4">                                ShowSystemAlarm </span><span style="color: #CE9178">&quot;Error # &quot;</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #DCDCAA">CStr</span><span style="color: #D4D4D4">(Err.</span><span style="color: #9CDCFE">Number</span><span style="color: #D4D4D4">)&amp; </span><span style="color: #CE9178">&quot; &quot;</span><span style="color: #D4D4D4"> &amp; Err.Description</span></span>
<span class="line"><span style="color: #D4D4D4">                                Err.</span><span style="color: #DCDCAA">Clear</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #C586C0">End If</span></span></code></pre></div>



<h2 class="wp-block-heading" id="h-step-4-format-the-csv-file"><strong>Step 4: Format the CSV File</strong></h2>



<p class="wp-block-paragraph">To format the CSV file with some column headers, you can use the “Loc” and “Seek” commands to cleverly determine if this is an empty CSV file. “Loc” will return the current position that is being read/written to, and “Seek” will return the next position to be read/written to. If both of these are “1”, then we have opened the file for the first time. If this is the case, you can use the LinePrint method to add comma separated column headers to the top of your file.</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">VBScript</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>currentPosition = fctl.Loc
                nextPosition = fctl.Seek
                
                'If we just created the file, write the header
                If currentPosition = 1 And nextPosition = 1 Then
                                fctl.LinePrint "Time, Data Point 1, Data Point 2, Data Point 3, Data Point 4, Data Point 5"
                End If</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">currentPosition</span><span style="color: #D4D4D4"> = fctl.Loc</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">nextPosition</span><span style="color: #D4D4D4"> = fctl.Seek</span></span>
<span class="line"><span style="color: #D4D4D4">                </span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #6A9955">&apos;If we just created the file, write the header</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">currentPosition</span><span style="color: #D4D4D4"> = </span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4"> And </span><span style="color: #9CDCFE">nextPosition</span><span style="color: #D4D4D4"> = </span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">Then</span></span>
<span class="line"><span style="color: #D4D4D4">                                fctl.LinePrint </span><span style="color: #CE9178">&quot;Time, Data Point 1, Data Point 2, Data Point 3, Data Point 4, Data Point 5&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #C586C0">End If</span></span></code></pre></div>



<h2 class="wp-block-heading" id="h-step-5-concatenate-data"><strong>Step 5: Concatenate Data</strong></h2>



<p class="wp-block-paragraph">Now you can concatenate all of your data into a comma-separated format and use the LinePrint method again to write to the CSV file. In my example, I&#8217;m using different time functions to create a timestamp for all of my data values to make each one unique.</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">VBScript</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>currentTime = Hour(Time) &amp; ":" &amp; Minute(Time) &amp; ":" &amp; Second(Time)
                'Create our comma separated string of data values
                dataValues = currentTime &amp; _
                                SmartTags("DataPoint1") &amp; ", " &amp; _
                                SmartTags("DataPoint2") &amp; ", " &amp; _
                                SmartTags("DataPoint3") &amp; ", " &amp; _
                                SmartTags("DataPoint4") &amp; ", " &amp; _
                                SmartTags("DataPoint5")

fctl.LinePrint dataValues
                fctl.Close</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">currentTime</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">Hour</span><span style="color: #D4D4D4">(</span><span style="color: #DCDCAA">Time</span><span style="color: #D4D4D4">) &amp; </span><span style="color: #CE9178">&quot;:&quot;</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #DCDCAA">Minute</span><span style="color: #D4D4D4">(</span><span style="color: #DCDCAA">Time</span><span style="color: #D4D4D4">) &amp; </span><span style="color: #CE9178">&quot;:&quot;</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #DCDCAA">Second</span><span style="color: #D4D4D4">(</span><span style="color: #DCDCAA">Time</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #6A9955">&apos;Create our comma separated string of data values</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">dataValues</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> currentTime</span><span style="color: #D4D4D4"> &amp;</span><span style="color: #9CDCFE"> _</span></span>
<span class="line"><span style="color: #D4D4D4">                                </span><span style="color: #DCDCAA">SmartTags</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;DataPoint1&quot;</span><span style="color: #D4D4D4">) &amp; </span><span style="color: #CE9178">&quot;, &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: #DCDCAA">SmartTags</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;DataPoint2&quot;</span><span style="color: #D4D4D4">) &amp; </span><span style="color: #CE9178">&quot;, &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: #DCDCAA">SmartTags</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;DataPoint3&quot;</span><span style="color: #D4D4D4">) &amp; </span><span style="color: #CE9178">&quot;, &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: #DCDCAA">SmartTags</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;DataPoint4&quot;</span><span style="color: #D4D4D4">) &amp; </span><span style="color: #CE9178">&quot;, &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: #DCDCAA">SmartTags</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;DataPoint5&quot;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">fctl.LinePrint dataValues</span></span>
<span class="line"><span style="color: #D4D4D4">                fctl.Close</span></span></code></pre></div>



<h2 class="wp-block-heading" id="h-step-6-trigger-the-script"><strong>Step 6: Trigger the Script</strong></h2>



<p class="wp-block-paragraph">Lastly, you just need something that will trigger the script to run. You have multiple options that provide varying levels of control.</p>



<ul class="wp-block-list">
<li>Scheduled Tasks can be used to trigger the script automatically across longer time periods (1 minute &#8211; 1 year).</li>



<li>HMI tags can also be used to trigger a VBScript if there is a specific program event that should cause information to be logged.</li>



<li>Lastly, a button event can also be used to call the script.</li>
</ul>



<p class="wp-block-paragraph"><strong>Find out more about DMC&#8217;s <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming">Siemens expertise</a>.</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/22797/custom-data-logging-using-a-siemens-comfort-panel-and-vb-script/">Custom Data Logging using a Siemens Comfort Panel and VB Script</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
