Hi All,
I have some code that is initialized on AutoCAD 2015 startup. This code sets a few system variables and adds some file paths. Works great with one exception. On brand new installs of AutoCAD the new Getting Started (New Tab) screen prevents the initialization code from running.
If I manually set the STARTUP variable to 0 (removes the New Tab screen at startup), then the initialization code runs great at startup with no issues.
So I am wondering if anyone has any advice on how to set the STARTUP variable to 0 without manually touching each CAD machine? Keeping in mind that a simple call to set the STARTUP system variable (.SetSystemVariable("STARTUP", 0)) won't work as it is "blocked" by the New Tab screen for some reason.
I do have a workaround... If you set the /nologo switch in the icon target, then the STARTUP variable is also set to 0 (odd I know). But I am not really sure I want to depend on the /nologo switch always being there. You never know when a user might delete the icon or perform some other "accidental" action.
Does the Create Deployment utility allow you to turn the New Tab screen off? That may be my solution.
Any other ideas?
Thanks in advance!
Solved! Go to Solution.
Solved by BlackBox_. Go to Solution.
At Initialize(), register an Application.Idle event handler, and then perform your actual startup procedures there (after first unregistering the Idle event handler).
Quick example:
using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; using acApp = Autodesk.AutoCAD.ApplicationServices.Application; using System; using System.IO; [assembly: CommandClass(typeof(FOO.BAR))] namespace FOO { public class BAR : IExtensionApplication { void IExtensionApplication.Initialize() { acApp.Idle += onIdle; } void IExtensionApplication.Terminate() { } private static DocumentCollection acDocs = acApp.DocumentManager; private static void onIdle(object sender, EventArgs e) { acApp.Idle -= onIdle; // <-- do something useful here } // ... } }
Cheers
"How we think determines what we do, and what we do determines what we get."