Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

HOW TO GET MENUITEM TAGSTRING OR LABLE OF CLICKED MENUITEM USING VBA/LISP

Posted on 2004-09-30
4
Medium Priority
?
307 Views
Last Modified: 2008-02-01
running autocad map 5, this what I'm trying to do. I have several saved queries that I am running from a dropdown menu in a some what clunky way, got an idea to change it but am stumped.
I want to be able to click on the menu item and have it run a single dvb project (the same one for all) that gets the tagstring of the selected menuitem then runs the query using the 'case' method based on that tag string.
Right now I've got a seperate sub for each menuitem that uses a function call to the query function, and they are filling up my macro manager.
Is it even possible to get the tagstring of the clicked menuitems/toolbar items? I think this might be a good way to do a block insert toolbar also.
Thanks for any help, I've been stumped for 2 days.
willing to use lisp or a combo of the 2 if I have too....
0
Comment
Question by:norrin_radd
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
david_barker earned 1000 total points
ID: 12212634
One (of many possible) solutions, trying to avoid AutoLISP, except just for the SETVAR (but could of done it without) :

The pop-up menu :

***POP13
**TEST
M_test  [&My test]
M_act_1 [Action &1]^C^C(setvar "USERI1" 1) -EXECVBA "c:/temp/MyProjet.dvb!MyModule.Hello"
M_act_2 [Action &2]^C^C(setvar "USERI1" 2) -EXECVBA "c:/temp/MyProjet.dvb!MyModule.Hello"
M_act_3 [Action &3]^C^C(setvar "USERI1" 3) -EXECVBA "c:/temp/MyProjet.dvb!MyModule.Hello"

The VBA code :

Public Sub Hello()
  MsgBox ThisDrawing.GetVariable("USERI1")
End Sub

This assumes that the system variable USERI1 isn't used elsewhere in your application.
0
 
LVL 10

Author Comment

by:norrin_radd
ID: 12217856
man I forgot about the useri variables thanks I think that will work good. just out of curiousity how would you have done it without those? and I'm guessing but it doesnt look like there is a way to get the tagstring of a clicked menuitem?
thanks again
0
 
LVL 6

Expert Comment

by:david_barker
ID: 12217991
I could of used a shared variable between Visual Lisp and VBA, but that would of got somewhat complicated.
Or perhaps I would of used the BeginCommand event.
Or, to be honest, by doing everything in plain old AutoLisp, ie.
  M_act_1 [Action &1]^C^C(hello 1)
where "hello" is my AutoLisp funtion.
0
 
LVL 10

Author Comment

by:norrin_radd
ID: 12218492
good points thanks,
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Following a number of instances of re-installing Solidworks I thought that it may be a  good idea to detail the procedure that I follow each time to ensure a good stable install. Backup: Backup your system.  It goes without saying that this i…
The following article will describe how to add/edit a dimension style through AutoCAD VBA. AutoCAD VBA has its quirks and when it comes to dimensions and controlling how they look through VBA.  This is where AutoCAD can be vividly confusing. The…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question