* Backup and Restore Family Historian error messages

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
ColeValleyGirl
Megastar
Posts: 5465
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: Backup and Restore Family Historian error messages

Post by ColeValleyGirl »

Mike from memory there is nothing v7 specific although I'd have to double check when I'm at my PC. worst case you could copy the some of the code into your plugin or write your own using luacom. I posted a snippet a while back in a thread for Joop and I think you joined in there.

Error when renaming file with accented characters (18987)
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Backup and Restore Family Historian error messages

Post by tatewise »

Mark, I got os.execute() to work but it flashes a command prompt window for every file copied, so not user friendly.
I know how to hide a Script Shell command by using:

Code: Select all

require "luacom"
local luaShell = luacom.CreateObject("WScript.Shell")
local strExe = 'Copy "E:\\Mike\\Sharpe.jpg" "E:\\Mike\\X Y Z.jpg"'
luaShell:Run('cmd.exe /C '..strExe, 0, true)
Helen, I'd forgotten about that which is a rename/move rather than copy but the following does seem to work.

Code: Select all

require "luacom"
fso = luacom.CreateObject("Scripting.FileSystemObject")
result = fso:CopyFile("E:\\Mike\\Sharpe.jpg","E:\\Mike\\X Y Z.jpg")
I'll try it in FH V6 when I get a chance and test it in the BaRFHS plugin.
Would some Code Snippets for FSO examples be a good idea?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
ColeValleyGirl
Megastar
Posts: 5465
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: Backup and Restore Family Historian error messages

Post by ColeValleyGirl »

Re code snippets how many people other than you do you expect to be updating or writing plugins for v6? I would guess very few if any. The library will obviate the need for snippets for new plugins in v7.

The scripting filesystemobject is well documented online if you want to see what else is possible. Or you can wait to get your hands on 7.0.4
User avatar
Mark1834
Megastar
Posts: 2458
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Backup and Restore Family Historian error messages

Post by Mark1834 »

Compile a list of updated files to be copied in a batch file and call os.execute() just once? Sounds like there are other options though.
Mark Draper
User avatar
johnmorrisoniom
Megastar
Posts: 901
Joined: 18 Dec 2008 07:40
Family Historian: V7
Location: Isle of Man

Re: Backup and Restore Family Historian error messages

Post by johnmorrisoniom »

Hi Mike, after re-creating my census icons to be a lot smaller, the plugin now does a backup without any errors.

Regards
John
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Backup and Restore Family Historian error messages

Post by tatewise »

Thank you for the feedback John.

I experimented with the LuaShell:Run('cmd.exe ... ', 0, true) method but it runs 10 times slower than other methods:

Code: Select all

local LuaShell = luacom.CreateObject("WScript.Shell")
LuaShell:Run('cmd.exe /C Copy "'..strSourceFile..'" "'..strTargetFile..'"', 0, true)
The FileSystemObject:CopyFile(...) method runs as fast as the Lua fileTarget:write(fileSource:read("*all")) method:

Code: Select all

local FileSystemObject = luacom.CreateObject("Scripting.FileSystemObject")
FileSystemObject:CopyFile(fhConvertANSItoUTF8(strSourceFile),fhConvertANSItoUTF8(strTargetFile))
However, it originally reported a COM error, which was cured by using fhConvertANSItoUTF8( ).
I have kept the protected mode error reporting message box just in case, but it may need an escape option.
The aggressive garbage memory management has been removed.

Please try the attached Backup and Restore Family Historian Settings plugin Version 3.0.3 Date 12 Apr 2021.

I am especially interested in whether it runs with Crossover, Play on Mac, WINE, etc.
Last edited by tatewise on 09 Sep 2021 18:19, edited 1 time in total.
Reason: Attachment deleted as later version is in the Plugin Store.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Ron Melby
Megastar
Posts: 917
Joined: 15 Nov 2016 15:40
Family Historian: V6.2

Re: Backup and Restore Family Historian error messages

Post by Ron Melby »

just a thought miketate, not always ascii which I believe is default

https://docs.microsoft.com/en-us/window ... mands/copy

wonder if you have to copy /y (and not sure /b) to rid the error?

ron
Last edited by Ron Melby on 12 Apr 2021 20:26, edited 1 time in total.
FH V.6.2.7 Win 10 64 bit
User avatar
mjashby
Megastar
Posts: 719
Joined: 23 Oct 2004 10:45
Family Historian: V7
Location: Yorkshire

Re: Backup and Restore Family Historian error messages

Post by mjashby »

Mike,

Settings Backup & Restore seems to be working fine for me when using Crossover. I cross-checked the functions by running a native Windows installation in tandem before and after checking/installing Plugin updates and encountered no problems.

Will do some further testing with writing Registry Entries (using Restore), but that will take a little longer as I need to 'Export' (Backup) the current Crossover App installation so it can be re-Imported without affecting FH Licensing if I need to revert to my original installation.

If this all goes well, I'm hoping to be able to be able to start testing on a Linux system using a native Wine installation, though I haven't seen any forum questions from Linux Users so far.

Mervyn
Post Reply