<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Storing program defaults in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/storing-program-defaults/m-p/321556#M93463</link>
    <description>&amp;gt;&amp;gt; not in the Drawing....&lt;BR /&gt;
So, the Dictionary and Xdata is out from your list.&lt;BR /&gt;
I am using Xdict and Xdata to send variables between Lisp and VBA&lt;BR /&gt;
btw: I learned these from Joe Sutphin..... Thanks Joe if you are reading&lt;BR /&gt;
this Email&lt;BR /&gt;
&amp;gt;&amp;gt; Text File?&lt;BR /&gt;
For me I just hate it, because anybody can open up the text file.(what do&lt;BR /&gt;
you think?)&lt;BR /&gt;
&amp;gt;&amp;gt; Registry?&lt;BR /&gt;
I am doing it noe for the smaller data size.(Am I right?)&lt;BR /&gt;
&lt;BR /&gt;
thanks&lt;BR /&gt;
amy&lt;BR /&gt;
&lt;BR /&gt;
Rakesh Rao wrote in message &amp;lt;391CB3A4.2373BDB0@4d-technologies.com&amp;gt;...&lt;BR /&gt;
&amp;gt;Hello!&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;What would be the most elegant way to store and retrieve program&lt;BR /&gt;
&amp;gt;parameters for a custom VBA application? I need to set up defaults for a&lt;BR /&gt;
&amp;gt;number of real, integer and string values for my application and show&lt;BR /&gt;
&amp;gt;the defaults if they have not been set yet. At the end of the session, I&lt;BR /&gt;
&amp;gt;would like to store these on the disk somewhere (INI Text Files?,&lt;BR /&gt;
&amp;gt;Registry?) but not within the DWG file.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;Any pointers of what would be a professional way to handle this is&lt;BR /&gt;
&amp;gt;appreciated.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;Thanks&lt;BR /&gt;
&amp;gt;Rakesh&lt;BR /&gt;
&amp;gt;-----------------------------------------------&lt;BR /&gt;
&amp;gt;    Four Dimension Technologies, Singapore&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;TechCenter URL: http://www.4d-technologies.com/techcenter&lt;BR /&gt;
&amp;gt;Home Page URL : http://www.4d-technologies.com&lt;BR /&gt;
&amp;gt;Member of the Autodesk Developer Network(ADN)&lt;BR /&gt;
&amp;gt;------------------------------------------------&lt;BR /&gt;
&amp;gt;</description>
    <pubDate>Sat, 13 May 2000 01:54:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2000-05-13T01:54:19Z</dc:date>
    <item>
      <title>Storing program defaults</title>
      <link>https://forums.autodesk.com/t5/vba-forum/storing-program-defaults/m-p/321555#M93462</link>
      <description>Hello!&lt;BR /&gt;
&lt;BR /&gt;
What would be the most elegant way to store and retrieve program&lt;BR /&gt;
parameters for a custom VBA application? I need to set up defaults for a&lt;BR /&gt;
number of real, integer and string values for my application and show&lt;BR /&gt;
the defaults if they have not been set yet. At the end of the session, I&lt;BR /&gt;
would like to store these on the disk somewhere (INI Text Files?,&lt;BR /&gt;
Registry?) but not within the DWG file.&lt;BR /&gt;
&lt;BR /&gt;
Any pointers of what would be a professional way to handle this is&lt;BR /&gt;
appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Rakesh&lt;BR /&gt;
-----------------------------------------------&lt;BR /&gt;
    Four Dimension Technologies, Singapore&lt;BR /&gt;
&lt;BR /&gt;
TechCenter URL: http://www.4d-technologies.com/techcenter&lt;BR /&gt;
Home Page URL : http://www.4d-technologies.com&lt;BR /&gt;
Member of the Autodesk Developer Network(ADN)&lt;BR /&gt;
------------------------------------------------</description>
      <pubDate>Sat, 13 May 2000 01:45:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/storing-program-defaults/m-p/321555#M93462</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-13T01:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Storing program defaults</title>
      <link>https://forums.autodesk.com/t5/vba-forum/storing-program-defaults/m-p/321556#M93463</link>
      <description>&amp;gt;&amp;gt; not in the Drawing....&lt;BR /&gt;
So, the Dictionary and Xdata is out from your list.&lt;BR /&gt;
I am using Xdict and Xdata to send variables between Lisp and VBA&lt;BR /&gt;
btw: I learned these from Joe Sutphin..... Thanks Joe if you are reading&lt;BR /&gt;
this Email&lt;BR /&gt;
&amp;gt;&amp;gt; Text File?&lt;BR /&gt;
For me I just hate it, because anybody can open up the text file.(what do&lt;BR /&gt;
you think?)&lt;BR /&gt;
&amp;gt;&amp;gt; Registry?&lt;BR /&gt;
I am doing it noe for the smaller data size.(Am I right?)&lt;BR /&gt;
&lt;BR /&gt;
thanks&lt;BR /&gt;
amy&lt;BR /&gt;
&lt;BR /&gt;
Rakesh Rao wrote in message &amp;lt;391CB3A4.2373BDB0@4d-technologies.com&amp;gt;...&lt;BR /&gt;
&amp;gt;Hello!&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;What would be the most elegant way to store and retrieve program&lt;BR /&gt;
&amp;gt;parameters for a custom VBA application? I need to set up defaults for a&lt;BR /&gt;
&amp;gt;number of real, integer and string values for my application and show&lt;BR /&gt;
&amp;gt;the defaults if they have not been set yet. At the end of the session, I&lt;BR /&gt;
&amp;gt;would like to store these on the disk somewhere (INI Text Files?,&lt;BR /&gt;
&amp;gt;Registry?) but not within the DWG file.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;Any pointers of what would be a professional way to handle this is&lt;BR /&gt;
&amp;gt;appreciated.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;Thanks&lt;BR /&gt;
&amp;gt;Rakesh&lt;BR /&gt;
&amp;gt;-----------------------------------------------&lt;BR /&gt;
&amp;gt;    Four Dimension Technologies, Singapore&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;TechCenter URL: http://www.4d-technologies.com/techcenter&lt;BR /&gt;
&amp;gt;Home Page URL : http://www.4d-technologies.com&lt;BR /&gt;
&amp;gt;Member of the Autodesk Developer Network(ADN)&lt;BR /&gt;
&amp;gt;------------------------------------------------&lt;BR /&gt;
&amp;gt;</description>
      <pubDate>Sat, 13 May 2000 01:54:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/storing-program-defaults/m-p/321556#M93463</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-13T01:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Storing program defaults</title>
      <link>https://forums.autodesk.com/t5/vba-forum/storing-program-defaults/m-p/321557#M93464</link>
      <description>Hi Rakesh,&lt;BR /&gt;
&lt;BR /&gt;
There are 2 places, where you could store such information.&lt;BR /&gt;
1. Registry&lt;BR /&gt;
 You will have to use the Win32API to read and write to the registry. Or you&lt;BR /&gt;
 could utilize the Lisp functions such as 'Setenv' &amp;amp; 'Getenv' as shown&lt;BR /&gt;
below:&lt;BR /&gt;
 Dim old_value As String&lt;BR /&gt;
 Dim tmp As String&lt;BR /&gt;
&lt;BR /&gt;
 'Store the existing value in a variable.&lt;BR /&gt;
 old_value = ThisDrawing.GetVariable("USERS1")&lt;BR /&gt;
&lt;BR /&gt;
 'Write Data1 = 3.1415 into the registry under the following path&lt;BR /&gt;
&lt;BR /&gt;
'HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R15.0\ACAD-1:409\FixedProfile\G&lt;BR /&gt;
eneral&lt;BR /&gt;
 ThisDrawing.SendCommand "(setenv ""Data1"" ""3.1415"") "&lt;BR /&gt;
&lt;BR /&gt;
 'Read Data1 from the registry and assign it to USERS1.&lt;BR /&gt;
 ThisDrawing.SendCommand "(setvar ""users1"" (getenv ""Data1"")) "&lt;BR /&gt;
&lt;BR /&gt;
 'Read the value from USERS1&lt;BR /&gt;
 tmp = ThisDrawing.GetVariable("USERS1")&lt;BR /&gt;
&lt;BR /&gt;
 'Display the value&lt;BR /&gt;
 MsgBox tmp&lt;BR /&gt;
&lt;BR /&gt;
 'Assign the orginal value back to USERS1.&lt;BR /&gt;
 ThisDrawing.SetVariable "USERS1", old_value&lt;BR /&gt;
&lt;BR /&gt;
2. Text file - Acad.cfg&lt;BR /&gt;
 AutoCAD maintains a CFG file in which there is room to save application&lt;BR /&gt;
data&lt;BR /&gt;
 under the [AppData] section. 'Setcfg' &amp;amp; 'Getcfg' are specific functions in&lt;BR /&gt;
Lisp&lt;BR /&gt;
 (not in VBA) to read and write data to this section as shown below:&lt;BR /&gt;
 Dim old_value As String&lt;BR /&gt;
 Dim tmp As String&lt;BR /&gt;
&lt;BR /&gt;
 'Store the existing value in a variable.&lt;BR /&gt;
 old_value = ThisDrawing.GetVariable("USERS1")&lt;BR /&gt;
&lt;BR /&gt;
 'Write Data1 = 3.1415 into the cfg file under the [AppData] section&lt;BR /&gt;
 ThisDrawing.SendCommand "(setcfg ""AppData/Data1"" ""3.1415"") "&lt;BR /&gt;
&lt;BR /&gt;
 'Read Data1 from the cfg file and assign it to USERS1.&lt;BR /&gt;
 ThisDrawing.SendCommand "(setvar ""users1"" (getcfg ""AppData/Data1"")) "&lt;BR /&gt;
&lt;BR /&gt;
 'Read the value from USERS1&lt;BR /&gt;
 tmp = ThisDrawing.GetVariable("USERS1")&lt;BR /&gt;
&lt;BR /&gt;
 'Display the value&lt;BR /&gt;
 MsgBox tmp&lt;BR /&gt;
&lt;BR /&gt;
 'Assign the orginal value back to USERS1.&lt;BR /&gt;
 ThisDrawing.SetVariable "USERS1", old_value&lt;BR /&gt;
&lt;BR /&gt;
For details on the following, please refer the online documentation&lt;BR /&gt;
Setenv, Getenv, Setcfg, Getcfg&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
Thilak&lt;BR /&gt;
&lt;BR /&gt;
Rakesh Rao &lt;TECHCENTER&gt; wrote in message&lt;BR /&gt;
news:391CB3A4.2373BDB0@4d-technologies.com...&lt;BR /&gt;
&amp;gt; Hello!&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; What would be the most elegant way to store and retrieve program&lt;BR /&gt;
&amp;gt; parameters for a custom VBA application? I need to set up defaults for a&lt;BR /&gt;
&amp;gt; number of real, integer and string values for my application and show&lt;BR /&gt;
&amp;gt; the defaults if they have not been set yet. At the end of the session, I&lt;BR /&gt;
&amp;gt; would like to store these on the disk somewhere (INI Text Files?,&lt;BR /&gt;
&amp;gt; Registry?) but not within the DWG file.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Any pointers of what would be a professional way to handle this is&lt;BR /&gt;
&amp;gt; appreciated.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks&lt;BR /&gt;
&amp;gt; Rakesh&lt;BR /&gt;
&amp;gt; -----------------------------------------------&lt;BR /&gt;
&amp;gt;     Four Dimension Technologies, Singapore&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; TechCenter URL: http://www.4d-technologies.com/techcenter&lt;BR /&gt;
&amp;gt; Home Page URL : http://www.4d-technologies.com&lt;BR /&gt;
&amp;gt; Member of the Autodesk Developer Network(ADN)&lt;BR /&gt;
&amp;gt; ------------------------------------------------&lt;BR /&gt;
&amp;gt;&lt;/TECHCENTER&gt;</description>
      <pubDate>Sun, 14 May 2000 11:35:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/storing-program-defaults/m-p/321557#M93464</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-14T11:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Storing program defaults</title>
      <link>https://forums.autodesk.com/t5/vba-forum/storing-program-defaults/m-p/321558#M93465</link>
      <description>Hi Rakesh,&lt;BR /&gt;
I was faced with the same decision a few months ago.  After considering ini&lt;BR /&gt;
files, the registry, and database, I chose to go with an Access database.  I&lt;BR /&gt;
wrote a class to manipulate the user settings from the database.  When a&lt;BR /&gt;
user setting is first called for by the code (i.e..&lt;BR /&gt;
clsUserSetting.GetUserSetting("11x17_Printer") )  It loads the settings from&lt;BR /&gt;
database into a global array.  (This allows faster access to the settings in&lt;BR /&gt;
subsequent calls)  When the Acad session closes, or when the code calls the&lt;BR /&gt;
function, the database is updated to the new values if they have changed.&lt;BR /&gt;
This method has working well for us, and I have not had any problems come up&lt;BR /&gt;
since I implemented it several months ago.  (We are using it on about 10&lt;BR /&gt;
computers.)&lt;BR /&gt;
Hope this helps,&lt;BR /&gt;
&lt;BR /&gt;
-Adam&lt;BR /&gt;
&lt;BR /&gt;
"Rakesh Rao" &lt;TECHCENTER&gt; wrote in message&lt;BR /&gt;
news:391CB3A4.2373BDB0@4d-technologies.com...&lt;BR /&gt;
&amp;gt; Hello!&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; What would be the most elegant way to store and retrieve program&lt;BR /&gt;
&amp;gt; parameters for a custom VBA application? I need to set up defaults for a&lt;BR /&gt;
&amp;gt; number of real, integer and string values for my application and show&lt;BR /&gt;
&amp;gt; the defaults if they have not been set yet. At the end of the session, I&lt;BR /&gt;
&amp;gt; would like to store these on the disk somewhere (INI Text Files?,&lt;BR /&gt;
&amp;gt; Registry?) but not within the DWG file.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Any pointers of what would be a professional way to handle this is&lt;BR /&gt;
&amp;gt; appreciated.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks&lt;BR /&gt;
&amp;gt; Rakesh&lt;BR /&gt;
&amp;gt; -----------------------------------------------&lt;BR /&gt;
&amp;gt;     Four Dimension Technologies, Singapore&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; TechCenter URL: http://www.4d-technologies.com/techcenter&lt;BR /&gt;
&amp;gt; Home Page URL : http://www.4d-technologies.com&lt;BR /&gt;
&amp;gt; Member of the Autodesk Developer Network(ADN)&lt;BR /&gt;
&amp;gt; ------------------------------------------------&lt;BR /&gt;
&amp;gt;&lt;/TECHCENTER&gt;</description>
      <pubDate>Mon, 15 May 2000 13:10:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/storing-program-defaults/m-p/321558#M93465</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-15T13:10:19Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/storing-program-defaults/m-p/321559#M93466</link>
      <description>I usually utilize the GetSetting and SaveSetting functions in VB &amp;amp; VBA.&lt;BR /&gt;
These store your registry entries in a section specifically set aside in the&lt;BR /&gt;
registry for Visual Basic programs. The key it writes to looks like :&lt;BR /&gt;
&lt;BR /&gt;
HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Your Program\Your Key&lt;BR /&gt;
&lt;BR /&gt;
The syntax for GetSetting is - GettSetting(appname, section, key[, default])</description>
      <pubDate>Tue, 16 May 2000 11:16:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/storing-program-defaults/m-p/321559#M93466</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-16T11:16:14Z</dc:date>
    </item>
  </channel>
</rss>

