In lisp or Vlisp, how can I obtain the position of a popup menu among all the displayed menus?
For exemple, the menu Draw.
Thanks
With this ;):
(defun PosMenu (menuname / i posicion noexiste)
(setq i 0)
(vlax-for menu
(vla-get-menus
(vla-item
(vla-get-menugroups
(vla-get-application
(vla-get-activedocument (vlax-get-acad-object))
)
)
"ACAD"
)
)
(if (or (equal (strcase menuname) (strcase (vla-get-name menu)))
(equal (strcase menuname)
(strcase (vla-get-namenomnemonic menu))
)
)
(setq posicion i)
(setq noexiste "\nNo existe")
)
(setq i (1+ i))
)
(if posicion
(prompt (strcat "\n" (rtos posicion 2 0)))
(prompt noexiste)
)
(prin1)
) ;_defun
(posmenu "Draw") -> 6
(posmenu "draw") ->6
(posmenu "&draw") ->6
(posmenu "modify") ->9
(posmenu "speedcad") ->No existe
Un saludo de SpeedCAD... :)
CHILE
FORO: http://www.hispacad.com/foro
I tried your program and it's not exactly what I need.
For exemple, if I try your program with the Express menu, of course I change the menu group in your program, the answer will be zero. Your program give the position in the menu file not in the current display.
The answer for the express menu should have been, in my case, position 10.
So do you think it's still possible to obtain the position in the current display of a popup menu among all the popup menus from different menu group ?
Thanks
; function return the position of [name] on the menubar
; Arguments:
; [name] - string, menu item name
; return: zero based integer or nil
(defun getMenuPosition (name / lst)
(vlax-for item (vla-get-menubar (vlax-get-acad-object))
(setq lst (cons (strcase (vla-get-namenomnemonic item)) lst)))
(vl-position (strcase name) (reverse lst))
)
--
Autodesk Discussion Group Facilitator
"Marcel Goulet" <nos...@address.withheld> wrote in message
news:3876103.1086178771477.JavaMail.javamailuser@localhost...
--
Autodesk Discussion Group Facilitator
"Marcel Goulet" <nos...@address.withheld> wrote in message
news:25981377.108620272...@jiveforum2.autodesk.com...
> Thanks alot !
Duplicate menu names, not much sense, but possible.
--
Autodesk Discussion Group Facilitator
"Jason Piercey" <Jason@AtrEngDotCom> wrote in message news:40be0731$1_1@newsprd01...