Distribution

From ZDN User Guide
Revision as of 09:09, 17 October 2023 by Heidi@zoodiets.com (talk | contribs) (Created page with "This guide assumes that at least one person has ZDN up and running on their computer successfully, and now additional users will be added. == The manual way is: == This process is fine for a few users. When there are updates to ZDN, you will just repeat this process. * Ensure the ZDN Support Files folder is on a shared drive (See the Installation Guide for details). * Configure the ZDN program to connect to the shared drive * Give each user a copy of the ZDN progr...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This guide assumes that at least one person has ZDN up and running on their computer successfully, and now additional users will be added.

The manual way is:

This process is fine for a few users. When there are updates to ZDN, you will just repeat this process.

  • Ensure the ZDN Support Files folder is on a shared drive (See the Installation Guide for details).
  • Configure the ZDN program to connect to the shared drive
  • Give each user a copy of the ZDN program (program only, not the folder)


If you have more than a few users or make regular updates, you will want to automate the distribution process. This has several benefits, including being able to add additional steps to the script such as making backups along the way

The best way to distribute to multiple users is via a windows batch file.

A batch file is a script that does multiple things. Below is the text of a batch file with notes about what each section does.

In batch files, any line with REM in front is treated as a comment (i.e. not run).

This may look scary, but each section does something and you can easily modify this to your institution's needs.


cls

@echo off

cls

IF NOT EXIST "C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE" GOTO :NoAccess

echo         +-+-+-+-+-+-+-+ +-+-+               

echo          W e l c o m e   t o                 

echo   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

echo    Z o o   D i e t   N a v i g a t o r

echo   +-+-+-+ +-+-+-+-+ +-+-+-+-+-+-+-+-+-+

echo.

echo              .-._   _ _ _ _ _ _ _ _

echo   .-''-.__.-'00  '-' ' ' ' ' ' ' ' '-.

echo   '.___ '    .   .--_'-' '-' '-' _'-' '._

echo    V: V 'vv-'   '_   '.       .'  _..' '.'.

echo      '=.____.=_.--'   :_.__.__:_   '.   : :

echo              (((____.-'        '-.  /   : :

echo                               (((-'\ .' /

echo                              _____..'  .'

echo                             '-._____.-'

echo Putting on my PPE...

for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"

set "YYYY=%dt:~0,4%"

set "MM=%dt:~4,2%"

set "DD=%dt:~6,2%"

set "HH=%dt:~8,2%"

set "Min=%dt:~10,2%"

set "Sec=%dt:~12,2%"

set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"

echo Hauling hay...

ECHO OPEN %fullstamp% - %USERNAME%>>"J:\Data\ANC Diet Info\ZDN\ZDN Files (ANC Diet Info)\ZDN Support Files\Logs\zdn_userlog.log"

echo Chopping carrots...

REM This creates the nested folders on the local hard drive if they don’t already exist

mkdir "C:\Data\Nutrition_Database\BackendBackups" 2>NUL

attrib +h "C:\Data\Nutrition_Database" /s /d  >nul &REM This hides the folder

del "C:\Data\Nutrition_Database\*.accde"  >nul

REM This copies both the frontend and the backend to the local folder.  The backend is just a local archive/backup - you will have to copy it to the main 'ZDN Support Files' folder to use it.

echo Fileting fish...

xcopy /s "J:\Data\ANC Diet Info\ZDN\ZDN Files (ANC Diet Info)\ZDN_v*.accde" C:\Data\Nutrition_Database\ZDN.accde* /H /c /q /y >Nul

if ERRORLEVEL 1 goto :ERROR

cd "C:\Data\Nutrition_Database" >nul

echo Bundling browse...

copy "J:\Data\ANC Diet Info\ZDN\ZDN Files (ANC Diet Info)\ZDN Support Files\Datafiles\Disney3.accdb"   "C:\Data\Nutrition_Database\BackendBackups\Backup-be.accdb"  /y >nul 2>&1

cd /d "C:\Data\Nutrition_Database\BackendBackups\"

ren Backup-be.accdb %fullstamp%-DisneyZDN-databackup.accdb

echo Slicing strawberries...

REM This keeps the most recent 21 files

for /F "skip=21 eol=: delims=" %%i in ('dir /b /o-d') do del %%i"

REM These delete any files in the backup folder that do not match the pattern

echo Ready to feed some animals!

REM These lines navigate to the folder and open the database.  To the user, it just looks like they opened the database.

start C:\Data\Nutrition_Database\ZDN.accde

TIMEOUT /T 10

goto :EOF

:ERROR

ECHO "Oops - Can't find NaviGator."

ECHO "Please tell Heidi you got a J drive error."

pause

:NoAccess

ECHO Oops - No copy of MS Access detected!

ECHO.

ECHO Please tell Heidi that computer '%COMPUTERNAME:~-4%' is missing Access.

ECHO.

ECHO.

pause

:EOF