Evan MacGregor - MacGregor, Sir Evan (1842–1926), Admiralty official