* Backup and Restore FH Settings via Windows - new plugin

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
User avatar
Mark1834
Megastar
Posts: 2458
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Backup and Restore FH Settings via Windows - new plugin

Post by Mark1834 »

Default folders may need a little more refinement now that the focus is ease of use in FH rather than just script generation.

Perhaps the most complete solution would be a decision tree - leave any existing values as they are - use backup file values if valid on host PC - finally, prompt user for new defaults prior to initiating the restore. It can all be done fairly easily by editing the .reg file rather than writing directly to the Registry.

I played with using %ERRORLEVEL% to monitor script status, but it gets complicated fairly quickly, as traditional.bat files apparently behave differently to more modern shell scripts (*.cmd). It’s a low priority, as FH checks that the backup location exists and is write enabled, and after that there isn’t much to go wrong, as it is simply extracting two Registry keys and copying two folders, all of which must exist. Pausing the backup to read the output is probably sufficient for the moment.
Mark Draper
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Backup and Restore FH Settings via Windows - new plugin

Post by tatewise »

IMO you will find trying to auto-restore those two default file paths full of pitfalls.
  1. In all likelihood, the paths in the backup from an old PC will be different to the paths on a new PC due to a different username in C:\Users\<username>\... So they will never exist unless the plugin ignores the username.
  2. Even if the usernames are the same (or ignored) it is common for there to be multiple Family Historian Projects folders; one being the installation folder in My Documents; another on another drive or in OneDrive. Users often seem to forget to remove the installation folder or it may get reinstated when FH is reinstalled. So just because a path exists is not a good justification for using it.
  3. Prompting users to choose the paths is fraught with risks as they often don't recall their settings.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
David2416
Superstar
Posts: 398
Joined: 12 Nov 2017 16:37
Family Historian: V7
Location: Suffolk UK

Re: Backup and Restore FH Settings via Windows - new plugin

Post by David2416 »

Sorry I didn't mean to raise another round of debate! So just advice in the help file to remind users my be all that is needed.

(It was an easy matter to set the default folders to where I wanted. Once I had set the defaults to my shared One Drive folders all my projects and backups were immediately visible. FH7 then ran on the second machine with all the customisations I had made on the first. The important thing to remember is to ensure FH7 is closed and One Drive finished updating before opening up on the second.)
It was interesting to see MS Robocopy running copying some icon files over.
User avatar
Mark1834
Megastar
Posts: 2458
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Backup and Restore FH Settings via Windows - new plugin

Post by Mark1834 »

No problem, David ;). It’s another issue that went through various iterations during development (including use of %USERPROFILE% to make it agnostic to user name). It’s a relatively trivial point, but I’ll sort something before it goes live in the store.
Mark Draper
User avatar
cwhermann
Famous
Posts: 155
Joined: 20 Mar 2021 22:04
Family Historian: V7
Location: New Hampshire, US

Re: Backup and Restore FH Settings via Windows - new plugin

Post by cwhermann »

Trying to learn as much as I can about various plugins as I start my FH master file. What is the advantage of using this plugin vs the backup prompt when you close FH? Or should I be using both?
Curtis Hermann
FH 7.0.15
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Backup and Restore FH Settings via Windows - new plugin

Post by tatewise »

Curtis, this is not the best thread to discuss that in detail. To answer your question you must use both backups.
See the FHUG Knowledge Base Backup and Recovery advice for details.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
rt
Platinum
Posts: 36
Joined: 07 Aug 2003 10:55
Family Historian: V7
Location: Weybridge
Contact:

Re: Backup and Restore FH Settings via Windows - new plugin

Post by rt »

Mark,

I'm about to migrate to new hardware and in the process move from W10 to W11. Questions:
- when will your plugin be released (or is there anywhere it can be downloded now)?
- is it designed to cater for the migration I've described?

To date (i.e. earlier today) I used the alternative from the plugin store to produce a backup (a dry run) but found it a little awkward. Trying to read the orange text proved somewhat of a challenge (especially when the plugin window is quite small). I could select a new folder for the backup but somehow failed to be able to name it (possibly user error from creeping frustration of the orange text), and the final message if "xxxx files backed up for one appication" had me wondering why the specific wording...
Comments offered with the intention that new releases / plugins can have suitable options / improvements.
User avatar
Mark1834
Megastar
Posts: 2458
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Backup and Restore FH Settings via Windows - new plugin

Post by Mark1834 »

You can use the draft version now. It is fully functional, although the store version (to follow probably early next week) will have one or two more bells and whistles. It's here to save you scrolling back and looking for it.

No bright colours, and it fully supports FH7 custom fonts and zoom if you have changed your defaults.
Mark Draper
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Backup and Restore FH Settings via Windows - new plugin

Post by tatewise »

@rt: I am the author of the longstanding Plugin Store version. I'm struggling to understand where you see orange text.
The plugin dialogue is predominantly green as shown here: https://pluginstore.family-historian.co ... n-settings
Perhaps you could post a screenshot using the advice in Forum Usage Tips for Attachments and Taking Screenshots.

The final message caters for the (rare) possibility that more than one version of FH can be installed simultaneously.
e.g. Family Historian V7.0, a Beta test version for a new release, or Family Historian Demo V3.0.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Mark1834
Megastar
Posts: 2458
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Backup and Restore FH Settings via Windows - new plugin

Post by Mark1834 »

The new plugin has now been published in the Plugin Store.

The released version incorporates a number of detailed changes as a result of comments here, so thanks for the feedback as it has developed.
  • Now fully supports 32-bit Windows versions. They are largely obsolete now, but migrating from old 32-bit to new 64-bit PC is a possible use scenario.
  • Checks whether it is running in an emulator, and closes if it detects one. Emulator compatibility is planned for a future update (probably fairly soon, as I know in principle what relatively minor changes need making, but it will need extensive testing).
  • Restores backups created using Mike's original plugin.
  • More and clearer user feedback, both before and after backup or restore operations.
  • Various minor code optimisations to make it easier for other plugin authors to follow the logic of what it is doing.
Mark Draper
avatar
rt
Platinum
Posts: 36
Joined: 07 Aug 2003 10:55
Family Historian: V7
Location: Weybridge
Contact:

Re: Backup and Restore FH Settings via Windows - new plugin

Post by rt »

@Mark,

I have now used your plugin (from the store) and found it is straightforward and works well. Thanks for making it available.

One question if I may: If I wanted to take several backups in a day, would the directory have a time stamp as well as a date? I can imagine that if I was developing a complex query I might want to checkpoint.
User avatar
Mark1834
Megastar
Posts: 2458
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Backup and Restore FH Settings via Windows - new plugin

Post by Mark1834 »

No, by default it only includes the date, not the time. However, a user familiar with Windows script files could make a simple modification to the templates produced in Advanced mode to add time in whatever format they preferred. Advanced mode is designed to be highly configurable without having to wade through thousands of lines of plugin code.

A better option for this scenario is to export the individual query from time to time (File > Import/Export > Export > Query...). Give each saved version a distinct file name, and reverse the process (File > Import/Export > Import > Query...) to load it back into FH if you want to recover an earlier version.
Mark Draper
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Backup and Restore FH Settings via Windows - new plugin

Post by tatewise »

I have some comments/questions regarding the Plugin Store version.
  1. When a Backup is made to a previously used backup folder the plugin provides the date of the previous backup.
    However, after the backup completes the fhProgramData and fhAppData folders still have the original date, so they don't reflect when the latest backup was created. The same goes for the two .bat files.
  2. My ProgramData set of files is quite considerable and the batch script takes a significant amount of time to complete.
    Can its display be reduced to just a synopsis?
  3. The plugin fhRestore.bat ratifies the FH version of backups from the original plugin against the installed FH version.
    Does it do the same for its own backups? i.e. If the fhBackup.bat is run against FH V7 and the backups are copied to another PC running FH V6 and fhRestore.bat is run, what happens? They should be rejected.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Mark1834
Megastar
Posts: 2458
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Backup and Restore FH Settings via Windows - new plugin

Post by Mark1834 »

When a Backup is made to a previously used backup folder the plugin provides the date of the previous backup.
However, after the backup completes the fhProgramData and fhAppData folders still have the original date, so they don't reflect when the latest backup was created.
When a backup runs, it always creates new Registry files, but only updates the fhProgramData and fhAppData folders with changes. The backup timestamp is therefore taken from a Registry file, and the dates of the folders are irrelevant (but their contents will always be up to date).
The same goes for the two .bat files.
The store version does not save .bat files unless it is in advanced mode. They are created on the fly and deleted after use, as explained in the help file. If you have .bat files, they may be left over from a FHUG prototype. Remember that the .bat file is basically just the template for how the backup and restore are configured, so when they were created is irrelevant.
My ProgramData set of files is quite considerable and the batch script takes a significant amount of time to complete.
Can its display be reduced to just a synopsis?
I experimented with that, and I think showing the details is the preferred option. I agree that for a very large folder, the bottleneck is probably the time taken for the window to update rather than the actual backup time. Remember though that FH remains useable all the time the backup is running, as it is in a separate process. How long is "considerable", and how long does it take in the established plugin? How long do subsequent backups to the same folder (which only copy changes) take?
The plugin fhRestore.bat ratifies the FH version of backups from the original plugin against the installed FH version.
Does it do the same for its own backups? i.e. If the fhBackup.bat is run against FH V7 and the backups are copied to another PC running FH V6 and fhRestore.bat is run, what happens? They should be rejected.
As indeed they are. The established plugin writes the version data to a separate file, but the Windows version manages version control without needing this additional file. When the plugin starts, it reads the FH version, and immediately writes that back to the .ini file. Therefore, whenever it makes a backup, the version it was produced from is recorded in the relevant file in Plugin Data, so automatically stays with the backup when it is moved or copied. When the user runs a restore, the plugin reads this value, compares it with the current FH version, and alerts the user if there is a problem. As examples, FH6 into FH7 or vice versa is always rejected. Minor version revisions may be rejected or simply warned against, depending on what the difference is.

An important feature, which is also made clear in the help, is that if the user is using Advanced mode to simply generate template scripts, the responsibility for version control etc rests with them. I deliberately do not build lots of checking code into the templates, that is all done with Lua in the core standard mode.
Mark Draper
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Backup and Restore FH Settings via Windows - new plugin

Post by tatewise »

Thank you for those answers. I should have read the Help more closely. All the explanations are perfectly acceptable.

Regarding restoring backups for differing FH Versions, any Version backup should be allowed into any later FH Version.
e.g. A backup from FH V6.2 can be restored into FH V7.0 after the user is suitably warned.
The explanation is that after the restore, the situation is similar to a user upgrading from FH V6.2 to FH V7.0.
i.e. Customisation data is in FH V6.2 format and FH V7.0 should cope with adjusting it to V7.0 format.
There is some risk but it is probably acceptable if no other backups are available.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Mark1834
Megastar
Posts: 2458
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Backup and Restore FH Settings via Windows - new plugin

Post by Mark1834 »

I’m slightly stricter. Never into an earlier version or revision, but later revisions permitted with warning (e.g. 7.0.x into 7.1 in the future, or 7.0.9 into 7.0.10). They have to be permitted, as CP do not make downgrades available - it’s only ever the latest revision of each major version.

I’d rather block 6.x into 7.x by default, and deal with it by exception on FHUG (e.g. just copy the files and restore the keys manually).
Mark Draper
avatar
LeslieP
Diamond
Posts: 78
Joined: 03 Jan 2021 16:38
Family Historian: V7

Re: Backup and Restore FH Settings via Windows - new plugin

Post by LeslieP »

In my brief test of this plugin I think I identified a small problem.

Desktop computer, 2 monitors, FH runs on 2nd monitor. Create a backup.
Laptop computer, restore that newly created backup. FH loads to "2nd monitor" which doesn't exist, so there's no way to get to the program. It's open, according to the task bar, but I can't get to it. Can only close the program down.

I've decided for now that I won't be attempting to run FH from my laptop, so have uninstalled everything and removed both of the settings backup plugins from my desktop, so won't be able to help in any troubleshooting or fixes, but I did want to report the issue, in case it's something fixable.

I'm 100% willing to accept that it's something odd in my setup, if y'all can't replicate this. Just wanted to put it out there for something to double check.

Desktop is running Win10, laptop is on Win11
Leslie P
Houston, TX
from TMG to RootsMagic to FH7
publish to web via TNG
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Backup and Restore FH Settings via Windows - new plugin

Post by tatewise »

Leslie, there is a standard Windows procedure to move an application from screen to screen.
See Move an Application Window From Off-screen Back to Your Main Desktop.
i.e.
  1. Right-click on the Windows taskbar and select Cascade windows from the pop-up menu.
    ( This is necessary in case the window to move is maximised, in which case it cannot be moved. )
  2. Hold down the Shift key, then right-click on the appropriate application icon in the Windows taskbar.
  3. On the resulting pop-up, select the Move option.
  4. Begin pressing the arrow keys on your keyboard to move the invisible window from off-screen to on-screen. Typically, you will use the left arrow to move the window from right to left.
Both this new plugin and my established plugin will invoke the same 'issue' because the restored Windows Registry customisations use the same screen coordinates as the backup PC.
In the reverse direction, the opposite will happen and FH will get repositioned onto the main monitor screen.
It may be possible to detect such scenarios, or give the option to skip those screen coordinates.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Post Reply