getOpenWindows()

Parent Previous Next

TW.app.getOpenWindows();


Returns an array of TW.target objects currently open.

That is an array of current Tw edit objects.




Example:-


  //  eval(TW.app.getGlobal("helper_twPan"));  // using longhand so that libraries can be independently loaded, PAN libraries must be set up

   

  //  eval(TW.app.getGlobal("helper_PhpJs"));  // rem out if PAN libraries not set up

 


  var windows =  TW.app.getOpenWindows();

  var titleList = [];

 

    for (editor in windows)

         {

         

           var targetDocument = windows[editor];

           titleList.push(targetDocument.windowTitle);

           }

 

  chosenWindow = TW.getItem(null, "Please Choose Document", "Please Choose Document", titleList);

 

  TW.information(null, "Choosen Document", chosenWindow);

 

 

                  // requires helper_PhpJs

 //  arrayPosition = PhpJs.array_search(chosenWindow, titleList);

                                        // needle, Array to search

// If   helper_PhpJs not in use do this longahand

 

  for (count in titleList)

       {

       

     var arrayPosition = -1;

        if ( titleList[count] == chosenWindow)

           {

           arrayPosition = count;

           break;

          }                

        }

       

//  TW.information(null, "Array Position", arrayPosition); // requires helper_PhpJs

 

    TW.information(null, "Choosen Document File Name", windows[arrayPosition].fileName);

     

Created with the Personal Edition of HelpNDoc: Free Web Help generator