Page 3 of 3
Re: Restoring Settings to New OS Build
Posted: 31 Mar 2022 12:32
by tatewise
I've looked at that and it sounds promising but there are almost no example scripts and so I have no idea what Lua commands would be needed to implement that DATE conversion feature.
What luacom.CreateObject("...") statement is required? What are the conversion methods/functions available?
Re: Restoring Settings to New OS Build
Posted: 31 Mar 2022 12:56
by ColeValleyGirl
Once you've required luacom, it becomes a table. So use
and
The table option returns something like:
Code: Select all
modified => (table .8)
Hour => 16
Second => 10
DayOfWeek => 0
Month => 12
Minute => 59
Milliseconds => 0
Year => 2021
Day => 12
Re: Restoring Settings to New OS Build
Posted: 31 Mar 2022 14:49
by tatewise
Ah! The penny has dropped
This is the default that I was struggling with:
Code: Select all
luacom.DateFormat = "string" -- this is the default
fileObj = fhFileUtils.fso:GetFile(strFilePath)
strMod = fileObj.DateLastModified -- returns such as "30/3/2022 10:22:14 PM" depending on locale
This converts to a fixed format table regardless of the locale settings:
Code: Select all
luacom.DateFormat = "table"
fileObj = fhFileUtils.fso:GetFile(strFilePath)
dicMod = fileObj.DateLastModified -- returns standard format table
intTime = os.time({ year=dicMod.Year; month=dicMod.Month; day=dicMod.Day; hour=dicMod.Hour; min=dicMod.Minute; sec=dicMod.Second; })
Then
intTime is the UNIX epoch seconds since 01/01/1970
Thank you Helen.
Re: Restoring Settings to New OS Build
Posted: 31 Mar 2022 15:37
by tatewise
The attached Backup and Restore Family Historian Settings plugin Version 3.3.3 Date 31 Mar 22 uses that new technique that should cope with all local date-time formats without altering the Windows Registry.
It has the side benefit of showing date-times in messages using the current user's local format settings.
Re: Restoring Settings to New OS Build
Posted: 31 Mar 2022 15:40
by NickWalker
I like it when a plan comes together. You and Helen make a great team

Re: Restoring Settings to New OS Build
Posted: 31 Mar 2022 16:19
by ColeValleyGirl
Thanks, Nick.
Re: Restoring Settings to New OS Build
Posted: 31 Mar 2022 16:24
by ColinMc
I've run a Backup with the old & new version, and it seems to be identical apart from system files, and apart from the map cache, it also matches the Windows version

- Backup&Restore.jpg (197.01 KiB) Viewed 899 times
Re: Restoring Settings to New OS Build
Posted: 01 Apr 2022 10:29
by tatewise
Backup and Restore Family Historian Settings plugin Version 3.4 Date 31 Mar 22 is now in the Plugin Store
I think there needs to be a KB
Snippet for the code that solved this problem with related code that provides substitute values for the
LuaFileSystem Attributes such as mode, access, modification, change, size, etc. I'll add it to my list
