TheSwamp

Code Red => VB(A) => Topic started by: Matersammichman on May 23, 2006, 05:32:04 PM

Title: Vanilla load
Post by: Matersammichman on May 23, 2006, 05:32:04 PM
When you open CAD, ACADProject(Global1) is opened.
I'd like to have CAD load a dvb on startup, so I'm thinking I may want to edit "whatever" brings this up.
Suggestions? :pissed:
Title: Re: Vanilla load
Post by: David Hall on May 23, 2006, 05:38:19 PM
well, that is an interesting question b/c there are a number of things you could edit to load dvb files.  What are you familiar with editing?  You could create a LISP file that loads DVB files, or put them in your Startup Suite (I wouldn't, but you could). 
Title: Re: Vanilla load
Post by: Bob Wahr on May 23, 2006, 05:58:06 PM
(I wouldn't, but you could).
I disagree with Mr. Duh on that one.  If you want them loaded at startup, especially if they're going to be running in the background, I see no reason at all not to put them in the startup suite.  You can also use an ACAD.DVB as an automatically loaded loader.
Title: Re: Vanilla load
Post by: David Hall on May 23, 2006, 06:07:25 PM
I dont use the suite b/c sometimes it freaks out and doesn't load things.  I do use it for some things, but I use the MNL file to load our routines.  I also have a loader function in LISP that checks for the function and loads the dvb if necessary when you call the routine
Title: Re: Vanilla load
Post by: Kerry on May 23, 2006, 06:13:55 PM
....  but I use the MNL file to load our routines. I also have a loader function in LISP that checks for the function and loads the dvb if necessary when you call the routine

yep ... that way the Partial menu controls what is loaded via the MNL .. works for me.
Title: Re: Vanilla load
Post by: Bob Wahr on May 23, 2006, 06:16:15 PM
Agree that there's no reason to load them until needed and the loader lisp is great for that, I have two VBA programs that run in the background constantly.  I've never had a problem with the startup suite freaking or at least have never noticed it.
Title: Re: Vanilla load
Post by: David Hall on May 23, 2006, 06:20:51 PM
me either, but I have seen complaints in threads here. (I cant think of where I saw it, just making note of it)
Title: Re: Vanilla load
Post by: Jürg Menzi on May 24, 2006, 02:39:39 AM
There is normally no need to preload a VBA module...

In a menu macro type:
-VBARUN;MyApp.dvb!MacroFunctions.MyFunction
The MyApp.dvb file is loaded and the macro is executed. The MyApp.dvb file remains loaded once the macro has been completed.
The dvb module must be in a path of the AutoCAD environment, else you've to specify the full path in the call.
Title: Re: Vanilla load
Post by: Glenn R on May 24, 2006, 06:32:12 AM
It all depends on WHEN you want the startup code to be run.

Adding it into the startup suite/mnl etc. is almost in the last stages of the Acad load process and you will also take the hit of the acadvba/acvba.arx loading at that time.

The absolute best way is to toss an "acad.rx" file into your search path and in that put a line "acadvba.arx" or "acvba.arx" - depends on the version of acad you're running.
This makes sure the VBA interpreter arx is loaded with all the other startup arx files.

You then put an "Acad.dvb" file in the search path - this is vba's equivalent of acad.lsp...it will autoload. If you then want something to execute at startup from Acad.dvb, put a public sub called AcadStartup into a public module and any code in that will be executed when acad starts.

This method will make sure you stuff runs BEFORE any associated lisp/startup suite stuff...all depends on what you want (read - this is the way I ALWAYS do it).

Cheers,
Glenn.
Title: Re: Vanilla load
Post by: David Hall on May 24, 2006, 12:21:34 PM
Thats what I do  ^    .  And it works really well
Title: Re: Vanilla load
Post by: Matersammichman on June 15, 2006, 12:35:37 PM
"Why" I want to do this...
I have to take a dvb file and place it on every computer in the workplace.
Our CAD systems are pathed to one global folder for "common" files.
If I can hardcode something that loads from a globally accessed common file on every computer, it will prevent me from having to go to every workstation and add the dvb file into the Startup Suite.
Comments? :lol:
Title: Re: Vanilla load
Post by: David Hall on June 15, 2006, 12:46:45 PM
I would make it acad.dvb, put it in that folder, and it will load from every machine
Title: Re: Vanilla load
Post by: Bob Wahr on June 15, 2006, 12:49:31 PM
One word of caution on shared DVBs.  A DVB, unlike a LSP, when loaded is locked.  Everyone can use it at the same time but it cannot be modified, replaced, etc. until it is closed on all machines.  Depending on how many seats you have it could be a hassle.
Title: Re: Vanilla load
Post by: David Hall on June 15, 2006, 03:48:59 PM
I agree 100% with Bob, as I deal with this all the time.  I keep a separate set of dvb files for editing, and have an update routine that copies them to the server at night when noone is using the network versions
Title: Re: Vanilla load
Post by: Bryco on June 16, 2006, 12:00:53 AM
I also read you can't run more than 20 cads using the same vba due to a bug. Ouch.
Title: Re: Vanilla load
Post by: havano on June 18, 2006, 06:47:52 PM
Maybe you can overcome that by placing multiple instances of the same macro in the common folder, using different file names. If an error occurs due to more than 20 users, you could trap the error and present the 21st-etc. user the/an other instance.
Title: Re: Vanilla load
Post by: Bob Wahr on June 19, 2006, 11:45:58 AM
My preference is still to copy them locally.
Title: Re: Vanilla load
Post by: Bryco on June 19, 2006, 03:51:08 PM
Is that automated Bob or one at a time.
Title: Re: Vanilla load
Post by: havano on June 20, 2006, 09:57:00 AM
...you could write a small executable that is run on workstation startup, copies ererything it finds in a certain central network folder to a certain local folder (and ruthlessly overwrites if necessairy) so the newest versions of your macro's are always available locally. Not very elegant maybe, but effective.
Title: Re: Vanilla load
Post by: Bob Wahr on June 20, 2006, 10:37:01 AM
Batch file, even more better/easier than an executable.

Bryco, automated is the way to go as a general rule IMO.  That being said, at this time, in this place, I have a small number of people to support and not a very high frequency of changes so I haven't set up an automated system.
Title: Re: Vanilla load
Post by: havano on June 20, 2006, 03:04:37 PM
Who remembers the DOS commands nowadays...?

OK, start a new txt file and paste this code in it, with appropriate source and target drives\directories.
Rename the saved txt file to e.g. COPY-DVB.BAT (indeed a batch file)
Install COPY-DVB.BAT on all Acad workstations, create a shortcut to it and drop this shortcut in their START menu, under PROGRAMS - STARTUP. In the shortcut properties, you can even specify that you want the BAT file to run in a minimized DOS window.

Code: [Select]
@ECHO OFF
REM this means the commands will not be echoed on screen

COPY /Y /B YourSourcePath\*.DVB YourTargetPath

REM that's all...
REM /Y means no confirmation dialogs (silent mode)
REM /B means you want to copy binary (not ASCII) files
REM If you want to copy other types of files, you can
REM repeat COPY likewise, with other file extensions.
REM COPY *.* (all wildcards) doesn't work in silent mode

My DOS knowledge has also become a bit rusty, but I think this should work.
(Of course, you can also put COPY-DVB.BAT in a central network drive\directory and let the local shortcut in START-PROGRAMS-STARTUP point to that.)
Title: Re: Vanilla load
Post by: David Hall on June 20, 2006, 03:16:46 PM
good idea.  I like the KISS principle, yet able to update daily w/o causing problems