Distributing and Updating Customization Files Automatically
Distributing and Updating Customization Files Automatically
CP32-2 This session and demonstration will provide working programs to distribute customization of AutoCAD
within a corporate environment. These programs simplify the task of providing standardized
customization and will be explained so that participants can just tweak the programs or write their own
in-house distribution software. The sample software uses a combination of batch files and VBA
programs to accomplish AutoCAD customization. We will also briefly discuss strategies for handling
multiple user profiles on a workstation, a .Net registry update program, secondary install, the
RoboCopy utility, one-time registry updates, and logon scripts.
Expectations
• That you will return to work able to understand, update, and use these techniques to distribute customization files to
networked computers.
• Only Windows NT/2000/XP/2003 addressed
The Basic Plan (One way to use this code where you work)
On a server:
• Create a source directory (“V:\SOFTDIST\ACADuser\R16.2\”) -- This directory will likely have subdirectories
such as "Support". The full version of AU2005.BAT uses two directory trees named "DIST.AUP" and
REPL.AUP". Decide whether you need those two options before you set up the directory tree.
• Fill the source directories with customization files
On every workstation:
• Add a new directory (“C:\ACADuser\R16.2”)
• Customize directories in AU2005.BAT -- the server directory path will certainly need to be corrected. You
may also want to remove the "if" and "echo" commands and anything that is not essential. See file "
\BatchFiles\AU2005bare.BAT" on the CD.
• Update support paths in AutoCAD options (“config”)
• Export new AutoCAD profile (containing custom support paths) -- Use a meaningful name like "auStg.arg".
• Change AutoCAD shortcut icon to use saved profile
• Add AU2005.BAT to the Startup folder -- This will be a shortcut (.lnk) file like "C:\Documents and
Settings\tparks\Start
Menu\Programs\Startup\AU2005.lnk".
2
Distributing and Updating Customization Files Automatically
Miscellaneous Customization Tasks -- What they are and how they work
These samples are on the CD. InstallREG.bat – installs a registry file only once; it is called by AU2005.bat. AutoCAD profiles
can be used to share toolbar layouts and files search paths. The Acad.DVB file provides an example of a VBA program that
runs during AutoCAD startup. The ADT2005PostInstall.bat forces a repeat of AutoCAD's secondary install.
DotNetAutoload.exe creates a registry update file for .Net programs.
3
Distributing and Updating Customization Files Automatically
The sample execution of this batch file is on line 20. Note that the parameters "c:\batch\GoodStuf.reg" and
"GoodStuff.txt" appear in the program as "%1" and "%2". Line 07 contains the main code: “regedit”. The parameter “/s”
indicates a silent execution, “/i” indicates an import, and “%1” is the first parameter to the call. For more information, search for
“regedit” at "http://support.microsoft.com/". Other commands will provide their own help information by adding a "/?" parameter.
(For example, typing "if /?" in a command window shows extensive help information for the "if" command.) Line 06, 08, and 09
show that the report file is also a semaphore -- that is, it signals that this registry update has already been completed.
4
Distributing and Updating Customization Files Automatically
C:
cd "\Program Files\Autodesk Architectural Desktop 2005"
acad.exe /p "C:\ACADuser\R16.1\Support\bgstd.arg"
5
Distributing and Updating Customization Files Automatically
RoboCopy Overview
Five types of files
Type Description RoboCopy action
Lonely exists in source only Normally copied
Extra exists in target only deleted only if using the /MIR parameter
Newer newer in target Normally copied unless using the /XN parameter
Older older in target Normally copied unless using the /XO parameter
Same source same as target Normally ignored
Favorite options:
/S -- copy Subdirectories /IS -- Include "Same" files.
/MIR -- Mirror (delete "Extra" files) /R:n -- number of Retries (default 1 million)
/XN -- Exclude "Newer" files. /L -- List only - make no changes
/XO -- Exclude "Older" files. /NP -- No Progress - don't display % copied.
/XX -- Exclude "Extra" files/directories. /LOG+:file -- append output to log file
/XL -- Exclude "Lonely" files/directories.
6
Distributing and Updating Customization Files Automatically
Line 10: “RoboCopy” is the program that performs the bulk of the software distribution in our plan. This is a free download from
Microsoft (note the internet shortcut on the CD-ROM. If that link fails, try searching microsoft.com for "RoboCopy download" or
"Windows Server 2003 Resource Kit Tools").
Line 09: This RoboCopy uses a different source directory ”DIST.AUP” that will copy only new files or those more-recently
updated. If the user updates a file to be younger than the distributed version, however, it will not be overwritten. The “/XO”
parameter tells RoboCopy to exclude older files; it keeps RoboCopy from overwriting younger files. More details on RoboCopy
parameters are on the preceding page. There is an excellent document that is included in the resource kit, and "RoboCopy /?"
also provides extensive help.
Line 08: This lines creates the target directory if it does not already exist. See help on the "if" command to learn more about
"exist" and "not".
Line 02-07,11: Not all workstations need the distributed software. These lines of code check for signs of an AutoCAD install and
skip to or over the copy commands accordingly. This may not be useful for your situation.
Lines 13,14: Update registry settings to ensure that AutoCAD uses the correct drawing units. (This may not be the best way to
do that now. Note that there may be other tasks that you want to include with your daily batch file. For example, years ago,
before the time of email and browsing, we used the daily batch file to display a message of the day.)
Lines 16,-17: Update registry settings to autoload a DotNET program. The registry file and a way to create it are covered
elsewhere.
Lines 01, 19-21: The echo commands and the redirection of the RoboCopy report to a file is to provide some debugging
information. For example, if the user reboots while the autoupdate is in progress, the final message of the echo commands will
not appear in the log file.
7
Distributing and Updating Customization Files Automatically
8
Distributing and Updating Customization Files Automatically
Next Version -- How to modify this code for AutoCAD 2006, or (How to use this
code where you work)
• Add new version directory (“R16.2” for AutoCAD 2006)
• Add different registry entries and different directory names to ADT2005PostInstall.bat ("16.1" becomes "16.2"; "ACAD-
304:409" becomes "ACAD-404:409"; and "\Autodesk Architectural Desktop 2005" becomes '"\Autodesk Architectural
Desktop 2006".)
• Change directories or add new directories in AU2005.BAT. (See the CD file "\BatchFiles\AU2006.BAT".)