How to close TIDEDialog via code?

How can I close TIDEDialog without user intervention?

Is there any way to simulate IDEDielog1.Close?

Thank you

You can simply send a WM_CLOSE message to the scripter IDE window:

  SendMessage(FindWindow(PChar('TIDEEditorForm'), nil), WM_CLOSE, 0, 0);

Thank you.

I need to close the IDE without the dialog screens asking the user if he wants to save the files that have been changed.

For this, I'm using the code:

for i:=IDEEngine1.Files.Count - 1 downto 0 do
SendMessage(FindWindow(PChar('TIDEEditorForm'), nil), WM_CLOSE, 0, 0);

Is this the best way to do this?

There are several ways. What you've done is not wrong. 

Alternatively you can set TIDEEngine.OnConfirmSaveFile event handler like this:

procedure TForm4.IDEEngine1ConfirmSaveFile(Sender: TObject;
  IDEFileType: TIDEFileType; AFileName: string; AFile: TIDEProjectFile;
  var Action: TIDEConfirmSaveType; var Handled: Boolean);
  Action := cstDontSave;

Or you can set a property in TIDEDialog:

IDEDialog1.IDECloseAction := icaNothing;

Thank you, but there are some problems with your suggestions:

In the first suggestion, I must be include a "Handled:=True;" for it to work.

In the second suggestion, sometimes I need to keep the messages in the Save dialog box and if I change the "IDECloseAction" property at run time the messages are still displayed.

Apparently the IDECloseAction property cannot be changed after the IDE is displayed.
Yes, all are statements are correct.