<?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>Iconics Archives | DMC, Inc.</title>
	<atom:link href="https://static.dmcinfo.com/blog/tag/iconics/feed/index.xml" rel="self" type="application/rss+xml" />
	<link></link>
	<description></description>
	<lastBuildDate>Fri, 04 Sep 2026 18:02:21 +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>Iconics Archives | DMC, Inc.</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Iconics GENESIS32 Upgrade Tips and Tricks</title>
		<link>https://static.dmcinfo.com/blog/16416/iconics-genesis32-upgrade-tips-and-tricks/</link>
		
		<dc:creator><![CDATA[Patrick Smith]]></dc:creator>
		<pubDate>Mon, 15 Apr 2024 12:44:18 +0000</pubDate>
				<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[GENESIS64]]></category>
		<category><![CDATA[Iconics]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/16416/iconics-genesis32-upgrade-tips-and-tricks/</guid>

					<description><![CDATA[<p>Iconics’ GENESIS64 software is a powerful SCADA platform built to take advantage of modern technologies. If you are still using the GENESIS32 platform, it is a perfect time to migrate your system! While the provided migration tools are very helpful to make the process as painless as possible, there are still some things that can [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/16416/iconics-genesis32-upgrade-tips-and-tricks/">Iconics GENESIS32 Upgrade Tips and Tricks</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Iconics’ GENESIS64 software is a powerful SCADA platform built to take advantage of modern technologies. If you are still using the GENESIS32 platform, it is a perfect time to migrate your system!</p>



<p class="wp-block-paragraph">While the provided migration tools are very helpful to make the process as painless as possible, there are still some things that can accidentally trip you up. Here are some tips to keep in mind when performing a conversion to GENESIS64.&nbsp;</p>



<h2 id="h-tip-1-remember-to-include-all-of-your-data-nbsp" class="wp-block-heading">Tip 1: Remember to include all of your data&nbsp;</h2>



<p class="wp-block-paragraph">When using the GENESIS32 Exporter tool to export your current data, you need to make sure that everything you want to migrate is included in your export project. GENESIS32 was designed as a very modular system:&nbsp;which means there are multiple components that all need to be included and no centralized place to manage them.</p>



<p class="wp-block-paragraph">While it is easy to remember all your GraphWorX files, you also need to include files such as your AlarmWorX server database. The exporter tool will convert them into an XML format that allows them to be easily imported into GENESIS64.&nbsp;</p>



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



<p class="wp-block-paragraph">If you do not have access to the database files, you can also work with a CSV export. These will not be automatically converted for you, but you can get them to work with GENESIS64 through a little manipulation. If you do so, avoid using Excel to modify the CSV file, as it is possible for the format to get altered in a way that makes it incompatible.&nbsp;</p>



<h2 id="h-tip-2-set-the-appropriate-options-when-importing-nbsp" class="wp-block-heading">Tip 2: Set the appropriate options when importing&nbsp;</h2>



<p class="wp-block-paragraph">In the ConverterWorX Importer utility of GENESIS64, there are many options available to customize how objects are migrated. While the defaults are reasonable, it is a good idea to go through and make sure the options that make sense for your application are checked. The options that are shown are context-sensitive, so, if you want to modify the options for AlarmWorX import, you will need to select an AlarmWorX object.&nbsp;</p>



<p class="wp-block-paragraph">Here are a few settings that I often change:</p>



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



<h4 id="h-translate-opc-da-tagnames-to-opc-ua-tagnames-nbsp" class="wp-block-heading">Translate OPC DA tagnames to OPC UA tagnames&nbsp;</h4>



<p class="wp-block-paragraph">Chances are, if you are converting from GENESIS32, your tags are using OPC DA. If you plan to continue using OPC DA in your new GENESIS64 application, make sure to uncheck this box; however, you will still have to go through and append “.Value” to your OPC DA tags to make them resolve correctly (hint: you can open your .gdfx file in a text editor and do this a bit faster).&nbsp;</p>



<h4 id="h-translate-object-name-to-valid-gwx64-name-nbsp" class="wp-block-heading">Translate object name to valid Gwx64 name&nbsp;</h4>



<p class="wp-block-paragraph">It is a good idea to check this option to make sure your imported objects do not end up with an invalid name.&nbsp;</p>



<h4 id="h-disable-using-classic-border-from-gen32-nbsp" class="wp-block-heading">Disable using classic border from Gen32&nbsp;</h4>



<p class="wp-block-paragraph">The Classic Border object was a useful way to organize objects in GENESIS32; however, I find that grouping is much simpler in GENESIS64, and I prefer to remove Classic Border objects by checking this box.&nbsp;</p>



<h4 id="h-convert-activex-controls-nbsp" class="wp-block-heading">Convert ActiveX Controls&nbsp;</h4>



<p class="wp-block-paragraph">You have the option to either try to convert any ActiveX controls (such as alarm viewers, grid viewers, etc.) to the .NET equivalent used in GENESIS64, or to replace them with placeholders.</p>



<p class="wp-block-paragraph">Replacing with placeholders will place a red rectangle with text indicating what type of control it is a placeholder for. The placeholder option is good if you plan to revise the controls as part of the migration; however, if you are planning to keep everything as similar as possible, the .NET controls will do a lot of the work for you.</p>



<p class="wp-block-paragraph">In my experience, there is sometimes a little cleaning up of the replaced controls required, but it still saves more time than configuring it from scratch. No matter which approach, I always recommend looking at your GENESIS32 and GENESIS64 configurations for these controls side by side, so you can verify that everything will be as similar as possible.&nbsp;</p>



<p class="wp-block-paragraph">Once you have your options set the way you want, go ahead and start the import, but read the next tip before you call it a day.&nbsp;</p>



<h2 id="h-tip-3-save-your-conversion-log-nbsp" class="wp-block-heading">Tip 3: Save your conversion log&nbsp;</h2>



<p class="wp-block-paragraph">The log generated by ConverterWorX is very helpful. Whenever you are doing an import, you should always review the log at the end and keep an eye out for any errors or warnings. Anything that could not be converted (such as scripts) will be noted. This makes the log a great reference for making sure you go through and migrate everything manually.</p>



<p class="wp-block-paragraph">There is a handy option to save the log as a CSV file for later reference. I like to put the log in version control with the other files so that I can easily pull it up when working through the migration process. You can even open the log in ConverterWorX to get the nice filtering options that it has.&nbsp;</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/gen64-converter-log.png" alt="Gen64 Converter Log"/></figure>



<h2 id="h-tip-4-rewrite-your-scripts-nbsp" class="wp-block-heading">Tip 4: Rewrite your scripts&nbsp;</h2>



<p class="wp-block-paragraph">One of the biggest challenges of migrating to GENESIS64 is that there is no automatic migration of scripts. GENESIS32 used two languages for scripting: VBScript and VBA. GENESIS64, on the other hand, uses JScript .NET. The syntax and structure of these languages are quite different, although VBScript is a little closer and can sometimes be quickly adapted with a little find/replace magic. Most of the time, though, it makes sense to rewrite the scripts from scratch.</p>



<p class="wp-block-paragraph">While JScript.NET is not a very prevalent language, it shares many similarities with other .NET languages such as C#. Here is where you can find the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=55979" type="link" id="https://www.microsoft.com/en-us/download/details.aspx?id=55979">documentation from Microsoft</a>, and Iconics has some additional documentation and examples <a href="https://docs.iconics.com/V10.97.2/GENESIS64/Help/Com/Intro/ICONICS_Product_Help.htm" target="_blank" rel="noreferrer noopener">on their site</a>, including the API documentation for the Iconics-specific libraries. The API documentation can also be referenced from within the code editor.&nbsp;</p>



<p class="wp-block-paragraph">While it would be impossible to cover every aspect of scripting without writing a medium-sized book, here are a few tips that I use in many projects:&nbsp;</p>



<h4 id="h-adding-references-nbsp" class="wp-block-heading">Adding References&nbsp;</h4>



<p class="wp-block-paragraph">Any other .NET-compatible code can be used inside your scripts if they are compiled into a DLL file. Iconics includes several for you to use that are required if you want to access libraries such as those for working with grid controls. You can find these in the GENESIS64 installation folder, inside the Components sub-folder.&nbsp;</p>



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



<h4 id="h-save-scripts-in-js-files-nbsp" class="wp-block-heading">Save Scripts in JS Files&nbsp;</h4>



<p class="wp-block-paragraph">You can save your developed scripts in files that allow them to be reused later. This can be helpful for developing a library of utility functions that get used on multiple projects. The Import function allows these scripts to be imported back into Iconics. Unfortunately, there is no Export function, so you will need to copy/paste your script into a text editor and save it as a .js file.&nbsp;</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/gen64-script-import.png" alt="Script Import"/></figure>



<h4 id="h-enable-intellisense-nbsp" class="wp-block-heading">Enable IntelliSense&nbsp;</h4>



<p class="wp-block-paragraph">The IntelliSense feature supports auto-completion of functions and shows helpful documentation. It can be enabled from the toolbar at the top of the script editor. Sometimes it is a little buggy and will not show up properly, but usually that is due to a syntax error in the script causing it to be interpreted incorrectly.&nbsp;</p>



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



<h2 id="h-tip-5-throw-away-your-scripts-nbsp" class="wp-block-heading">Tip 5: Throw away your scripts&nbsp;</h2>



<p class="wp-block-paragraph"><p paraeid="{7b6c588f-5365-4c35-ab4b-1d600614fedc}{47}" paraid="1044136516">The easiest way to write scripts is to not have to! GENESIS64 has more powerful out of the box functionality than GENESIS32, and you can often avoid writing scripts by just taking advantage of its features. Here are a few things that can be replicated without using scripts:&nbsp;</p></p>



<p class="wp-block-paragraph">1. Writing values to a SQL database. You can instead create a Data Manipulator in Workbench, and link that to a button or other Pick action.&nbsp;</p>



<p class="wp-block-paragraph"><p paraeid="{7b6c588f-5365-4c35-ab4b-1d600614fedc}{66}" paraid="414519141">2. Manipulating properties of screen objects. Using the new localsim:property:propertyPath syntax, simple properties such as opacity can be modified from any dynamic. See the Set Object Properties Without Scripting section of the <a href="https://docs.iconics.com/V10.97.2/GENESIS64/Help/ICONICS_Product_Help.htm#Com/Intro/ICONICS_Product_Help.htm" rel="noreferrer noopener" target="_blank">documentation</a> for details.&nbsp;</p></p>



<p class="wp-block-paragraph"><p paraeid="{7b6c588f-5365-4c35-ab4b-1d600614fedc}{84}" paraid="1413014379">3. Modifying aliases. The Set Local Aliases and Set Global Aliases commands for Pick actions support this natively. As a bonus, the built-in Data Explorer allows you to just pick the alias(es) you want to modify, and GraphWorX will take care of the rest.&nbsp;</p></p>



<h2 id="h-tip-6-minimize-expressions-nbsp" class="wp-block-heading">Tip 6: Minimize expressions&nbsp;</h2>



<p class="wp-block-paragraph">To be clear, there is nothing inherently wrong with expressions. They are a handy way to parse and manipulate data in a single data point; however, the syntax for expressions can be overly verbose, and they are more difficult to troubleshoot. I try to avoid using them when I can, and GENESIS64 includes some new tools that can replace traditional expressions. Let’s say I have an object that I want to hide when a tag is between two values. With an expression, the data source of my Hide animation looks like this:&nbsp;</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/gen64-expression.png" alt="Gen64 Converter Expression"/></figure>



<p class="wp-block-paragraph">Hope you have a big enough monitor, otherwise scrolling through the expression is even more tedious! Let’s replace it using the new range functionality of animations.&nbsp;</p>



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



<p class="wp-block-paragraph">Now the LowLimit and HighLimit properties work as my lower and upper bounds on the data source. These can even be linked to other tags. It makes the dynamic much more readable, and the error messages you get at runtime will be much clearer.&nbsp;</p>



<h2 id="h-tip-7-take-advantage-of-smart-symbols-nbsp" class="wp-block-heading">Tip 7: Take advantage of Smart Symbols&nbsp;</h2>



<p class="wp-block-paragraph">One of the best features introduced in GENESIS64 is Smart Symbols. Smart Symbols allow you to create reusable graphics that can be embedded throughout your project. If you are used to creating symbols in GENESIS32, Smart Symbols will be intuitive and make your life even easier.</p>



<p class="wp-block-paragraph">I’ve <a href="https://static.dmcinfo.com/latest-thinking/blog/id/9335/using-smart-symbols-in-iconics-graphworx64" rel="noreferrer noopener">previously written</a> about how to create and use Smart Symbols, so check that out when you’re getting started with your migration. Although it will take extra time, creating Smart Symbols will pay dividends when it comes time to expand or update your system in the future.&nbsp;</p>



<p class="wp-block-paragraph">If you follow these tips during your migration, you will end up with a quick and easy process, as well as a GENESIS64 system that takes advantage of its new features and technologies. If you run into any problems along the way, do not hesitate to reach out; DMC provides services for both <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/iconics-programming" rel="noreferrer noopener" target="_blank">GENESIS32 and GENESIS64 platforms</a>.&nbsp;</p>



<div class="wp-block-group alignwide has-custom-light-blue-background-color has-background is-layout-flow wp-container-core-group-is-layout-dbd34961 wp-block-group-is-layout-flow" style="border-radius:20px;margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50);padding-top:var(--wp--preset--spacing--50);padding-right:0;padding-bottom:var(--wp--preset--spacing--50);padding-left:0">
<div class="wp-block-columns alignwide are-vertically-aligned-center is-layout-flex wp-container-core-columns-is-layout-43efaee5 wp-block-columns-is-layout-flex" style="padding-right:var(--wp--preset--spacing--60);padding-left:var(--wp--preset--spacing--60)">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:85%">
<h3 class="wp-block-heading has-text-align-left" id="h-have-an-upcoming-project-dmc-can-help-you-take-the-next-step"><strong>Modernize GENESIS32 Without Losing Critical Functionality</strong>.</h3>



<p class="has-text-align-left wp-block-paragraph" id="h-need-help-turning-ideas-into-outcomes-automation-project-to-the-next-level-contact-us-today-to-learn-more-about-our-solutions-and-how-we-can-help-you-achieve-your-goals">Explore our <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/" data-type="page" data-id="420">Automation</a> expertise in migrating ICONICS GENESIS32 applications to GENESIS64 while preserving data, and our <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/iconics-programming/" data-type="page" data-id="506">Iconics programming</a> capabilities.</p>
</div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:15%">
<div class="wp-block-buttons is-horizontal is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-2236275c wp-block-buttons-is-layout-flex">
<div class="wp-block-button is-style-fill"><a class="wp-block-button__link has-base-contrast-color has-text-color has-link-color wp-element-button" href="https://static.dmcinfo.com/contact/">Contact Us</a></div>
</div>
</div>
</div>
</div>
<p>The post <a href="https://static.dmcinfo.com/blog/16416/iconics-genesis32-upgrade-tips-and-tricks/">Iconics GENESIS32 Upgrade Tips and Tricks</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Using Smart Symbols in Iconics GraphWorx64</title>
		<link>https://static.dmcinfo.com/blog/24898/using-smart-symbols-in-iconics-graphworx64/</link>
		
		<dc:creator><![CDATA[Patrick Smith]]></dc:creator>
		<pubDate>Fri, 18 Nov 2016 12:25:50 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Iconics]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/24898/using-smart-symbols-in-iconics-graphworx64/</guid>

					<description><![CDATA[<p>The GraphWorX64 software from Iconics is a powerful tool for building HMIs. As an upgrade from GraphWorX32, it offers several new features that allow the designer more flexibility and ease of use. The purpose of this blog post is to focus on the new Smart Symbol feature, and how it can greatly simplify HMI development. [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/24898/using-smart-symbols-in-iconics-graphworx64/">Using Smart Symbols in Iconics GraphWorx64</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">The GraphWorX64 software from Iconics is a powerful tool for building HMIs. As an upgrade from GraphWorX32, it offers several new features that allow the designer more flexibility and ease of use. The purpose of this blog post is to focus on the new Smart Symbol feature, and how it can greatly simplify HMI development.</p>



<h2 class="wp-block-heading" id="h-what-is-a-smart-symbol">What is a Smart Symbol?</h2>



<p class="wp-block-paragraph">A Smart Symbol is essentially a group of objects that have their properties and data exposed at the group level. Creating a Smart Symbol is extremely simple: select an existing group of objects, right click, and choose <strong>Convert to Smart Symbol</strong>.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Convert_to_smart_property.png" alt="Creating a Smart Object from a group of objects."/></figure>



<p class="wp-block-paragraph">You will then be given two options: <strong>Expose data sources as Smart Properties</strong>&nbsp;and <strong>Optimize hierarchical data sources</strong>. The first option will take any data sources in the objects that have already been configured, and create Smart Properties from them. The second will attempt to organize existing data sources to make use of the new Smart Properties. For a brand new group of objects, there will be no effect. For objects that have data sources, you can use whatever options make sense.</p>



<p class="wp-block-paragraph">The next window that will come up is the editor for Smart Properties. Smart Properties are at the core of Smart Symbols; they allow you to define properties that can be inherited by any objects that are a part of the Smart Symbol. These will be discussed in detail in the next section; you can leave them blank for now. Let&#8217;s look at what changed on the Smart Symbol&#8217;s properties.</p>



<h2 class="wp-block-heading" id="h-using-shared-keywords">Using Shared Keywords</h2>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Smart_symbol_properties.png" alt="The new properties of a Smart Symbol."/></figure>



<p class="wp-block-paragraph">Notice that there is a new Smart Properties group&nbsp;where I&#8217;ve defined a blank Smart Property named <strong>TestSmartProperty</strong>. A new field has also been added to the Common group, <strong>ShareKeyword</strong>. The Shared Keyword allows you to define a template for your Smart Symbol. In this example, I&#8217;ve used the ShareKeyword <strong>MyValve</strong>. I can create other Smart Symbols and assign them the same Shared Keyword. Later, if I need to change some aspect of the valve Smart Symbol, I can push the changes to every instance of a Smart Symbol with the same Shared Keyword.</p>



<p class="wp-block-paragraph">To do this, select the Smart Symbol that you want to replicate. On the ribbon, go to the Dynamics tab and click <strong>Update Shared</strong>. It will then give you several options to configure how other Smart Symbols will be updated.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Updated_shared.png" alt="The Update Shared Objects dialog"/></figure>



<p class="wp-block-paragraph">On the left, you can select the scope used to find and update other Smart Symbols. You can choose to limit yourself to your currently selected objects, the current layer or group, the entire current display, or you can select several GraphWorx64 files to update at once. For large projects, a good practice to use is to have a separate GraphWorx64 file that contains master copies of all your Smart Symbols, and then to select all your project files to make sure every symbol gets updated.</p>



<p class="wp-block-paragraph">On the right, you can choose what properties of the Smart Symbols will not be changed in the update. Any item checked will keep its current value after the update. You can then click <strong>Update All</strong>&nbsp;to immediately update all the linked Smart Symbols, or <strong>Ask Update</strong>, which will have you individually confirm each update. As you can see, Shared Keywords make managing large projects with repeated icons a much easier task.</p>



<h2 class="wp-block-heading" id="h-using-smart-properties">Using Smart Properties</h2>



<p class="wp-block-paragraph">Now let&#8217;s talk about the Smart Properties feature of the Smart Symbols. Smart Properties allow you to define a value that can be referenced by any member of the group. These properties can take many forms.&nbsp;You can define Smart Properties as strings, colors, fonts, and many more options.</p>



<p class="wp-block-paragraph">To create Smart Properties, right click the Smart Symbol&nbsp;or the Smart Properties section on the Properties tab and choose <strong>Edit Smart Properties</strong>. You can then add and remove Smart Properties&nbsp;as well as edit their name, their data type, and their default value.</p>



<p class="wp-block-paragraph">You can also use existing properties to create a Smart Property by right clicking and selecting <strong>Add To Smart Properties&nbsp;</strong>and providing a name for the property. Properties that are linked to a Smart Property are denoted by a small yellow symbol.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Smart_property_bound.png" alt="Screenshot of the symbol showing that a Smart Property is being used."/></figure>



<p class="wp-block-paragraph">If you have a property that you would like to link to an existing Smart Property, you can right click it and select <strong>Smart Binding Editor</strong>.&nbsp;This editor gives you several powerful tools for creating links to Smart Properties. Many different properties are valid targets for binding; you can use a data source for a dynamic event, the fill color of an object, the font size of a text label, and much more.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Smart_binding_editor.png" alt="Screenshot of the Smart Binding Editor"/></figure>



<p class="wp-block-paragraph">On the left, the available Smart Properties will be listed. Checking the box at the bottom will limit the selection to Smart Properties with compatible types.&nbsp;This is checked by default, so be sure to uncheck it if you don&#8217;t see a Smart Property you need. You can double click a Smart Property to add it to the cursor position in the editor. On the right are shortcuts for using built-in functions and operators, such as cosine, equality, OR, and string formatting.</p>



<p class="wp-block-paragraph">Using these functions in conjunction with Smart Properties allows you flexibility in how the member objects interact with each other and respond to system data. Some examples of using these features are:</p>



<ul class="wp-block-list">
<li>Several objects are linked to an integer Smart Property. Different objects can be shown or hidden, depending on the integer value</li>



<li>An object changes its fill color based on what combination of 3 different boolean values are true</li>



<li>A Smart Property is linked to a word value, and its objects each use 1 bit to determine if they are enabled</li>
</ul>



<p class="wp-block-paragraph">Using Smart Properties in Smart Symbols also makes reusing symbols simpler. You can define the member objects to respond the same way to given data, and then link the data source to a Smart Property&nbsp;so that each symbol has a unique data source. If you later need to change the behavior of member objects, you can use the Shared Keyword to push the changes to all instances&nbsp;while leaving the Smart Property data source unchanged. Next time you are working in GraphWorX64, try creating some Smart Symbols and see how much time they can save during development.</p>



<p class="wp-block-paragraph"><strong><a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/iconics-programming">Learn more about DMC&#8217;s Iconics Programming expertise</a>.</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/24898/using-smart-symbols-in-iconics-graphworx64/">Using Smart Symbols in Iconics GraphWorx64</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Review of the Iconics Genesis64 HMI/SCADA Development Software</title>
		<link>https://static.dmcinfo.com/blog/27261/review-of-the-iconics-genesis64-hmi-scada-development-software/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Thu, 11 Sep 2014 15:05:26 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Iconics]]></category>
		<category><![CDATA[Scripting]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/27261/review-of-the-iconics-genesis64-hmi-scada-development-software/</guid>

					<description><![CDATA[<p>Over the course of the last few months, I have delved deep into the Genesis64 HMI/SCADA development software package by Iconics while working on a standardized solution for recipe editing in manufacturing lines. Overall, it is a competitive option when fast development time and web access are valued.  One of the features that enables fast [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/27261/review-of-the-iconics-genesis64-hmi-scada-development-software/">Review of the Iconics Genesis64 HMI/SCADA Development Software</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Over the course of the last few months, I have delved deep into the <a href="https://iconics.com/en-us/Products/GENESIS64" target="_blank" rel="noreferrer noopener">Genesis64 HMI/SCADA</a> development software package by <a href="https://iconics.com/en-us/" target="_blank" rel="noreferrer noopener">Iconics</a> while working on a standardized solution for recipe editing in manufacturing lines. Overall, it is a competitive option when fast development time and web access are valued. </p>



<p class="wp-block-paragraph">One of the features that enables fast development is the ability to use data from a SQL server database, a standard in many industries. Genesis64 uses an application called GridWorX64 Server to query data and store them in datasources which can then be accessed by grids, charts, labels, buttons, etc. in GraphWorX64. One may think of these datasources as being similar to SQL views. Read more about datasources in Genesis64 in the next blog post: <a href="/latest-thinking/blog/id/8881/refreshing-datasources-in-iconics-genesis64-hmiscada-development-software">Refreshing Datasources in Iconics Genesis64 HMI/SCADA Development Software.</a></p>



<p class="wp-block-paragraph">Fast development is also facilitated by the numerous built-in Windows Forms and WPF elements in GraphWorX that can be tied to datasources in GridWorX Server quite easily. While the variety of elements that are available is substantial for basic tasks, more advanced tasks, such as processing user input and running stored procedures to change data in SQL, requires custom scripts. Custom scripting can be very powerful in Genesis64, but it can easily become cumbersome to maintain if care is not taken during development. The scripting environment that is available is Jscript.NET; however, occasionally you may run into certain properties or methods that are not available in this environment, but are documented on MSDN’s website.</p>



<p class="wp-block-paragraph">In the application that we developed, scripting was extensively used to manage the front-end as well as initiate actions on the database from the user interface. For example, scripts were used to run stored procedures that created a new recipe, edited an existed recipe, deleted a recipe, etc. The inverse of this is also true in cases where the database had to be queried to show the user options for input: an example is the population of dropdown lists from which the user selects a value to be used in a stored procedure.</p>



<p class="wp-block-paragraph">WebHMI is another aspect of Genesis64 that is very convenient for the developer and client alike. With a few clicks, a GraphWorX display can be hosted as a webpage on the internet, albeit only accessible through Internet Explorer.&nbsp;</p>



<p class="wp-block-paragraph">Learn more about DMC&#8217;s <a href="/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/iconics-programming">Iconics programming services</a>.</p>



<p class="wp-block-paragraph"><em>*Screenshot from Iconics Genesis64 demo.</em></p>
<p>The post <a href="https://static.dmcinfo.com/blog/27261/review-of-the-iconics-genesis64-hmi-scada-development-software/">Review of the Iconics Genesis64 HMI/SCADA Development Software</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Refreshing Datasources in Iconics’ Genesis64 HMI/SCADA Development Software</title>
		<link>https://static.dmcinfo.com/blog/27264/refreshing-datasources-in-iconics-genesis64-hmi-scada-development-software/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Thu, 11 Sep 2014 11:12:10 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Iconics]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/27264/refreshing-datasources-in-iconics-genesis64-hmi-scada-development-software/</guid>

					<description><![CDATA[<p>Datasources in Genesis64 are defined within the GridWorX64 application to cache data for display and use in the HMI. My experience with datasources has been as a link between a SQL server database and Genesis64. However, while developing an application that contained numerous datasources (40+), I ran into an issue that rendered the application unusable. [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/27264/refreshing-datasources-in-iconics-genesis64-hmi-scada-development-software/">Refreshing Datasources in Iconics’ Genesis64 HMI/SCADA Development Software</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Datasources in <a href="https://iconics.com/en-us/Products/GENESIS64" target="_blank" rel="noreferrer noopener">Genesis64</a> are defined within the GridWorX64 application to cache data for display and use in the HMI. My experience with datasources has been as a link between a SQL server database and Genesis64. However, while developing an application that contained numerous datasources (40+), I ran into an issue that rendered the application unusable. This blog post describes the issue and a workaround.</p>



<p class="wp-block-paragraph"><strong>The Problem:</strong><br>
Refreshing datasources with a time trigger takes an increasingly long amount of time as more datasources are refreshed with the same trigger. This behavior becomes a significant hindrance when an HMI is used to display and edit data. This is because any changes made by the user to the data are only reflected in the displays when the corresponding datasource is refreshed. In other words, a very high refresh rate is required to ensure that the user sees the change made to the data relatively quickly, but a high refresh rate is not feasible when there are multiple datasources in Genesis64. In some instances, a single data refresh of all datasources took up to 30 seconds; this was unacceptable for our application and would be for most other interfaces too.&nbsp;</p>



<p class="wp-block-paragraph"><strong>The Workaround:</strong><br>
After a lot of experimentation, manual refreshing of datasources was the method that allowed for the fastest refreshing of data from the user’s perspective. A special datapoint that is provided in Genesis64 (Datasource.@@Refresh) can be written as well in order to manually refresh a particular datasource. This can be achieved by creating a process point or label, tying it to a datasource’s refresh point, and using a script to write to the process point when a button is clicked.&nbsp;<br>
In our application, any user action that could have potentially changed data in a datasource initiated a manual refresh of that datasource. While this increased development time, it ensured that the user saw the changes that were made within one second.</p>



<p class="wp-block-paragraph"><a href="/our-services/manufacturing-automation-and-intelligence/hmi-and-scada-systems/iconics-programming" style="font-size: 13.3333339691162px; line-height: 23.1111106872559px;">Learn more about DMC&#8217;s Iconics programming services.</a></p>



<p class="wp-block-paragraph"><em>*Screenshot from Iconics Genesis64 demo.</em></p>
<p>The post <a href="https://static.dmcinfo.com/blog/27264/refreshing-datasources-in-iconics-genesis64-hmi-scada-development-software/">Refreshing Datasources in Iconics’ Genesis64 HMI/SCADA Development Software</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>DMC Joins ICONICS System Integrator Partner Program</title>
		<link>https://static.dmcinfo.com/blog/28087/dmc-joins-iconics-system-integrator-partner-program/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Sun, 22 Sep 2013 19:09:07 +0000</pubDate>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Iconics]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/28087/dmc-joins-iconics-system-integrator-partner-program/</guid>

					<description><![CDATA[<p>DMC is proud to have joined the ICONICS System Integrator Partner (SIP) program. The System Integrator Partner designation identifies DMC&#8217;s proficiency with ICONICS products, and proven ability to develop ICONICS solutions, and efficient deployment of projects.  As an ICONICS System Integrator Partner, DMC will take part in the ICONICS 2013 Worldwide Customer Summit held from [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/28087/dmc-joins-iconics-system-integrator-partner-program/">DMC Joins ICONICS System Integrator Partner Program</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">DMC is proud to have joined the ICONICS System Integrator Partner (SIP) program. The System Integrator Partner designation identifies DMC&#8217;s proficiency with ICONICS products, and proven ability to develop ICONICS solutions, and efficient deployment of projects. </p>



<p class="wp-block-paragraph">As an ICONICS System Integrator Partner, DMC will take part in the ICONICS 2013 Worldwide Customer Summit held from September 23 &#8211; 26, 2013 in Newport, Rhode Island. The theme for the event is &nbsp;“Get Connected – Visualize, Analyze, Mobilize,&#8221; and programming will focus on the latest breakthroughs in real-time automation, analytics and mobile software technologies in a variety of industries. The summit aims to connect ICONICS users, integrators, and channel partners to share insight and best practices and showcase leading-edge software.</p>



<p class="wp-block-paragraph">“This year’s conference connects the world of industrial automation, manufacturing and building automation with breakthrough technologies that are going to change the way we do business,” states Russ Agrusa, ICONICS President and CEO. “From advances in natural user interfaces to delivering 3D-rich dashboards on smart mobile devices, ICONICS connects you with the future of automation software.&#8221;</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6abf20807dd42&quot;}" data-wp-interactive="core/image" data-wp-key="6abf20807dd42" class="wp-block-image size-full wp-lightbox-container"><img fetchpriority="high" decoding="async" width="600" height="194" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/iconics-summit-2013.jpg" alt="Iconics Summit 2013" class="wp-image-28086" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/iconics-summit-2013.jpg 600w, https://static.dmcinfo.com/wp-content/uploads/2025/05/iconics-summit-2013-300x97.jpg 300w" sizes="(max-width: 600px) 100vw, 600px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button></figure>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://static.dmcinfo.com/blog/28087/dmc-joins-iconics-system-integrator-partner-program/">DMC Joins ICONICS System Integrator Partner Program</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Automation Redundancy Using ICONICS WebHMI Solutions</title>
		<link>https://static.dmcinfo.com/blog/28626/automation-redundancy-using-iconics-webhmi-solutions/</link>
		
		<dc:creator><![CDATA[Jon Carson]]></dc:creator>
		<pubDate>Thu, 21 Feb 2013 12:53:56 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[Iconics]]></category>
		<category><![CDATA[PC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/28626/automation-redundancy-using-iconics-webhmi-solutions/</guid>

					<description><![CDATA[<p>There are many good options for automation and controls redundancy out there. Here is an example we just recently used in the field. The customer specified a requirement of complete redundancy for all IT, networking, and HMI components of one of a large-scale manufacturing line. The system architecture we chose incorporated thin-client HMIs with server [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/28626/automation-redundancy-using-iconics-webhmi-solutions/">Automation Redundancy Using ICONICS WebHMI Solutions</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">There are many good options for automation and controls redundancy out there. Here is an example we just recently used in the field. The customer specified a requirement of complete redundancy for all IT, networking, and HMI components of one of a large-scale manufacturing line. The system architecture we chose incorporated thin-client HMIs with server virtualization, off-the-shelf ICONICS redundancy solutions, dual KEPware OPC servers, a custom .NET service, and automatically backed-up SQL data storage. A diagram may help demonstrate our solution:<br />
<o:o:o:o:o:p></o:o:o:o:o:p></p>

<p class="wp-block-paragraph"><o:o:o:o:o:p>&nbsp;</o:o:o:o:o:p></p>

<p class="wp-block-paragraph"><o:o:o:o:o:p><img decoding="async" alt="" height="382" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/network-architecture.png" width="450" /></o:o:o:o:o:p></p>

<p class="MsoNormal wp-block-paragraph">&nbsp;</p>

<p class="MsoNormal wp-block-paragraph">Starting from the bottom, we can see that our operator-side HMI is exposed anywhere on the internal company network (with the correct login information) via Internet Explorer. This provides a reduction in downtime, because if HMI hardware fails, any other computer can be put in its place right away. Technology used for this implementation was ICONICS WebHMI, which easily converts between local HMI projects and HTML ActiveX Web pages.<o:o:o:o:o:p></o:o:o:o:o:p></p>

<p class="MsoNormal wp-block-paragraph">Via the production network, the thin client speaks to one of two ICONICS DataWorx servers to send and receive production tags. ICONICS DataWorx has built-in redundancy and failover options which determine which of two OPC servers should be used to communicate to production devices such as PLCs. <o:o:o:o:o:p></o:o:o:o:o:p></p>

<p class="MsoNormal wp-block-paragraph">Recipe data as well as data acquisition and reporting are stored in SQL Server 2008 R2. SQL has built-in features for customizable back-up and storage, which we are using to minimize the possibility of data loss. The SQL server communicates with our OPC server via a custom, configurable .NET service we have written, deployed and tested on several previous systems.<o:o:o:o:o:p></o:o:o:o:o:p></p>

<p class="MsoNormal wp-block-paragraph">The last important step in reducing downtime is virtualization. Each of our three servers is virtualized using VMWare. This allows us to save backups of entire servers on independent storage devices, preserving all program installations and configurations in the event of a total meltdown of the physical servers.</p>

<p class="MsoNormal wp-block-paragraph">Complete redundancy is not a simple task. A lot of thought has to go into specific requirements, hardware/software architecture, network layouts, and program configurations. Testing is also key (for us, simulation off-site of various failure modes provided insight into software configuration requirements). After working on this and previous redundant systems, I would recommend repeating the fundamentals described above:<o:o:o:o:o:p></o:o:o:o:o:p></p>

<ol class="wp-block-list">
 <li>Server-centric solutions with thin-client operation<o:o:o:o:o:p></o:o:o:o:o:p></li>
 <li>Off-the-shelf solutions where available<o:o:o:o:o:p></o:o:o:o:o:p></li>
 <li>Virtualization with independent back-ups of all servers <o:o:o:o:o:p></o:o:o:o:o:p></li>
</ol>

<p class="MsoNormal wp-block-paragraph">Happy programming!</p>

<p class="MsoNormal wp-block-paragraph"><o:o:o:o:o:p><a href="/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/iconics-programming">Learn more about DMC&apos;s Iconics programming services.</a></o:o:o:o:o:p></p>
<p>The post <a href="https://static.dmcinfo.com/blog/28626/automation-redundancy-using-iconics-webhmi-solutions/">Automation Redundancy Using ICONICS WebHMI Solutions</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Iconics, VBA, VBScript, and Writing to OPC Tags</title>
		<link>https://static.dmcinfo.com/blog/29119/iconics-vba-vbscript-and-writing-to-opc-tags/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Thu, 01 Mar 2012 09:19:19 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[Iconics]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/29119/iconics-vba-vbscript-and-writing-to-opc-tags/</guid>

					<description><![CDATA[<p>Background DMC has often had to download a high number of values from a SQL server to an OPC server. In the past, this had usually been done with VBA code that was called from an Iconics HMI screen. The code looped through about 600 tags in less than a minute. The VBA code was [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/29119/iconics-vba-vbscript-and-writing-to-opc-tags/">Iconics, VBA, VBScript, and Writing to OPC Tags</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading" id="h-background">Background</h3>



<p class="wp-block-paragraph">DMC has often had to download a high number of values from a SQL server to an OPC server. In the past, this had usually been done with VBA code that was called from an <a href="/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/iconics-programming">Iconics </a>HMI screen. The code looped through about 600 tags in less than a minute. The VBA code was always executing locally (on the same PC) as the OPC server it was writing to.</p>



<p class="wp-block-paragraph">For a particular application, the HMI architecture switched to using WebHMI. Therefore, the VBA code needed to be converted to VBScript for compatibility with WebHMI. When a Graphworx WebHMI display is opened in a web browser on a thin client, the VBScript is executed on the thin client and not local to the OPC server, which is running on the WebHMI server.</p>



<p class="wp-block-paragraph">As we implemented and tested our original VBScript, we experienced extremely slow execution time. The remote execution of the VBScript (whether in a client browser or on a remote Graphworx runtime) was taking more than 10 times as long as when we ran the same script locally on the server where the OPC server resided.</p>



<h3 class="wp-block-heading" id="h-original-approach">Original Approach</h3>



<p class="wp-block-paragraph">The original approach to writing to an OPC tag in the VBScript is captured in the subroutine below. Notice that one tag is accessed in the client.RequestDataPoint() function. When this subroutine is executed, it creates a subscription to an OPC tag that is not already subscribed to as an object on the display. It writes to the OPC tag and then releases the subscription as it exits the subroutine. According to Iconics, the releasing of the subscription has a time delay associated with it that is longer when the script is being executed on a remote client. Therefore, the extremely slow execution time experienced in the recipe download script was due to the extended delay of releasing the subscription of an OPC tag at the end of each single write.</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>' Write OPC tag. Return false if error is detected
Sub OPC_Write (Tag, Value)

  Set client = CreateObject("GenClientWrapper.Client") 
  
  ' Try to add tag
  On Error Resume Next
  Dim dp 
  Set dp = client.RequestDataPoint(Tag, 100, 0) 

  If dp Is Nothing Then
   MsgBox "Tag " &amp; Tag &amp; " not found!", vbCritical, "Sub: OPC_Write"
  Else
   dp.Value = Value
  End If
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: #6A9955">&apos; Write OPC tag. Return false if error is detected</span></span>
<span class="line"><span style="color: #569CD6">Sub</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">OPC_Write</span><span style="color: #D4D4D4"> (</span><span style="color: #9CDCFE">Tag, Value</span><span style="color: #D4D4D4">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">client</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">CreateObject</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;GenClientWrapper.Client&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; Try to add tag</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">On Error Resume Next</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> dp </span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">dp</span><span style="color: #D4D4D4"> = client.</span><span style="color: #DCDCAA">RequestDataPoint</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">Tag</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">100</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">0</span><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"> dp Is</span><span style="color: #569CD6"> Nothing</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">Then</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #DCDCAA">MsgBox</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;Tag &quot;</span><span style="color: #D4D4D4"> &amp;</span><span style="color: #9CDCFE"> Tag</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot; not found!&quot;</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> vbCritical</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;Sub: OPC_Write&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">Else</span></span>
<span class="line"><span style="color: #D4D4D4">   dp.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> Value</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">End If</span></span>
<span class="line"><span style="color: #569CD6">End Sub</span></span></code></pre></div>



<h3 class="wp-block-heading" id="h-resolution-approach">Resolution Approach</h3>



<p class="wp-block-paragraph">The new approach to writing to an OPC tag in the VBScript is captured in the subroutine below called “OPC_Write2.” The key difference with this approach is that tag subscriptions are aggregated into a global array and held throughout the whole download sequence. Tag subscriptions are not released until the whole download script has completed, and thus no noticeable subscription release delay is experienced between individual tag writes or even at the end of the download sequence.</p>



<p class="wp-block-paragraph">Data is passed to the subroutine in the same manner as the older subroutine, but some additional arguments are passed in with the tag and value. “myDataPoints” is a global array of 600 and myIndex is a global variable that is incremented every time “OPC_Write2” is called. The size of “myDataPoints” is set so that it is larger than the total number of tags to be written. Each piece of data to be written to an OPC tag is added to the array with Set myDataPoints(myIndex) = myClient.RequestDataPoint(Tag, 100, 0). “myIndex” is then incremented every time OPC_Write2 is called so that the next time OPC_Write2 is called myClient.RequestDataPoint() is assigned to the next index in the array. Because myClient.RequestDataPoint() is being assigned to a global array we maintain the scope of the function. This means that the subscription is maintained and the delay that was experienced when unsubscribing to a tag and checking for pending writes will no longer occur.</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>Sub OPC_Write2 (Tag, Value, ByRef myClient, ByRef myDataPoints, ByRef myIndex)
	
	' Try to add tag
	On Error Resume Next
	Set myDataPoints(myIndex) = myClient.RequestDataPoint(Tag, 100, 0) 

	If myDataPoints(myIndex) Is Nothing Then
		MsgBox "Tag " &amp; Tag &amp; " not found!", vbCritical, "Sub: OPC_Write"
	Else
			 myDataPoints(myIndex).Value = Value
	End If

	myIndex = myIndex + 1

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">OPC_Write2</span><span style="color: #D4D4D4"> (</span><span style="color: #9CDCFE">Tag, Value, ByRef myClient, ByRef myDataPoints, ByRef myIndex</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; Try to add tag</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #569CD6">On Error Resume Next</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #569CD6">Set </span><span style="color: #DCDCAA">myDataPoints</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">myIndex</span><span style="color: #D4D4D4">) = myClient.</span><span style="color: #DCDCAA">RequestDataPoint</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">Tag</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">100</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">0</span><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"> </span><span style="color: #DCDCAA">myDataPoints</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">myIndex</span><span style="color: #D4D4D4">) Is</span><span style="color: #569CD6"> Nothing</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">Then</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #DCDCAA">MsgBox</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;Tag &quot;</span><span style="color: #D4D4D4"> &amp;</span><span style="color: #9CDCFE"> Tag</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot; not found!&quot;</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> vbCritical</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;Sub: OPC_Write&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #C586C0">Else</span></span>
<span class="line"><span style="color: #D4D4D4">			 </span><span style="color: #DCDCAA">myDataPoints</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">myIndex</span><span style="color: #D4D4D4">).</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> Value</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #C586C0">End If</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #9CDCFE">myIndex</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> myIndex</span><span style="color: #D4D4D4"> + </span><span style="color: #B5CEA8">1</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"><a href="/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/iconics-programming">Learn more about DMC&#8217;s Iconics programming services.</a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/29119/iconics-vba-vbscript-and-writing-to-opc-tags/">Iconics, VBA, VBScript, and Writing to OPC Tags</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Read Command Line Parameters from VBA</title>
		<link>https://static.dmcinfo.com/blog/31923/read-command-line-parameters-from-vba/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Fri, 22 Oct 2010 13:39:32 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Iconics]]></category>
		<category><![CDATA[MS Visual Studio/.NET]]></category>
		<category><![CDATA[PC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/31923/read-command-line-parameters-from-vba/</guid>

					<description><![CDATA[<p>Recently, I needed to read a command line parameter within a VBA code (it&#8217;s for&#160;an Iconics SCADA application, but I developed it with Excel VBA&#160;which is&#160;essentially the same). It doesn&#8217;t sound like a big deal but there&#160;were a few not-so-obvious tricks that I thought&#160;were worth sharing. I started with the&#160;simplest&#160;solution using a &#8220;GetCommandLineA&#8221; Windows API [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/31923/read-command-line-parameters-from-vba/">Read Command Line Parameters from VBA</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Recently, I needed to read a command line parameter within a VBA code (it&#8217;s for&nbsp;an <a href="https://iconics.com/" target="_blank" rel="noreferrer noopener">Iconics</a> SCADA application, but I developed it with Excel VBA&nbsp;which is&nbsp;essentially the same). It doesn&#8217;t sound like a big deal but there&nbsp;were a few not-so-obvious tricks that I thought&nbsp;were worth sharing.</p>



<p class="wp-block-paragraph">I started with the&nbsp;simplest&nbsp;solution using a &#8220;GetCommandLineA&#8221; Windows API function from kernel32.dll. It&nbsp;was supposed to return a&nbsp;pointer to the command line string, so I assumed that its return type&nbsp;would be&nbsp;string (sounds logical to me).</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">VBA</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>' The return type of the GetCommandLineA is long
' But it is supposed to be a pointer to the string. 
' Assumming that all VBA strings are passed by pointers
' Just declare it's return type to be a string
Declare Function GetCommandLineA Lib "Kernel32" () As String
 
Sub ReadCmdLine()

   Dim strCmdLine As String ' Command line string   
   ' Read command line parameters into the string
   strCmdLine = GetCommandLineA

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: #6A9955">&apos; The return type of the GetCommandLineA is long</span></span>
<span class="line"><span style="color: #6A9955">&apos; But it is supposed to be a pointer to the string. </span></span>
<span class="line"><span style="color: #6A9955">&apos; Assumming that all VBA strings are passed by pointers</span></span>
<span class="line"><span style="color: #6A9955">&apos; Just declare it&apos;s return type to be a string</span></span>
<span class="line"><span style="color: #D4D4D4">Declare</span><span style="color: #569CD6"> Function </span><span style="color: #D4D4D4">GetCommandLineA Lib </span><span style="color: #CE9178">&quot;Kernel32&quot;</span><span style="color: #D4D4D4"> () As </span><span style="color: #4EC9B0">String</span></span>
<span class="line"><span style="color: #D4D4D4"> </span></span>
<span class="line"><span style="color: #569CD6">Sub</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">ReadCmdLine</span><span style="color: #D4D4D4">()</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> strCmdLine </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">String</span><span style="color: #D4D4D4"> </span><span style="color: #6A9955">&apos; Command line string   </span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #6A9955">&apos; Read command line parameters into the string</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #9CDCFE">strCmdLine</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> GetCommandLineA</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">Surprise &#8211; it caused exception and crashed the application. Hm, apparently VBA handles a pointer to the string differently than&nbsp;GetCommandLineA.&nbsp;Not wanting to&nbsp;spend time figuring out why,&nbsp;I decided to copy the string to VBA&nbsp;string using another kernel32.dll function &#8220;lstrcpynA&#8221;.</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">VBA</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>' Declare the return type to be a pointer (long)
Declare Function GetCommandLineA Lib "Kernel32" () As Long
Declare Function lstrcpynA Lib "kernel32" ( _ 
   ByVal pDestination As String, ByVal pSource As Long, _
   ByVal iMaxLength As Integer) As Long
 
Sub ReadCmdLine()

   Dim pCmdLine as long     ' Pointer to the string
   Dim strCmdLine As String ' Command line string     

   pCmdLine = GetCommandLineA
   ' Copy from the pointer to VBA-Style string 
   ' 300 characters for command line seems to be enough
   lstrcpynA strCmdLine , pCmdLine, 300	   

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: #6A9955">&apos; Declare the return type to be a pointer (long)</span></span>
<span class="line"><span style="color: #D4D4D4">Declare</span><span style="color: #569CD6"> Function </span><span style="color: #D4D4D4">GetCommandLineA Lib </span><span style="color: #CE9178">&quot;Kernel32&quot;</span><span style="color: #D4D4D4"> () As </span><span style="color: #4EC9B0">Long</span></span>
<span class="line"><span style="color: #D4D4D4">Declare</span><span style="color: #569CD6"> Function </span><span style="color: #D4D4D4">lstrcpynA Lib </span><span style="color: #CE9178">&quot;kernel32&quot;</span><span style="color: #D4D4D4"> (</span><span style="color: #9CDCFE"> _</span><span style="color: #D4D4D4"> </span></span>
<span class="line"><span style="color: #D4D4D4">   ByVal pDestination As </span><span style="color: #4EC9B0">String</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> ByVal</span><span style="color: #D4D4D4"> pSource As </span><span style="color: #4EC9B0">Long</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> _</span></span>
<span class="line"><span style="color: #D4D4D4">   ByVal iMaxLength As </span><span style="color: #4EC9B0">Integer</span><span style="color: #D4D4D4">) As </span><span style="color: #4EC9B0">Long</span></span>
<span class="line"><span style="color: #D4D4D4"> </span></span>
<span class="line"><span style="color: #569CD6">Sub</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">ReadCmdLine</span><span style="color: #D4D4D4">()</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> pCmdLine </span><span style="color: #D4D4D4">as </span><span style="color: #4EC9B0">long</span><span style="color: #D4D4D4">     </span><span style="color: #6A9955">&apos; Pointer to the string</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> strCmdLine </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">String</span><span style="color: #D4D4D4"> </span><span style="color: #6A9955">&apos; Command line string     </span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #9CDCFE">pCmdLine</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> GetCommandLineA</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #6A9955">&apos; Copy from the pointer to VBA-Style string </span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #6A9955">&apos; 300 characters for command line seems to be enough</span></span>
<span class="line"><span style="color: #D4D4D4">   lstrcpynA strCmdLine ,</span><span style="color: #9CDCFE"> pCmdLine</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">300</span><span style="color: #D4D4D4">	   </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">This worked better by no longer crashing the application, but the strCmdLine was always empty. After short Google search I found this Microsoft article. Apparently, the lstrcpynA function (as other DLL functions returning strings) can&#8217;t change the size of the VBA-style string. In order to reserve the space for that return data, we need to fill the string with a bunch of zeros (vbNullChar).</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">VBA</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>Declare Function GetCommandLineA Lib "Kernel32" () As Long
Declare Function lstrcpynA Lib "kernel32" ( _
   ByVal pDestination As String, ByVal pSource As Long, _
   ByVal iMaxLength As Integer) As Long
 
Sub ReadCmdLine()

   Dim pCmdLine as long     ' Pointer to the string
   Dim strCmdLine As String ' Command line string   

   ' Get the pointer to the command line string
   pCmdLine = GetCommandLineA

   ' Fill the string with zeros
   ' 300 characters for command line seems to be enough
   strCmdLine = String&#91;DollarSign&#93;(300, vbNullChar)

   ' Copy from the pointer to VBA-style string
   lstrcpynA strCmdLine , pCmdLine, Len(strCmdLine )

   ' At this point we got the string
   ' But rest of it filled with 0 characters.
   strCmdLine = Left(strCmdLine , InStr(1, strCmdLine , _
      vbNullChar) - 1)
   	   
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: #D4D4D4">Declare</span><span style="color: #569CD6"> Function </span><span style="color: #D4D4D4">GetCommandLineA Lib </span><span style="color: #CE9178">&quot;Kernel32&quot;</span><span style="color: #D4D4D4"> () As </span><span style="color: #4EC9B0">Long</span></span>
<span class="line"><span style="color: #D4D4D4">Declare</span><span style="color: #569CD6"> Function </span><span style="color: #D4D4D4">lstrcpynA Lib </span><span style="color: #CE9178">&quot;kernel32&quot;</span><span style="color: #D4D4D4"> (</span><span style="color: #9CDCFE"> _</span></span>
<span class="line"><span style="color: #D4D4D4">   ByVal pDestination As </span><span style="color: #4EC9B0">String</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> ByVal</span><span style="color: #D4D4D4"> pSource As </span><span style="color: #4EC9B0">Long</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> _</span></span>
<span class="line"><span style="color: #D4D4D4">   ByVal iMaxLength As </span><span style="color: #4EC9B0">Integer</span><span style="color: #D4D4D4">) As </span><span style="color: #4EC9B0">Long</span></span>
<span class="line"><span style="color: #D4D4D4"> </span></span>
<span class="line"><span style="color: #569CD6">Sub</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">ReadCmdLine</span><span style="color: #D4D4D4">()</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> pCmdLine </span><span style="color: #D4D4D4">as </span><span style="color: #4EC9B0">long</span><span style="color: #D4D4D4">     </span><span style="color: #6A9955">&apos; Pointer to the string</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> strCmdLine </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">String</span><span style="color: #D4D4D4"> </span><span style="color: #6A9955">&apos; Command line string   </span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #6A9955">&apos; Get the pointer to the command line string</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #9CDCFE">pCmdLine</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> GetCommandLineA</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #6A9955">&apos; Fill the string with zeros</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #6A9955">&apos; 300 characters for command line seems to be enough</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #9CDCFE">strCmdLine</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> String</span><span style="color: #D4D4D4">&#91;DollarSign&#93;(</span><span style="color: #B5CEA8">300</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> vbNullChar</span><span style="color: #D4D4D4">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #6A9955">&apos; Copy from the pointer to VBA-style string</span></span>
<span class="line"><span style="color: #D4D4D4">   lstrcpynA strCmdLine ,</span><span style="color: #9CDCFE"> pCmdLine</span><span style="color: #D4D4D4">, </span><span style="color: #DCDCAA">Len</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">strCmdLine</span><span style="color: #D4D4D4"> )</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #6A9955">&apos; At this point we got the string</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #6A9955">&apos; But rest of it filled with 0 characters.</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #9CDCFE">strCmdLine</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">Left</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">strCmdLine</span><span style="color: #D4D4D4"> , </span><span style="color: #DCDCAA">InStr</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> strCmdLine</span><span style="color: #D4D4D4"> ,</span><span style="color: #9CDCFE"> _</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #4EC9B0">vbNullChar</span><span style="color: #D4D4D4">) - </span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">   	   </span></span>
<span class="line"><span style="color: #569CD6">End Sub</span></span></code></pre></div>



<p class="wp-block-paragraph">This code finally worked as&nbsp;expected, returning command line arguments.</p>



<p class="wp-block-paragraph">Hopefully, this article is useful in saving someone 15 minutes of frustration.</p>



<p class="wp-block-paragraph"><a href="/services/application-development/web-application-development">Learn more about DMC&#8217;s software and web development services.</a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/31923/read-command-line-parameters-from-vba/">Read Command Line Parameters from VBA</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Populating Iconics/GraphWorX32 Drop-down list (Statefield) from VBA</title>
		<link>https://static.dmcinfo.com/blog/31930/populating-iconics-graphworx32-drop-down-list-statefield-from-vba/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Fri, 11 Sep 2009 18:13:22 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Iconics]]></category>
		<category><![CDATA[MS Visual Studio/.NET]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/31930/populating-iconics-graphworx32-drop-down-list-statefield-from-vba/</guid>

					<description><![CDATA[<p>If you have never heard about Genesis32 SCADA package from Iconics, this is the right time to learn more about it before we continue. I shall wait right here&#8230; Good, now you know what I am talking about. We&#8217;ll talk about GraphWorX32, this is HMI graphical display application. One of the control available in GraphWorX32 [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/31930/populating-iconics-graphworx32-drop-down-list-statefield-from-vba/">Populating Iconics/GraphWorX32 Drop-down list (Statefield) from VBA</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">If you have never heard about Genesis32 SCADA package from <a href="https://iconics.com/en-us/" target="_blank" rel="noreferrer noopener">Iconics</a>, this is the right time to learn more about it before we continue. I shall wait right here&#8230;</p>



<p class="wp-block-paragraph">Good, now you know what I am talking about.</p>



<p class="wp-block-paragraph">We&#8217;ll talk about <a href="https://iconics.com/en-us/Products/GENESIS64" target="_blank" rel="noreferrer noopener">GraphWorX32</a>, this is HMI graphical display application. One of the control available in GraphWorX32 is drop-down list (Statefield). This is pretty cool drop-down menu, but values on the list have to be hardcoded during screen design and can&#8217;t be updated at runtime.</p>



<p class="wp-block-paragraph">At the same time GraphWorX32 supports VBA scripting language. So it&#8217;s totally possible to update drop-down list from VBA code. This is how I do it:</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">VBA</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>' In order to update drop-down values we have to delete stateField object and re-create it again
Dim strStateConfiguration As String
Dim objFieldToUpdate As Object
Dim L, T, W, H
Dim Fnt As IFontDisp
Dim objFieldToUpdateText As GwxText
Dim objNewText As GwxText
Dim objNewStateField As Object
  
' StateField object attaches to existing text object, so we have to find text object first, assuming it has "StateField_txt" name
Set objFieldToUpdate = ThisDisplay.GetVisibleObjectFromName("StateField_txt")
' Get text objects position/size, we have to create new object with the same size
objFieldToUpdate.GetObjectDimensions2 L, T, W, H

' Cast text object to the GwxText type
Set objFieldToUpdateText = objFieldToUpdate
' Get text object font
Set Fnt = objFieldToUpdateText.Font
            
' Delete text object
ThisDisplay.DeleteObject ("StateField_txt")
        
' Create new text object, set the same position/size and font as original text object.
' We didn't store original text align, colors etc, so we just hardcode it
Set objNewText = ThisDisplay.CreateText(0, 0, "", TextAlignLeft, False, False, RGB(128, 128, 128), RGB(0, 0, 0), 0, LineNone, False, RGB(0, 0, 0), EdgeNone, False, "StateField_txt")
Set objNewText .Font = Fnt
objNewText.SetObjectDimensions L, T, W, H

' Here we have to create new drop-down list. Just assign couple values
strStateConfiguration = ""
strStateConfiguration = strStateConfiguration + "value1" &amp; Chr(9) &amp; "Drop-Down-Text1" &amp; Chr(13) &amp; Chr(10)
strStateConfiguration = strStateConfiguration + "value2" &amp; Chr(9) &amp; "Drop-Down-Text2" &amp; Chr(13) &amp; Chr(10)

' Creating StateField and attach it to text object. OPC tag string is hardcoded in this example
Set objNewStateField = ThisDisplay.CreateStateField("StateField_txt", "StateField_stat", True, True, False, 0, strStateConfiguration, "")
objNewStateField.dataSource = "&lt;Path_to_my_OPC_Tag>"</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="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #6A9955">&apos; In order to update drop-down values we have to delete stateField object and re-create it again</span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> strStateConfiguration </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">String</span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> objFieldToUpdate </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">Object</span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> L, T</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> W</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> H</span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> Fnt </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">IFontDisp</span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> objFieldToUpdateText </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">GwxText</span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> objNewText </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">GwxText</span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> objNewStateField </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">Object</span></span>
<span class="line"><span style="color: #D4D4D4">  </span></span>
<span class="line"><span style="color: #6A9955">&apos; StateField object attaches to existing text object, so we have to find text object first, assuming it has &quot;StateField_txt&quot; name</span></span>
<span class="line"><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">objFieldToUpdate</span><span style="color: #D4D4D4"> = ThisDisplay.</span><span style="color: #DCDCAA">GetVisibleObjectFromName</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;StateField_txt&quot;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #6A9955">&apos; Get text objects position/size, we have to create new object with the same size</span></span>
<span class="line"><span style="color: #D4D4D4">objFieldToUpdate.GetObjectDimensions2 L,</span><span style="color: #9CDCFE"> T</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> W</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> H</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">&apos; Cast text object to the GwxText type</span></span>
<span class="line"><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">objFieldToUpdateText</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> objFieldToUpdate</span></span>
<span class="line"><span style="color: #6A9955">&apos; Get text object font</span></span>
<span class="line"><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">Fnt</span><span style="color: #D4D4D4"> = objFieldToUpdateText.Font</span></span>
<span class="line"><span style="color: #D4D4D4">            </span></span>
<span class="line"><span style="color: #6A9955">&apos; Delete text object</span></span>
<span class="line"><span style="color: #D4D4D4">ThisDisplay.</span><span style="color: #9CDCFE">DeleteObject</span><span style="color: #D4D4D4"> (</span><span style="color: #CE9178">&quot;StateField_txt&quot;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">        </span></span>
<span class="line"><span style="color: #6A9955">&apos; Create new text object, set the same position/size and font as original text object.</span></span>
<span class="line"><span style="color: #6A9955">&apos; We didn&apos;t store original text align, colors etc, so we just hardcode it</span></span>
<span class="line"><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">objNewText</span><span style="color: #D4D4D4"> = ThisDisplay.</span><span style="color: #DCDCAA">CreateText</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;&quot;</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> TextAlignLeft</span><span style="color: #D4D4D4">,</span><span style="color: #569CD6"> False</span><span style="color: #D4D4D4">,</span><span style="color: #569CD6"> False</span><span style="color: #D4D4D4">, </span><span style="color: #DCDCAA">RGB</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">128</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">128</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">128</span><span style="color: #D4D4D4">), </span><span style="color: #DCDCAA">RGB</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">), </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> LineNone</span><span style="color: #D4D4D4">,</span><span style="color: #569CD6"> False</span><span style="color: #D4D4D4">, </span><span style="color: #DCDCAA">RGB</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">),</span><span style="color: #9CDCFE"> EdgeNone</span><span style="color: #D4D4D4">,</span><span style="color: #569CD6"> False</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;StateField_txt&quot;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #569CD6">Set </span><span style="color: #D4D4D4">objNewText .</span><span style="color: #9CDCFE">Font</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> Fnt</span></span>
<span class="line"><span style="color: #D4D4D4">objNewText.SetObjectDimensions L,</span><span style="color: #9CDCFE"> T</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> W</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> H</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">&apos; Here we have to create new drop-down list. Just assign couple values</span></span>
<span class="line"><span style="color: #9CDCFE">strStateConfiguration</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;&quot;</span></span>
<span class="line"><span style="color: #9CDCFE">strStateConfiguration</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> strStateConfiguration</span><span style="color: #D4D4D4"> + </span><span style="color: #CE9178">&quot;value1&quot;</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #DCDCAA">Chr</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">9</span><span style="color: #D4D4D4">) &amp; </span><span style="color: #CE9178">&quot;Drop-Down-Text1&quot;</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #DCDCAA">Chr</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">13</span><span style="color: #D4D4D4">) &amp; </span><span style="color: #DCDCAA">Chr</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">10</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #9CDCFE">strStateConfiguration</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> strStateConfiguration</span><span style="color: #D4D4D4"> + </span><span style="color: #CE9178">&quot;value2&quot;</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #DCDCAA">Chr</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">9</span><span style="color: #D4D4D4">) &amp; </span><span style="color: #CE9178">&quot;Drop-Down-Text2&quot;</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #DCDCAA">Chr</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">13</span><span style="color: #D4D4D4">) &amp; </span><span style="color: #DCDCAA">Chr</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">10</span><span style="color: #D4D4D4">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">&apos; Creating StateField and attach it to text object. OPC tag string is hardcoded in this example</span></span>
<span class="line"><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">objNewStateField</span><span style="color: #D4D4D4"> = ThisDisplay.</span><span style="color: #DCDCAA">CreateStateField</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;StateField_txt&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;StateField_stat&quot;</span><span style="color: #D4D4D4">,</span><span style="color: #569CD6"> True</span><span style="color: #D4D4D4">,</span><span style="color: #569CD6"> True</span><span style="color: #D4D4D4">,</span><span style="color: #569CD6"> False</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> strStateConfiguration</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;&quot;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">objNewStateField.</span><span style="color: #9CDCFE">dataSource</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;&lt;Path_to_my_OPC_Tag&gt;&quot;</span></span></code></pre></div>



<p class="wp-block-paragraph">There are a couple things to keep in mind:</p>



<ul class="wp-block-list">
<li>This code needs to be run in PreRuntimeStart event</li>



<li>You can&#8217;t run this code during runtime, only at design mode</li>



<li>PreRuntimeStart event called only during transition from design mode to runtime mode</li>



<li>If screen opens from another screen which already in runtime mode &#8211; PreRuntimeStart event won&#8217;t be called</li>



<li>Depending on the application it could be several scenarios how to force drop-down list update. For example: you could open screen in design mode and in DisplayLoad event switch it to runtime mode</li>
</ul>



<p class="wp-block-paragraph">Happy coding!</p>
<p>The post <a href="https://static.dmcinfo.com/blog/31930/populating-iconics-graphworx32-drop-down-list-statefield-from-vba/">Populating Iconics/GraphWorX32 Drop-down list (Statefield) from VBA</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
