Author Topic: (vlax-get-or-create-object prog-id)  (Read 4602 times)

0 Members and 1 Guest are viewing this topic.

Grrr1337

  • Swamp Rat
  • Posts: 812
(vlax-get-or-create-object prog-id)
« on: December 12, 2016, 08:59:30 AM »
Hi guys,
I'm having problem with the prog-id argument on vlax-get-or-create-acad-object:
Code: [Select]
_$ (setq NP++ (vlax-get-or-create-object "Notepad++.Application.722"))
nil
_$
Assuming that the info I need for the "<Vendor>.<Component>.<Version>" can be found here:

Can anyone taught me how to properly use it (the prog-id argument) ? - for example I want to obtain objects from other applications like: chrome, revit, 3ds max ... for exploration purposes  :police:
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: (vlax-get-or-create-object prog-id)
« Reply #1 on: December 12, 2016, 09:24:58 AM »
Not all programs support ActiveX. In the case of Notepad++ a plugin seems to be required:
https://sourceforge.net/projects/nppactivexplugin

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: (vlax-get-or-create-object prog-id)
« Reply #2 on: December 12, 2016, 10:31:54 AM »
Thanks Roy,
But is there a rule how populate this argument? For example none of these succeeded:
Code: [Select]
_$ (setq 3DSmax (vlax-get-or-create-object "3dsMax.Application.17.0.630.0"))
nil
_$ (setq 3DSmax (vlax-get-or-create-object "3ds Max.Application.17"))
nil
_$ (setq 3DSmax (vlax-get-or-create-object "3ds Max.Application.17`.0`.630`.0"))
nil
_$ (setq 3DSmax (vlax-get-or-create-object "3dsMax.Application.17`.0`.630`.0"))
nil
_$ (setq 3DSmax (vlax-get-or-create-object "3ds Max.Application"))
nil
_$ (setq 3DSmax (vlax-get-or-create-object "3dsMax.Application"))
nil
_$

Is the above picture the right way for obtaining that info for vlax-***-object functions or I misunderstand something and must look somewhere else? (generally speaking)
And I know that it supports ActiveX, because of this documentation.
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: (vlax-get-or-create-object prog-id)
« Reply #3 on: December 12, 2016, 12:16:42 PM »
Kinda related ... you might find this useful for finding ProgIDs without having to resort to searching via RegEdit:

Code: [Select]
(defun _FindProjIDs ( pattern )
    (   (lambda ( pfx sfx pattern )
            (vl-sort
                (vl-remove-if-not
                    (function
                        (lambda (x)
                            (and
                                (eq 'str (type x))
                                (wcmatch (strcase x) pattern)
                            )
                        )
                    )
                    (mapcar
                        (function
                            (lambda (x)
                                (vl-registry-read (strcat pfx x sfx))
                            )
                        )
                        (vl-registry-descendents pfx)
                    )
                )
               '<
            )       
        )
        "HKEY_CLASSES_ROOT\\CLSID\\"
        "\\ProgID"
        (strcase pattern)
    )
)

e.g.

(_FindProjIDs "*objectdbx*") ;; I don't have 3D max

>>

(
    "ObjectDBX.AxDbDocument.17"
    "ObjectDBX.AxDbDocument.18"
    "ObjectDBX.AxDbDocument.19"
    "ObjectDBX.AxDbDocument.20"
)


FWIW, cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: (vlax-get-or-create-object prog-id)
« Reply #4 on: December 12, 2016, 01:39:22 PM »
That looks very handy MP!
Althoough I didn't expected that obtaining a COM from another software is such a pain in the @$$!
Perhaps I need start studying .NET for a better understanding & achieving this task (ATM I'm completely boxed with lisp).

Anyway I'm leaving this for further interests.

EDIT: BTW Roy, your advice worked:
Code: [Select]
_$ (setq NP++ (vlax-get-or-create-object "NotepadPlusPlus.Application"))
#<VLA-OBJECT INppApplication 000000211d68f438>
_$ (vlax-dump-object NP++ T)
; INppApplication: This interface represents the complete Notepad++ application.
; Property values:
;   editors (RO) = ...Indexed contents not shown...
;   menu (RO) = ...Indexed contents not shown...
; Methods supported:
;   executeScriptFromFile (3)
;   executeScriptFromString (3)
;   messageBox (3)
;   quit ()
T
_$
I appreciate your help!
« Last Edit: December 12, 2016, 02:01:21 PM by Grrr1337 »
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg