// http://akelpad.sourceforge.net/forum/viewtopic.php?p=3370#3370
// Version: 1.3
// Author: Shengalts Aleksander aka Instructor
//
//
// Description(1033): Delete trailing whitespaces in all documents.
// Description(1049): Удалить пробелы в конце во всех документах.

var hMainWnd=AkelPad.GetMainWnd();
var lpFrameInit;
var lpFrameCur;

//Initial MDI frame
lpFrameInit=AkelPad.SendMessage(hMainWnd, 1288 /*AKD_FRAMEFIND*/, 1 /*FWF_CURRENT*/, 0);
lpFrameCur=lpFrameInit;

for (;;)
{
  AkelPad.Command(4174 /*IDM_EDIT_DELETE_TRAILING_WHITESPACES*/);

  //Next MDI frame
  lpFrameCur=AkelPad.Command(4316 /*IDM_WINDOW_FRAMENEXT*/);
  if (!lpFrameCur || lpFrameCur == lpFrameInit)
    break;
}
