Page 2 of 2

Re: Backup and Restore Family Historian error messages

Posted: 11 Apr 2021 16:49
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)

Re: Backup and Restore Family Historian error messages

Posted: 11 Apr 2021 17:13
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?

Re: Backup and Restore Family Historian error messages

Posted: 11 Apr 2021 17:18
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

Re: Backup and Restore Family Historian error messages

Posted: 11 Apr 2021 19:06
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.

Re: Backup and Restore Family Historian error messages

Posted: 12 Apr 2021 06:06
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

Re: Backup and Restore Family Historian error messages

Posted: 12 Apr 2021 15:14
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.

Re: Backup and Restore Family Historian error messages

Posted: 12 Apr 2021 16:15
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

Re: Backup and Restore Family Historian error messages

Posted: 12 Apr 2021 19:47
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