Rectangle[] positions1 = new Rectangles { { 1280, 0, 1280, 720}, { 1280, 719, 1280, 720 }, { 0 , 1440, 1280, 720 }, { 0, 719, 1280, 720 }, { 1280, 1440, 1280, 720 }, { 2560, 0, 1280, 720}, { 2560, 719, 1280, 720 }, { 2560, 719, 1280, 720 }, { 2560, 1440, 1280, 720 }, }.ToArray(); for (int i = 0; i < websites1.Length; ++i) { var window1 = BFS.Web.OpenUrlNewWindow(websites1[i]); BFS.General.Sleep(1500); //if we failed to get the handle, continue to next loop iteration if(window1 == IntPtr.Zero) continue; //move the window to the specified location var p1 = positions1[i]; BFS.Window.SetSizeAndLocation(window1, p1.X, p1.Y, p1.Width, p1.Height); };