![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
|
|
The automation of updates with Troi File Plug-inNOTE This page was created in 2004 and uses FileMaker Pro 6 and Troi File 2.8. The information below is still valid for FileMaker 6. Vince Lackner (The Lackner Group, Inc., Pittsburgh, USA) developed a routine with FileMaker and Troi File Plug-in to automate the update of solutions: "At the recent suggestion of Dana Perry, I took a look at the Troi File Plug-in in the context of testing for the existence of the Adobe Acrobat Reader program (before launching PDF files from FileMaker). My study of the plug-in confirmed for me the great power of this tool for a variety of other tasks, including the automation of upgrades. I developed a routine with FileMaker and the Troi File Plug-in that I thought might interest other users. Its purpose is to determine what subfolders already exist with a name formatted as "!BakXYZ" where "XYZ" is a number from "001" through "999". This routine is described below (after my outline of the general update procedure). General update procedureThe general idea is the following: 1) Existing FileMaker Pro files have an extension of "USR". 2) A new version of the program installs new FileMaker Pro files with an extension of "_SR". 3) This same new version of the program also installs a simple text file called "Update1.txt". 4) When a user launches the Opener.USR file after installing the new files, FileMaker (with the Troi File Plug-in) looks for the existence of Update1.txt. 5) If it finds this file, it launches the conversion script that does the following: a) Deletes all of the *.OLD files that might still be there from the last conversion. At this time, I could delete the *.OLD files, but have decided to keep them there just in case there is a problem with Step (c) above (copying all of the *.USR files to !Bak006). Of course, I plan to trap for such a problem and halt the conversion routine right there, but keeping the *.OLD files in the main folder until the next conversion should do no harm. Creation of backup subfoldersI use a PatternCount function to test for the existence of ANY subfolder that starts with "!Bak". If none exists, then I use Troi to create a subfolder called "!Bak001". If at least one exists, then I needed to figure out the highest number of all those that do exist. I do this by testing for subfolders that start with "!Bak9", and decrement the "9" until I find an existing subfolder that starts with "!BakX". I then test for subfolders that start with "!BakX9", and decrement the "9" until I find an existing subfolder that starts with "!BakXY". Finally, I test for subfolders that start with "!BakXY9", and decrement the "9" until I find an existing subfolder whose name is "!BakXYZ" (i.e., "!Bak005"). I now know that this is the highest existing subfolder name. I increment my global to "!Bak006" and use Troi to create a new subfolder with that name. This procedure is extremely fast, because it is analyzing a list of subfolders that is read into an FMP field one time at the very beginning of the procedure. Here are the two scripts: 1) Test for Highest !Bak Number (the zv_folderList is populated in Script #2 below, which calls this script) If [PatternCount
(zv_folderList,"!Bak" = 0 ] Else Loop End Loop Loop Loop Set Field[zv_highestExistingFolderNum, TextToNum(zv_counterHundreds & zv_counterTens & zv_counterOnes] End If 2) Create !BakXYZ Directory Perform Script ["List Folders"] If [PatternCount(zv_folderList,
"!Bak001") = 0] Else End If Set Field [zv_highestExistingFolderNum, zv_highestExistingFolderNum + 1] Perform Script ["List
Folders"] There have been other ideas on the topic of installing updates to FMP data files. I welcome all suggestions for improvements to the above procedure. Click here if you want to download a zipped copy of the small Opener.USR file that contains the fields and scripts necessary to support this operation. Best, Vince LacknerThe Lackner Group, Inc. Pittsburgh, PA USA Email: vince@lacknergroup.com Web page: www.lacknergroup.com " |
|
|