Menus and Profiles

Menus and Profiles

Anonymous
Not applicable
132 Views
3 Replies
Message 1 of 4

Menus and Profiles

Anonymous
Not applicable
I am trying to write a Visual Basic program to install a menu into all (or
user selected) profiles that exist in Autocad 2000. The menu is an external
*.mnu file that I wish to load into the individual profiles. If I run the
code below and manually switch between profiles, running the macro to
install the menu each time, it works fine. If I try to automate it and have
Visual Basic set the current profile, install the menu, and then move to the
next profile, it doesn't work properly. When running it on multiple
profiles, the only profile that holds the menu is the last one in the
profile list. The remainder of the profiles will not have the menu
installed. The wierd part is that I can 'SEE' it working and it DOES add the
menus to each profile, it's just that when it finishes, only the last
profile still retains the menu. The portion of the program that adds to the
support path works fine and holds in all profiles. I hope I explained all
this well enough, at any rate, here is the code I am using. The menu I am
tryin gto load us called menu1.mnu......

Private Sub cmd_Done_Click()
Dim iCNT As Integer
Dim bSelected As Boolean
Dim sCurProf As String
frm_Install.Hide
sCurProf = ThisDrawing.Application.Preferences.Profiles.ActiveProfile
For iCNT = 0 To lst_Profs.ListCount - 1
bSelected = lst_Profs.Selected(iCNT)
If bSelected Then
Install_ALPro (lst_Profs.List(iCNT))
End If
Next iCNT
ThisDrawing.Application.Preferences.Profiles.ActiveProfile = sCurProf
Unload Me
End Sub

Private Sub Install_ALPro(ByVal sName)
ThisDrawing.Application.Preferences.Profiles.ActiveProfile = sName
Dim sPath As String
Dim iCount As Integer
Dim sCurSupp As String
Dim sNewMenu As AcadMenuGroup
sPath = "C:\Program Files\Menu1"
For iCount = 0 To MenuGroups.Count - 1
If UCase(MenuGroups.Item(iCount).Name) = "Menu1" Then Exit Sub
Next iCount
Set sNewMenu = MenuGroups.Load(sPath & "\Menu1")
sNewMenu.Menus.Item("&Menu1").InsertInMenuBar
(AcadApplication.Application.MenuBar.Count + 1)
sCurSupp = AcadApplication.Preferences.Files.SupportPath
If Not UCase(sCurSupp) Like "*Menu1*" Then
AcadApplication.Preferences.Files.SupportPath = sCurSupp & ";" & sPath
End If
End Sub
0 Likes
133 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Menu and toolbar positions are typically stored only upon shutdown, which
might explain why you're not seeing your menu when you reactivate a profile.
Two ideas I can think of off the top of my head:

1) Do what AutoCAD does; write to the registry. There's a whole section for
menus:
HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R15.0\ACAD-3:409\Profiles\<
>>\Menus. If you're unsure as to how you can locate and modify these
sections, take a look at the thread "Finding AutoCAD" (just below this one)

2) Set up either a lisp routine or a vba macro that tests for the existence
of your menu. If missing, it gets addedd. Like the EXPRESSMENU command.

--
Visit me at http://www2.stonemedia.com/franko

"Tim Nary" wrote in message
news:ef06bbf.-1@WebX.SaUCah8kaAW...
> I am trying to write a Visual Basic program to install a menu into all (or
> user selected) profiles that exist in Autocad 2000. The menu is an
external
> *.mnu file that I wish to load into the individual profiles. If I run the
> code below and manually switch between profiles, running the macro to
> install the menu each time, it works fine. If I try to automate it and
have
> Visual Basic set the current profile, install the menu, and then move to
the
> next profile, it doesn't work properly. When running it on multiple
> profiles, the only profile that holds the menu is the last one in the
> profile list. The remainder of the profiles will not have the menu
> installed. The wierd part is that I can 'SEE' it working and it DOES add
the
> menus to each profile, it's just that when it finishes, only the last
> profile still retains the menu. The portion of the program that adds to
the
> support path works fine and holds in all profiles. I hope I explained all
> this well enough, at any rate, here is the code I am using. The menu I am
> tryin gto load us called menu1.mnu......
0 Likes
Message 3 of 4

Anonymous
Not applicable
Frank,

This certainly grasped my attention, b/c I am having the exact same
problems with manipulating profiles. How would you recommend setting the
registry key to store the profile information? I ask b/c I don't want to
have to load menus if they aren't there, I'd rather essentially save my
profile once I have created it. Please let me know what your thoughts are.

Rob

--
----------------------------------------
Robert B. Brown
Lead Visualization Specialist
----------------------------------------
Autometric Inc.
http://www.autometric.com
0 Likes
Message 4 of 4

Anonymous
Not applicable
Hi Rob. I don't see the thread you replied to, only your response. So I'm
not quite sure what the context of your message is. Feel free to email me
direct (remove the nospam) with the particulars or start a new thread.

--
Visit AcadXtreme for a chance to win a copy of AutoCAD LT 2000
Contest ends 5/26/00
http://www.acadx.com

"Robert Brown" wrote in message
news:8F3C7A844rbrownautometriccom@167.216.240.240...
> Frank,
>
> This certainly grasped my attention, b/c I am having the exact same
> problems with manipulating profiles. How would you recommend setting the
> registry key to store the profile information? I ask b/c I don't want to
> have to load menus if they aren't there, I'd rather essentially save my
> profile once I have created it. Please let me know what your thoughts are.
>
> Rob
>
> --
> ----------------------------------------
> Robert B. Brown
> Lead Visualization Specialist
> ----------------------------------------
> Autometric Inc.
> http://www.autometric.com
0 Likes