getWindowsHandles(which = "R", pattern = "", minimized = FALSE)arrangeWindows function.  Each of the
  arguments may be a vector of values.  These will be treated as
  follows:
  which is "R", only windows belonging to
  the current R process will be returned.  In MDI mode, those will be the
  child windows within the R GUI frame.  In SDI mode, all windows
  belonging to the process will be included. If the element is "all", then top level windows will be returned. The elements of pattern will be used to make a subset of windows
  whose title text matches (according to grep) the pattern. If minimized = FALSE, minimized windows will be ignored.arrangeWindows