Distribution: Difference between revisions

From ZDN User Guide
(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...")
 
Line 1: Line 1:
This guide assumes that at least one person has ZDN up and running on their computer successfully, and now additional users will be added.
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: ==
== The manual way ==
This process is fine for a few users.  When there are updates to ZDN, you will just repeat this process.
This process is fine for a few users.  When there are updates to ZDN, you will just repeat this process.


Line 11: Line 11:
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
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. ==
== 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.
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. This batch file is included in your original ZDN download (v2.1 and later). You do not need to copy from here.  It is included here to highlight the three spots where you need to edit the code to match your local install.


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


This may look scary, but each section does something and you can easily modify this to your institution's needs.
# Inside your ZDN folder (v2.1 and later), there is a hidden folder called "Advanced" containing a .zip file. Unzip this file
# Right-click on the ZDN.bat file (do not open it), and select "Edit"
# Compare the code below to the code in the file. Find the three bolded sections below and change those to your local paths.
# Save and close your file.
# Right-click on the Zoo Diet NaviGator shortcut (do not open it), and select "Properties"
# Change the "Target" to wherever you just saved the .bat file.
# Change the "Start in" to the same location, just without the filename at the end.
# Both values should be in quotes. Neither should end with a \.
# Double-click the shortcut to make sure everything is working correctly.  If so:
## NaviGator should open
## A new folder should appear on your hard drive at C:\Data
## Inside C:\Data there will be a hidden folder called "Nutrition_Database"
## Inside that folder should be two items: A folder called "BackendBackups", which is where your backups will live.  Every time ANYONE opens NaviGator using the shortcut, a backup copy of the data will be copied to their local C: drive. You must decide whether this is acceptable data security for you or not. It is helpful for backups, but obviously there will be many copies of your data floating around (hidden, but there). If you do not want this behavior, remove those lines of the code below.
## There will also be a local (C: drive) copy of the NaviGator front end that will always be the most recent version. So, every time you (the admin!) update NaviGator in its original location, everyone will get those changes the next time they run the script as a new copy will get downloaded each time.
# Copy the shortcut to somewhere public and easily find-able by your users(shared drive, SharePoint, etc.).
# Tell everyone where to find NaviGator.  They can run the shortcut from that location or copy the shortcut to their local drive/desktop. Occasionally, users will move the shortcut instead of copy it and you'll have to replace it with a new copy.  That's why you COPIED the shortcut in step 10 instead of moved it ;)


<nowiki><hr></nowiki>


<code>cls</code>
* Don't worry if you don't understand the code below.  You can follow along by reading the comments. In batch files, any line with REM in front is treated as a comment (i.e. not run).
* You can modify this for your institution's needs and policies by removing (or adding) sections below.


<code>@echo off</code>
== The batch file ==
REM This clears the screen and goes to an error if MS Access is not installed on the computer.


<code>cls</code>
cls


<code>IF NOT EXIST "C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE" GOTO :NoAccess</code>
@echo off


<code>echo         +-+-+-+-+-+-+-+ +-+-+               </code>
cls


<code>echo          W e l c o m e   t o                 </code>
IF NOT EXIST "C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE" GOTO :NoAccess


<code>echo   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+</code>


<code>echo    Z o o   D i e t   N a v i g a t o r</code>
REM This is a cute welcoming graphic


<code>echo   +-+-+-+ +-+-+-+-+ +-+-+-+-+-+-+-+-+-+</code>
echo         +-+-+-+-+-+-+-+ +-+-+               


<code>echo.</code>
echo          W e l c o m e   t o                 


<code>echo              .-._   _ _ _ _ _ _ _ _</code>
echo   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


<code>echo   .-<nowiki>''</nowiki>-.__.-'00  '-' ' ' ' ' ' ' ' '-.</code>
echo    Z o o   D i e t   N a v i g a t o r


<code>echo   '.___ '    .   .--_'-' '-' '-' _'-' '._</code>
echo   +-+-+-+ +-+-+-+-+ +-+-+-+-+-+-+-+-+-+


<code>echo    V: V 'vv-'   '_   '.       .'  _..' '.'.</code>
echo.


<code>echo      '=.____.=_.--'   :_.__.__: '.   : :</code>
echo              .-._   _ _ _ _ _ _ _ _


<code>echo              (((____.-'        '-.  /   : :</code>
echo   .-<nowiki>''</nowiki>-.__.-'00  '-' ' ' ' ' ' ' ' '-.


<code>echo                               (((-'\ .' /</code>
echo   '.___ '    .   .--_'-' '-' '-' _'-' '._


<code>echo                              _____..'  .'</code>
echo    V: V 'vv-'   '_   '.       .'  _..' '.'.


<code>echo                             '-._____.-'</code>
echo      '=.____.=_.--'   :_.__.__:_   '.   : :


<code>echo Putting on my PPE...</code>
echo              (((____.-'        '-.  /   : :


<code>for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"</code>
echo                               (((-'\ .' /


<code>set "YYYY=%dt:~0,4%"</code>
echo                              _____..'  .'


<code>set "MM=%dt:~4,2%"</code>
echo                             '-._____.-'


<code>set "DD=%dt:~6,2%"</code>


<code>set "HH=%dt:~8,2%"</code>
''REM This creates a timestamp that is used later on when naming backup files''


<code>set "Min=%dt:~10,2%"</code>
echo Putting on my PPE...


<code>set "Sec=%dt:~12,2%"</code>
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"


<code>set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"</code>
set "YYYY=%dt:~0,4%"


<code>echo Hauling hay...</code>
set "MM=%dt:~4,2%"


<code>ECHO OPEN %fullstamp% - %USERNAME%>>"J:\Data\ANC Diet Info\ZDN\ZDN Files (ANC Diet Info)\ZDN Support Files\Logs\zdn_userlog.log"</code>
set "DD=%dt:~6,2%"


<code>echo Chopping carrots...</code>
set "HH=%dt:~8,2%"


<code>REM This creates the nested folders on the local hard drive if they don’t already exist</code>
set "Min=%dt:~10,2%"


<code>mkdir "C:\Data\Nutrition_Database\BackendBackups" 2>NUL</code>
set "Sec=%dt:~12,2%"


<code>attrib +h "C:\Data\Nutrition_Database" /s /d  >nul &REM This hides the folder</code>
set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"


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


<code>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.</code>
''REM This logs each time a user opens ZDN. This can be useful if you are trying to understand who is using the software and why.''


<code>echo Fileting fish...</code>
echo Hauling hay...


<code>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</code>
ECHO OPEN %fullstamp% - %USERNAME%>>"'''<big>J:\ZDN\ZDN Support Files</big>\'''Logs\zdn_userlog.log"


<code>if ERRORLEVEL 1 goto :ERROR</code>


<code>cd "C:\Data\Nutrition_Database" >nul</code>
''REM This creates the nested folders on the local hard drive if they don’t already exist''


<code>echo Bundling browse...</code>
echo Chopping carrots...


<code>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</code>
mkdir "C:\Data\Nutrition_Database\BackendBackups" 2>NUL


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


<code>ren Backup-be.accdb %fullstamp%-DisneyZDN-databackup.accdb</code>
del "C:\Data\Nutrition_Database\*.accde"  >nul


<code>echo Slicing strawberries...</code>


<code>REM This keeps the most recent 21 files</code>
''REM This copies both the frontend 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.''


<code>for /F "skip=21 eol=: delims=" %%i in ('dir /b /o-d') do del %%i"</code>
echo Fileting fish...


<code>REM These delete any files in the backup folder that do not match the pattern</code>
xcopy /s "'''<big>J:\ZDN</big>\'''ZDN_v*.accde" C:\Data\Nutrition_Database\ZDN.accde* /H /c /q /y >Nul


<code>echo Ready to feed some animals!</code>
if ERRORLEVEL 1 goto :ERROR


<code>REM These lines navigate to the folder and open the database.  To the user, it just looks like they opened the database.</code>
cd "C:\Data\Nutrition_Database" >nul


<code>start C:\Data\Nutrition_Database\ZDN.accde</code>


<code>TIMEOUT /T 10</code>
''REM This copies the backend data to the local folder as a backup.  You can't use it from here (unless you set a path to a complete ZDN Support Files folder). You will have to copy it to the main 'ZDN Support Files' folder to use it.''


<code>goto :EOF</code>
echo Bundling browse...


<code>:ERROR</code>
copy "'''<big>J:\ZDN\ZDN Support Files\Datafiles\MyZooDatafile.accdb</big>'''"   "C:\Data\Nutrition_Database\BackendBackups\Backup-be.accdb"  /y >nul 2>&1


<code>ECHO "Oops - Can't find NaviGator."</code>
cd /d "C:\Data\Nutrition_Database\BackendBackups\"


<code>ECHO "Please tell Heidi you got a J drive error."</code>
ren Backup-be.accdb %fullstamp%-ZDN-databackup.accdb


<code>pause</code>
REM This keeps the most recent 21 files


<code>:NoAccess</code>
echo Slicing strawberries...


<code>ECHO Oops - No copy of MS Access detected!</code>
for /F "skip=21 eol=: delims=" %%i in ('dir /b /o-d') do del %%i"


<code>ECHO.</code>


<code>ECHO Please tell Heidi that computer '%COMPUTERNAME:~-4%' is missing Access.</code>
''REM These lines navigate to the folder and open the database.  To the user, it just looks like they opened the database.''


<code>ECHO.</code>
echo Ready to feed some animals!


<code>ECHO.</code>
start C:\Data\Nutrition_Database\ZDN.accde


<code>pause</code>
TIMEOUT /T 10


<code>:EOF</code>
goto :EOF
 
<nowiki>:</nowiki>ERROR
 
ECHO "Oops - Can't find NaviGator."
 
pause
 
<nowiki>:</nowiki>NoAccess
 
ECHO Oops - No copy of MS Access detected!
 
ECHO.
 
ECHO Please tell your IT team that computer '%COMPUTERNAME:~-4%' needs Microsoft Access.
 
ECHO.
 
ECHO.
 
pause
 
<nowiki>:</nowiki>EOF
 
</code>

Revision as of 11:43, 17 October 2023

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

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. This batch file is included in your original ZDN download (v2.1 and later). You do not need to copy from here. It is included here to highlight the three spots where you need to edit the code to match your local install.

Instructions:

  1. Inside your ZDN folder (v2.1 and later), there is a hidden folder called "Advanced" containing a .zip file. Unzip this file
  2. Right-click on the ZDN.bat file (do not open it), and select "Edit"
  3. Compare the code below to the code in the file. Find the three bolded sections below and change those to your local paths.
  4. Save and close your file.
  5. Right-click on the Zoo Diet NaviGator shortcut (do not open it), and select "Properties"
  6. Change the "Target" to wherever you just saved the .bat file.
  7. Change the "Start in" to the same location, just without the filename at the end.
  8. Both values should be in quotes. Neither should end with a \.
  9. Double-click the shortcut to make sure everything is working correctly. If so:
    1. NaviGator should open
    2. A new folder should appear on your hard drive at C:\Data
    3. Inside C:\Data there will be a hidden folder called "Nutrition_Database"
    4. Inside that folder should be two items: A folder called "BackendBackups", which is where your backups will live. Every time ANYONE opens NaviGator using the shortcut, a backup copy of the data will be copied to their local C: drive. You must decide whether this is acceptable data security for you or not. It is helpful for backups, but obviously there will be many copies of your data floating around (hidden, but there). If you do not want this behavior, remove those lines of the code below.
    5. There will also be a local (C: drive) copy of the NaviGator front end that will always be the most recent version. So, every time you (the admin!) update NaviGator in its original location, everyone will get those changes the next time they run the script as a new copy will get downloaded each time.
  10. Copy the shortcut to somewhere public and easily find-able by your users(shared drive, SharePoint, etc.).
  11. Tell everyone where to find NaviGator. They can run the shortcut from that location or copy the shortcut to their local drive/desktop. Occasionally, users will move the shortcut instead of copy it and you'll have to replace it with a new copy. That's why you COPIED the shortcut in step 10 instead of moved it ;)

<hr>

  • Don't worry if you don't understand the code below. You can follow along by reading the comments. In batch files, any line with REM in front is treated as a comment (i.e. not run).
  • You can modify this for your institution's needs and policies by removing (or adding) sections below.

The batch file

REM This clears the screen and goes to an error if MS Access is not installed on the computer.

cls

@echo off

cls

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


REM This is a cute welcoming graphic

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                             '-._____.-'


REM This creates a timestamp that is used later on when naming backup files

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%"


REM This logs each time a user opens ZDN. This can be useful if you are trying to understand who is using the software and why.

echo Hauling hay...

ECHO OPEN %fullstamp% - %USERNAME%>>"J:\ZDN\ZDN Support Files\Logs\zdn_userlog.log"


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

echo Chopping carrots...

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 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:\ZDN\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


REM This copies the backend data to the local folder as a backup.  You can't use it from here (unless you set a path to a complete ZDN Support Files folder). You will have to copy it to the main 'ZDN Support Files' folder to use it.

echo Bundling browse...

copy "J:\ZDN\ZDN Support Files\Datafiles\MyZooDatafile.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%-ZDN-databackup.accdb

REM This keeps the most recent 21 files

echo Slicing strawberries...

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


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

echo Ready to feed some animals!

start C:\Data\Nutrition_Database\ZDN.accde

TIMEOUT /T 10

goto :EOF

:ERROR

ECHO "Oops - Can't find NaviGator."

pause

:NoAccess

ECHO Oops - No copy of MS Access detected!

ECHO.

ECHO Please tell your IT team that computer '%COMPUTERNAME:~-4%' needs Microsoft Access.

ECHO.

ECHO.

pause

:EOF