Home Page list
Check RootsMagic Database Integrity on Opening #pragma #database #integrity #batch
Here are some tricks using a shortcut and a Windows command file (.bat file for old DOS programmers) in conjunction with the command line version of SQLite3. The shortcut, which you can place in your Start menu, on your desktop or wherever it is convenient, calls the batch file and passes the path and name of the RootsMagic database file you want to work on. The batch file calls SQLite3 to open the database file and run the quick integrity check on it. The results are displayed in the command window, SQLite exits and closes the file, and the batch program awaits a keypress so that the user can view the results. On keypress, the batch program calls RootsMagic to start and open the database file.
The batch or cmd file can be placed anywhere that you think is appropriate as you will point the shortcut to it. You will need to edit the batch file to change the path to sqlite3.exe to wherever you install it.
Download the command line version of sqlite3 from here
- look for the ZIP file below the heading Precompiled Binaries For Windows
, about 2/3 of the way down the page, beside the line A command-line program for accessing and modifying SQLite databases
. As of writing, the version is 3.6.23. Extract the file sqlite3.exe
to the folder of your choice and copy its path to replace that in the batch file Any family tree.bat
listed under its download link below (.bak extension added due some systems' security).
REM Any family tree.bat
REM by Tom Holden 2010-05-28
REM Calls sqlite3 to open the RootsMagc database file path and name passed as a parameter
REM and do the quick integrity check on it.
REM Waits for user to view result until a key is pressed.
REM Then launches RootsMagic to open the database.
ECHO CHECKING INTEGRITY of RootsMagic SQLite database
"D:\Program Files\SQLite\sqlite-3_6_22\sqlite3.exe" %1 "PRAGMA quick_check;"
ECHO When ready to open this file in RootsMagic,
"C:\Program Files\RootsMagic 4\RootsMagic.exe" %1
The shortcut, in this example named Some family tree
as seen on the title of the cmd window , has the following properties:
- Target = "D:\MyDocs\FamilyTree\Holden-Cudworth_Wilson-Wason\Any family tree.bat" "D:\MyDocs\FamilyTree\RM4\Emil\EmptyDatabase.rmgc"
- Start in = leave empty
- Shortcut key = None (or change it to what you want)
- Run = Normal window
You will have to set the Target to point to the full paths to "Any family tree.bat" and to your database file. The use of quotation marks is essential if there is a space character in the pathname.
To create a shortcut to the batch file, right-click on it in Windows Explorer and select the corresponding menu item. Then right-click on the shortcut file just created to edit its properties. Then drag and drop it to wherever you want. You can make shortcuts for multiple databases, one per database, the only difference being the pathname for each database file and a unique name for each shortcut if they are altogether in one folder.
In my case, I have named a shortcut to my main database My family tree
and placed it in the Windows Start Menu:
One of the neat byproducts of starting RootsMagic this way is that one can use relative paths in its Tools > Program Options > Folders settings:
Provided the folders exist as sub-folders of the one containing the opened database, RM4 will use them. If they do not exist it will default to My Documents folder. Of course, you may want to have some of these folders the same, regardless of where the database file is located; you would enter the conventional, full, absolute path for each of those.
Check RootsMagic Database Integrity
Why? How? (if you didn't get here from there, it's worth a reading)