MyAppsPaths stored in Lisp variables...

MyAppsPaths stored in Lisp variables...

mdhutchinson
Advisor Advisor
336 Views
1 Reply
Message 1 of 2

MyAppsPaths stored in Lisp variables...

mdhutchinson
Advisor
Advisor
I am needing to write some sort of a mechanism (in VBA) that would provide search paths for our companies AutoCAD applications?

Let me give some background first prior to your answering…

Currently every one of our several dozen or more Applications are written in lisp. All these are full blown apps that do many things including data extraction and material takeoffs, reporting functions, and AutoCAD automation. The menu picks are accessed from an Enterprise CUI file… which is accompanied by an MNL of the same name: OurComp.cui and OurComp.mnl

Currently, we have three global Lisp variables that get set within the MNL file that point to our Jobs, Applications, and Temp folders that our lisp applications use. Using this approach gives us the flexibility to move our applications to different location, only having to change the value of ‘e_pdr’ (program directory) lisp variable in a single location…

We are moving more into VBA… and so I would like to build the same approach for our VBA apps as we move foreword…

Question: How would I go about writing this installation ‘search path’ application in VBA. Or, is there a way that our VBA applications could read these lisp vars to get path info?
0 Likes
337 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Hi Hutch,

Probably the simplest and most reliable way is to modify your lisp to write
the three variable values to the registry and read them from there with VBA.
This way the company knowledge built into using and modifying the lisp
program is retained.

The Help file VBA code shows the VBA side of the simplest scenario which
uses an area of the registry specifically designed to hold this type of data
for the Current User.

[Start code]
Sub test()
'GetSetting Function Example
'This example first uses the SaveSetting statement to make entries in the
Windows registry (or .ini file on 16-bit Windows platforms) for the
application specified as appname, and then uses the GetSetting function to
display one of the settings. Because the default argument is specified, some
value is guaranteed to be returned. Note that section names can't be
retrieved with GetSetting. Finally, the DeleteSetting statement removes all
the application's entries.

' Variant to hold 2-dimensional array returned by GetSetting.
Dim MySettings As Variant
' Place some settings in the registry.
SaveSetting "MyApp", "Startup", "Top", 75
SaveSetting "MyApp", "Startup", "Left", 50

Debug.Print GetSetting(appname:="MyApp", section:="Startup", _
key:="Left", Default:="25")

DeleteSetting "MyApp", "Startup"

End Sub
[End Code]

The SaveSetting and GetSetting functions write and read respectively to the
"HKCU\Software\VB and VBA Program Settings" Key in the registry and to use
this from lisp write and or read data to that Key.

Alternatively, with suitable permissions you can put the data in the HKLM
part of the registry and read it using VBA code like:

[Start Code]
Function RegistryRead( spKeyPath As String, spKeyName As String) As String
On Error Resume Next
Dim sValue As String
Dim oReg As Object
Dim sPath As String
Dim sRegPath As String
Set oReg = CreateObject("WScript.Shell")
sRegPath = "HKEY_LOCAL_MACHINE\" & spKeyPath & spKeyName
'Retrieve the Key
sValue = oReg.RegRead(sRegPath)
Set oReg = Nothing
If Len (sValue) > 0 Then
RegistryRead = sValue
Else
MsgBox "No meaningful value found"
End If
End Function ' RegistryRead
[End Code]

--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com
wrote in message news:5450820@discussion.autodesk.com...
I am needing to write some sort of a mechanism (in VBA) that would provide
search paths for our companies AutoCAD applications?

Let me give some background first prior to your answering.

Currently every one of our several dozen or more Applications are written in
lisp. All these are full blown apps that do many things including data
extraction and material takeoffs, reporting functions, and AutoCAD
automation. The menu picks are accessed from an Enterprise CUI file. which
is accompanied by an MNL of the same name: OurComp.cui and OurComp.mnl

Currently, we have three global Lisp variables that get set within the MNL
file that point to our Jobs, Applications, and Temp folders that our lisp
applications use. Using this approach gives us the flexibility to move our
applications to different location, only having to change the value of
'e_pdr' (program directory) lisp variable in a single location.

We are moving more into VBA. and so I would like to build the same approach
for our VBA apps as we move foreword.

Question: How would I go about writing this installation 'search path'
application in VBA. Or, is there a way that our VBA applications could read
these lisp vars to get path info?
0 Likes