/********************************************************************
                         CloseOutputWindows

   Description: Close compiler output windows
   Syntax:      CloseOutputWindows

   To map this script to a shortcut key:

   1. Save this script in the GwdTextEditor\script directory.
   2. From the Macro menu, choose Macro command.
   3. Choose the New button.
   4. In the New Macro Name input box, type a name for the macro. For
      example Script_CloseOutputWindows. In this dialog you can
      also define a shortcut key for macro.
   5. Choose the OK button.
   6. In the Edit Macro dialog box edit box enter the following two
      lines:
         Param1 "CloseOutputWindows.c"
         ExecScript
   7. Choose the Close button.
   8. You can now define shortcut key for Script_CloseOutputWindows
      macro in the Key Mapping dialog box.

   Author:      Vedran Gaco
********************************************************************/

#include <stdio.h>
#include <editor/doc.h>

/*-------------------------------------------------------------------
                    main function
-------------------------------------------------------------------*/

int main(int argc, char *argv[])
{
   HDOC hDoc = Gte_GetFirstDocument();

   while(hDoc != NULL)
   {
      HDOC hNextDoc = Gte_GetNextDocument(hDoc);

      if(Gte_IsOutputWindow(hDoc))
      {
         Gte_CloseDocument(hDoc);
      }
      hDoc = hNextDoc;
   }
   return 0;
}
