How to close the search panel by using code

I can open the search panel by using code: hescript://Macros.MacroSearch

  1. Does anyone know how to close the search panel by using code?
  2. Or how to add the “close” button inside of the search panel?

I add one new procedure:

procedure MacroCloseSearch;
begin
ShowLeftPanel(1, false);
end;

then I can use it to close the search panel.