Author Topic: Telling if a VBA is loaded from lisp?  (Read 1434 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Telling if a VBA is loaded from lisp?
« on: March 09, 2007, 08:27:24 PM »
This was asked and answered on one of the Discussion Groups.
The person never returned to acknowledge the validity or otherwise of my answer,
so I thought I'd post it somewhere where people care. :-)

Quote
I know I can load with vl-vbaload...
but, how can I determine from my lisp code if the associated VBA app is loaded so that a call to a VBA function can be ran?
... is there a Visual Lisp funciton that will tell me?

Of course, (VL-VBARUN FileSpec.dvb!MacroName) will run the macro - loading the file if necessary.
.. but to answer the actual question :-

Code: [Select]
(DEFUN ReturnLoadedVba (/ VBProjects Index ProjectList)
    (SETQ VBProjects (VLAX-GET-PROPERTY (VLA-GET-VBE (VLAX-GET-ACAD-OBJECT))
                                        'VbProjects
                     )
          Index      1
    )
    (REPEAT (VLA-GET-COUNT VBProjects)
        (SETQ ProjectList (CONS (VLA-GET-NAME (VLA-ITEM VBProjects Index))
                                ProjectList
                          )
              Index       (1+ Index)
        )
    )
    (REVERSE ProjectList)
)

Code: [Select]
(IF (VL-POSITION "ACADProjectx" (ReturnLoadedVba))
    (ALERT "Yep")
    (ALERT "Nope")
)


Just an additional note,
The VBAIDE needs to be loaded for this to work.
So you may want to test for acvba.arx

/// kwb

Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Jeff_M

  • King Gator
  • Posts: 3957
  • C3D user & customizer
Re: Telling if a VBA is loaded from lisp?
« Reply #1 on: March 09, 2007, 09:05:49 PM »
Thanks Kerry!

See, I care! :-)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Telling if a VBA is loaded from lisp?
« Reply #2 on: March 09, 2007, 10:17:09 PM »
  :-D
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Bryco

  • Water Moccasin
  • Posts: 1850
Re: Telling if a VBA is loaded from lisp?
« Reply #3 on: March 09, 2007, 11:10:30 PM »
I think I saw that post Kerry, the interesting part is why do people want to load different dvb's. I load 1 big one with everything in it and I don't need any lisp to do it. Perhaps it is 0.0001 seconds faster to load them as you need them but???.
Ps; expecting flack on this one

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Telling if a VBA is loaded from lisp?
« Reply #4 on: March 09, 2007, 11:18:01 PM »
don't expect flack :-), not from me.

I just saw it as an interesting programming problem.

Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

JohnF

  • Newt
  • Posts: 48
Re: Telling if a VBA is loaded from lisp?
« Reply #5 on: March 10, 2007, 12:38:53 AM »
Kerry

Even Crow Eaters care when Banana Benders post  :roll:


Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Telling if a VBA is loaded from lisp?
« Reply #6 on: March 10, 2007, 12:50:49 AM »
Hi John .. long time.  :-P
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

JohnF

  • Newt
  • Posts: 48
Re: Telling if a VBA is loaded from lisp?
« Reply #7 on: March 10, 2007, 01:18:29 AM »
G'Day Kerry,

Yes it is a long time - I have been lurking too long.

I have been out of the CAD scene for a while and more into management, accounting, engineering etc.

Now i'm back; I see you are still very active.

Kind Regards to all the VBA people - I think I was headless in midnight express if my memory servrs me right when I took the management position.

John

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9334
Re: Telling if a VBA is loaded from lisp?
« Reply #8 on: March 10, 2007, 09:53:38 AM »
Okay I gotta ask; how did the names ``Banana Benders'' and ``Crow Eaters'' come about? (And dont try to be a Dag and call me a ``Sepo'' cause I aint no septic tank!)
TheSwamp.org (serving the CAD community since 2003)

Donate to TheSwamp.org

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Telling if a VBA is loaded from lisp?
« Reply #9 on: March 10, 2007, 04:39:55 PM »
 
:lol:

I have no idea John.

Sounds a bit like names school kids woulld sling at each other  ... heh, perhaps that's it, we're just a ... nah !

Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

JohnF

  • Newt
  • Posts: 48
Re: Telling if a VBA is loaded from lisp?
« Reply #10 on: March 12, 2007, 02:48:12 AM »
A Guide to STRINE (or Australian slang)

Banana bender - a person from Queensland

BANANA-BENDER name given to Queenslanders ( as bananas are grown in that State).



Crow eater a person from South Australia

Newspapers:

Croweaters
An origin of the term "crow eater" is explored in the Register, 6 February 1925, page 13e:


[It] was first applied to some of the original settlers at Mount Barker who - whether from necessity or a desire to sample strange native fauna - killed, cooked and ate some crows disguised under the term "Mount Barker pheasants"... Later the term... was applied generally to all.
Also see Register, 18 and 22 December 1926, pages 15g and 12e:


The original croweaters were Western Australian not South Australians... Why [we] are called croweaters or by whom the name was originated I am at a loss to know... G.F. Moore [in his book on Western Australia] wrote (29/4/1832)"dined on four crows and a quail" and (1/5/1832) "shot a crow for dinner".
The following appears in the Register, 15 March 1927, page 12f:


In 1851 my father and uncle travelled overland to the Bendigo diggings. On their arrival they were accosted with the words "crow-eaters"... A short time before they arrived a party of South Australians had arrived in a very hard-up state... While crossing the 90-mile desert they run out of tucker and were forced to shoot crows for food... On relating their experience they were dubbed crow-eaters. The term was afterwards applied to every new arrival from the central State.