<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Running a keyin at startup</title><link>https://communities.bentley.com/products/microstation/f/microstation-forum/87490/running-a-keyin-at-startup</link><description>Is it possible to run a keyin at startup? I saw this AskInga article from 2002 that says one can create a txt file and then point the icon properties to it but I imagine that&amp;#39;s pretty out of date by now?</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/761552?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 11:42:05 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:95ab5f21-eabf-4ad9-b8d4-0473ec84d4f7</guid><dc:creator>Cole DeBolt</dc:creator><description>&lt;p&gt;Thank you so much!!! This was very helpful and very easy to do. Much appreciated.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/761443?ContentTypeID=1</link><pubDate>Tue, 11 Apr 2023 17:57:43 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:35fd8938-6c6c-4da0-bbd8-1f4c9fa91a54</guid><dc:creator>Kevin van Haaren</dc:creator><description>&lt;p&gt;There is a special feature of MicroStation VBA where if you have a subroutine named OnProjectLoad() it will be executed when ever that vba project is loaded (note it does not automatically run when a new file is opened, just when the vba is loaded).&lt;/p&gt;
&lt;p&gt;Additionally there is a key-in in MicroStation @&amp;quot;scriptfile&amp;quot; that will run the key-ins in the specified scriptfile. Scriptfile can be a complete path. Finally there is another key-in EXPAND KEYIN that lets you use Configuration variables in a keyin command. EXPAND KEYIN can be shortened to $.&lt;/p&gt;
&lt;p&gt;This vba:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Sub OnProjectLoad()
Dim scriptFile As String

scriptFile = &amp;quot;path\to\script\file&amp;quot;
&amp;#39;-- to run script file listed in variable STARTUP_KEYINS: scriptFile = &amp;quot;$(STARTUP_KEYINS)&amp;quot;
CadInputQueue.SendCommand &amp;quot;$ @&amp;quot;&amp;quot;&amp;quot; &amp;amp; scriptFile &amp;amp; &amp;quot;&amp;quot;&amp;quot;&amp;quot;

End Sub&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;will run the script file specified in the scriptFile string whenever the vba project is loaded. use &lt;span&gt;MS_VBAAUTOLOADPROJECTS variable to automatically load the vba when MicroStation starts.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you also set a variable pointing to your script file in your configuration, for example: STARTUP_KEYINS = path\to\script.txt, and adjust the vba to use that variable.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Summary:&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;create vba with OnProjectLoad() subroutine&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;set the vba to automatically load in your config with MS_VBAAUTOLOADPROJECTS variable&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;define variable STARTUP_KEYINS as the path to the text file of key-ins you want to run&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;If you want the key-ins to run anytime a dgn is loaded you&amp;#39;ll need to use Mary&amp;#39;s instructions to use clsDGNOpenClose&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/761441?ContentTypeID=1</link><pubDate>Tue, 11 Apr 2023 16:59:57 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:94902663-1dd2-4d62-b1c3-6599fb64a326</guid><dc:creator>MaryB</dc:creator><description>&lt;p&gt;While It may be possible to have an AutoRun.mvba that called and executed a script, I couldn&amp;#39;t tell you howe to do that, exactly.&lt;/p&gt;
&lt;p&gt;I have it run my key-ins directly. If you use the one from the links in this thread, you don&amp;#39;t have to write it from scratch - you just have to edit it.&lt;/p&gt;
&lt;p&gt;Basically, you would&amp;nbsp;load the MVBA through the project manager, highlight it in the list, then click the icon for Visual Basic editor which will open its own window.&lt;/p&gt;
&lt;p&gt;You want to edit the Class module of the AutoRun project - it&amp;#39;s called &amp;quot;clsDGNOpenClose&amp;quot;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/273/pastedimage1681231578323v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;There are two subroutines in this code that you will edit:&amp;nbsp;&lt;strong&gt;m_OpenCloseHooks_OnDesignFileOpened&lt;/strong&gt; and &lt;strong&gt;m_OpenCloseHooks_OnDesignFileClosed&lt;/strong&gt;.&lt;br /&gt;These correspond to &amp;quot;commands I want to run any time I open a file&amp;quot; and &amp;quot;commands I want to run any time a file is closed&amp;quot;&lt;/p&gt;
&lt;p&gt;You can send input a few different ways, but if you already have your keyins figured out, you would add lines that look like&lt;/p&gt;
&lt;p&gt;CadInputQueue.SendKeyin &amp;quot;update fields&amp;quot;&lt;/p&gt;
&lt;p&gt;except that my &amp;quot;update fields&amp;quot; would be whatever your keyin string would be. You do need the &amp;quot;quote&amp;quot; marks.&lt;/p&gt;
&lt;p&gt;Once you&amp;#39;ve done that, you Save your updated macro.&lt;/p&gt;
&lt;p&gt;To make sure that it runs every time you use MicroStation, you can check the &amp;quot;Autoload&amp;quot; column in the VBA project manager. This will write the file name into your user configuration. Alternately, you can directly edit your configuration (UCF, PCF, etc.) to add the path and name of your MVBA to the MS_VBAAUTOLOADPROJECTS variable&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/761419?ContentTypeID=1</link><pubDate>Tue, 11 Apr 2023 15:20:08 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:1dbbc068-94f5-4270-874c-f8490d7ea1c4</guid><dc:creator>Cole DeBolt</dc:creator><description>&lt;p&gt;Is the autorun.mvba a generic file that calls out another key in file? Do i need to write autorun.mvba? I have a complex text file already written for a certain client and would like to just have it run that file via the pcf. It&amp;#39;s a pain to try and use this through the shortcut icon.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/748658?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2023 04:12:20 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7a653f84-0201-4299-8a2e-f3f15ee02f3d</guid><dc:creator>Yongan.Fu</dc:creator><description>&lt;p&gt;MicroStation CE actually does support -s option after we toggle on the &amp;quot;Execute Startup Script&amp;quot; in Preference.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/273/pastedimage1673323839380v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;See the description for this from online help:&lt;/p&gt;
&lt;p&gt;&lt;a id="" href="https://docs.bentley.com/LiveContent/web/MicroStation%20Help-v22/en/PreferencesOperation.html"&gt;https://docs.bentley.com/LiveContent/web/MicroStation%20Help-v22/en/PreferencesOperation.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:620px;" alt=" " src="/resized-image/__size/1240x480/__key/communityserver-discussions-components-files/273/7824.png" /&gt;&lt;/p&gt;
&lt;p&gt;We can place any keyins in the cmdFile.txt.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/748640?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2023 22:43:18 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:646004b4-a22b-4143-9957-bd4c4d964226</guid><dc:creator>MaryB</dc:creator><description>&lt;p&gt;Please check out &lt;a href="/products/microstation/w/askinga/1109/run-a-vba-macro-when-opening-or-closing-design-files"&gt;this article&lt;/a&gt; - I use this approach (and an edited version of this file) to perform basic setup for a few things I personally like.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/748601?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2023 16:12:56 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:11fb2007-3f4c-41c0-adb6-935f68145abd</guid><dc:creator>Jon Summers</dc:creator><description>[quote userid="1355622" url="~/products/microstation/f/microstation-forum/87490/running-a-keyin-at-startup/748588"]what is the best way to execute vba&amp;#39;s automatically on startup?[/quote]
&lt;p&gt;Please post questions about VBA to the &lt;a title="Be Communities: MicroStation Programming Forum" href="/products/programming/microstation_programming/f/microstation-programming---forum" rel="noopener noreferrer" target="_blank"&gt;Programming Forum&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;See &lt;a title="LA Solutions: Handling MicroStation&amp;reg; Events with VBA" href="http://www.la-solutions.co.uk/content/connect/mvba/MVBA-DgnEvents.htm#Autorun" rel="noopener noreferrer" target="_blank"&gt;this page&lt;/a&gt; for information about handling MicroStation events with VBA, such as &lt;em&gt;On Design File Open&lt;/em&gt;.&amp;nbsp; Read the paragraph about &lt;code&gt;OnProjectLoad&lt;/code&gt;, which answers your question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/748588?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2023 14:43:59 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:ee2fb144-a19f-4035-b135-2b8324c687a8</guid><dc:creator>Cole DeBolt</dc:creator><description>&lt;p&gt;Jon, that being said, in your opinion, what is the best way to execute vba&amp;#39;s automatically on startup? I&amp;#39;m setting up several client workspaces and I want to try to do this as organized and efficiently as possible. Thank you,&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/748584?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2023 14:18:06 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:36dca0c8-4bca-4c8a-b642-38b8d75e9406</guid><dc:creator>Cole DeBolt</dc:creator><description>&lt;p&gt;Bam! thanks Jon, i tried cadinputqueue but forgot the VBA execute part. lol. I&amp;#39;m not very savvy with vba, but, i just need to acclimate to it, theres so much more versatility.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/748583?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2023 14:13:10 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:00ff3b4e-a391-4bdd-9796-891b4ef07a04</guid><dc:creator>Jon Summers</dc:creator><description>[quote userid="5932" url="~/products/microstation/f/microstation-forum/87490/running-a-keyin-at-startup/246878"]It is also possible to use MS BASIC macro as autostart[/quote]
&lt;p&gt;MicroStation BASIC is obsolete.&amp;nbsp; It is not included with MicroStation CONNECT.&lt;/p&gt;
[quote userid="1355622" url="~/products/microstation/f/microstation-forum/87490/running-a-keyin-at-startup/748581"]I&amp;#39;m using Select Series 10 version 08.11.09.829.. I&amp;#39;m trying to attach a reference using, MbeSendKeyin[/quote]
&lt;p&gt;Prefer to use VBA.&amp;nbsp; Your key-in will continue to be useful with MicroStation CONNECT...&lt;/p&gt;
&lt;pre&gt;VBA EXECUTE CadInputQueue.SendKeyin &amp;quot;rf=REF_LOCATION:mylarb.3d,,,,,&amp;quot;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/748581?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2023 13:56:50 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:394b1a43-c37e-438d-a161-898e5ef47257</guid><dc:creator>Cole DeBolt</dc:creator><description>&lt;p&gt;I&amp;#39;m using Select Series 10 version 08.11.09.829.. I&amp;#39;m trying to attach a reference using, MbeSendKeyin &amp;quot;rf=REF_LOCATION:mylarb.3d,,,,,&amp;quot;&lt;/p&gt;
&lt;p&gt;This command works as a key in. I have the autostart.bas in the macro folder with the above command. I have the above parameters written in my ucf file. Not sure why its giving me a syntax compilation error, unless there is another syntax format for this .bas in my version.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/746590?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2022 13:35:32 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:de6f00c0-4d6b-407a-b53e-dafad61fd5c2</guid><dc:creator>Cole DeBolt</dc:creator><description>&lt;meta content="text/html; charset=utf-8" /&gt;
&lt;meta name="Generator" content="Microsoft Word 15 (filtered medium)" /&gt;
&lt;!--[if !mso]&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;![endif]--&gt;


&lt;div class="WordSection1"&gt;
&lt;div class=""&gt;Thank you Mary. I got this to work, I just had to tweak my key in, I had made a goofy mistake. Lol. I appreciate your help. As far as people commenting that I should start a new thread, I disagree. I think my question was perfectly relevant
 to just ask on an existing one since it was already all spelled out. &lt;/div&gt;
&lt;div class=""&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/746121?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2022 18:45:13 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:3223c9e9-77d8-4658-96bb-00f1c34c5351</guid><dc:creator>mwlong</dc:creator><description>&lt;p&gt;It&amp;#39;s best practice to start a new post and reference this old post. The vba may need some updating to run in SS10&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/746120?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2022 18:38:45 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d62fcf17-3b1d-475d-9851-da33e01cc27f</guid><dc:creator>MaryB</dc:creator><description>&lt;p&gt;The link below to a VBA macro is absolutely viable (I do this).&lt;br /&gt;I imagine that for V8i, the link to running commands would still work as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running a keyin at startup</title><link>https://communities.bentley.com/thread/746119?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2022 18:31:17 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5a168bc7-2568-4bac-b22c-e990a58410ca</guid><dc:creator>Cole DeBolt</dc:creator><description>&lt;p&gt;What format would work in V8i Select series 10 nowadays? I&amp;#39;m looking to do exactly that.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Running a keyin at startup</title><link>https://communities.bentley.com/thread/246885?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2013 19:12:30 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5320e9e5-ba1b-4822-8e1d-5506c71bcd8a</guid><dc:creator>Inga Morozoff</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;J-Worker&amp;quot;]&lt;/p&gt;
&lt;p&gt;I imagine that&amp;#39;s pretty out of date by now?&lt;/p&gt;
&lt;p&gt;[/quote]&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;No, the contents of the noted article are still valid.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Other articles of interest:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://communities.bentley.com/communities/other_communities/askinga/w/askinga/run-a-vba-macro-when-opening-or-closing-design-files.aspx"&gt;http://communities.bentley.com/communities/other_communities/askinga/w/askinga/run-a-vba-macro-when-opening-or-closing-design-files.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://communities.bentley.com/communities/other_communities/askinga/w/askinga/run-commands-or-basic-macro-when-opening-files.aspx"&gt;http://communities.bentley.com/communities/other_communities/askinga/w/askinga/run-commands-or-basic-macro-when-opening-files.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Running a keyin at startup</title><link>https://communities.bentley.com/thread/246878?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2013 17:51:15 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7511a8e0-5851-4613-bf15-6b87f5e65204</guid><dc:creator>Oto</dc:creator><description>&lt;p&gt;It is also possible to use MS BASIC macro as autostart.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;add these variables to UCF or PCF file.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;MS_DGNAPPS &amp;gt; RUNMACRO&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;MS_DGNMACROS = autostart.bas&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;2.Then create autostart.bas under Project\macros&lt;/p&gt;
&lt;p&gt;3. Edit Autostart.bas and add key ins with command MbeSendKeyin followed by key-in enclosed in qoutes&lt;/p&gt;
&lt;p&gt;MbeSendKeyin &amp;quot;set nodes off&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now each time a file is opened the macro will run. Keep in mind that this soon will be outdated also because in newer versions MS BASIC support could be dropped.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Running a keyin at startup</title><link>https://communities.bentley.com/thread/246866?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2013 15:52:57 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:35b120ad-20ad-4e55-ac54-880d55fda524</guid><dc:creator>Bear</dc:creator><description>&lt;p&gt;You could also use the autorun.mvba file to run keyins via vb. I use this a lot, very handy.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>