solved: Save Settings

Post Reply
Ralf
Posts: 36
Joined: 19 Jan 19 14:37

solved: Save Settings

Post by Ralf » 25 Sep 19 14:50

Hi,

Is there actually a function with which I can copy / save / open all settings to use them in a new database without having to do the settings manually each time?

I mean, for example, color settings of folders, categories, general settings, etc.

greeting
  Ralf
Last edited by Ralf on 25 Sep 19 22:30, edited 1 time in total.
Ralf
---------------------------------------------------------------------------------
Hobby photographer with many pictures (> 100000) of the family over generations.
(Excuse my english)

Hert
Posts: 5880
Joined: 13 Sep 03 7:24

Re: Save Settings

Post by Hert » 25 Sep 19 19:00

As it happens I needed this just a few days ago and wrote a small script for it;

Script to export preferences to file (find the file on the desktop):

Code: Select all

  procedure ExportToFile(AFileName: WideString);
  var
    AData: THTMLResource;
  begin
    AData := THTMLResource.Create(nil);
    if PublicCatalog.EnumGUIDData(AdminGUID, 'OPTIONS', AData) then
    begin
      AData.ResourceStream.SaveToFile(AFileName);
      Say('Saved as: ' + AFileName);
    end
    else
      Say('No Options Found');
    AData.Free;
  end;

var
  AFileName: WideString;
begin
  AFileName := WindowsDesktopDir + 'options.psu';
  ExportToFile(AFileName);
end;
Script to import the preferences from file (file must exist on the desktop):

Code: Select all

  procedure ImportFromFile(AFileName: WideString);
  var
    AData: THTMLResource;
  begin
    AData := THTMLResource.Create(nil);
    if WideFileExists(AFileName) then
    begin
      AData.ResourceStream.LoadFromFile(AFileName);
      PublicCatalog.StoreGUIDData(AdminGUID, 'OPTIONS', AData);
      AData.ResourceStream.Position := 0;
      PublicOptions.LoadFromStream(AData.ResourceStream);
      Say('Options are read from file. Please restart.');
    end
    else
      Say('File ' + AFilename + ' Not Found');
    AData.Free;
  end;

var
  AFileName: WideString;
begin
  AFileName := WindowsDesktopDir + 'options.psu';
  ImportFromFile(AFileName);
end;
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

Ralf
Posts: 36
Joined: 19 Jan 19 14:37

Re: Save Settings

Post by Ralf » 25 Sep 19 22:30

Super and thank you works fine.
Exactly what I was looking for
Ralf
---------------------------------------------------------------------------------
Hobby photographer with many pictures (> 100000) of the family over generations.
(Excuse my english)

User avatar
G8DHE
Posts: 150
Joined: 21 Aug 17 13:58

Re: solved: Save Settings

Post by G8DHE » 26 Sep 19 15:51

Will these scripts end up in the Resource Repository ? https://repository.idimager.com/
Or should I download now ;-)
Geoff Mather (G8DHE)

Ralf
Posts: 36
Joined: 19 Jan 19 14:37

Re: solved: Save Settings

Post by Ralf » 26 Sep 19 16:19

I always load it down if something is changed in the reposuitory or I'm not online. I usually drive better, but I do not always get a change;)
Ralf
---------------------------------------------------------------------------------
Hobby photographer with many pictures (> 100000) of the family over generations.
(Excuse my english)

Post Reply