The Page.Focus or Designer.Focus command is not enough to put in focus a page you opened from a script.
For example, this code will put the page with id 8696 opened from the script, and draw on it a box, specified with the command Page.AddBoxEx(100000, 100000, 100000, 100000, 20):
Fred.PageOpenId(8696, False, Designer.Group)
TeraDP.GN4.WinUI.ShellWindow.DoEvents()
Designer = TryCast(Designer.Group.SelectedDesigner, IPageDesigner)
Designer.Focus()
Page.Focus()
Page.AddBoxEx(100000, 100000, 100000, 100000, 20)