What about the opposite? Can you programmatically attach a shell to a window you choose to open?
Yes, that's actually possible even unter Kickstart 1.x. However, it requires the use of undocumented operating system functions and knowledge of how the con-handler (responsible for the CON: and RAW: devices) deals with the startup message it receives when it is asked to connect a file handle to a window.
Where on Earth did you find out how to do this?! Lol. I have been scouring the web and my books.
Much of this information is still available, but it is only found in archives which predate the Internet as we know it by 6-8 years. For example, information on how to tell con-handler to use a ready-made window instead of opening its own can be found in an October 1986 posting on usenet, in the net.micro.amiga group. It's called "Creating a DOS Window in a Custom Screen" and it was written by Commodore engineer Andy Finkel. Try Google Groups, the article is still there.
Much of the early information which is still relevant (sometimes painfully so) can be found in example code posted by Commodore engineers on usenet, which subsequently found its way onto the AmigaLibDisks ("Fish disks"). How to obtain the window attached to a shell is explained in a series of postings on usenet under the subject "MsgPorts, DOS, ACTION_SCREEN_MODE help needed". The code which I cooked up for you is suspicously similar to the contents of that article, I might say
Finally, there is the official technical documentation published by Commodore under the name "Amiga Mail". If you can find it, the CATS Developer CD as well as the Amiga Developer CDs contain the complete archive.
Slightly more difficult to find is the "Amiga Guru book" (and its precursor, the German language "Das Amiga Guru-Buch") written by Ralph Babel, who spent years researching dos.library and the fundamentals upon which it rests. The results were self-published in 1993/1989, respectively. If there is anything worth knowing and understanding about this subject you will find that Ralph Babel can thoroughly explain it. Do you enjoy reading Donald Knuth detailing the breadth, the width and the depth of even the most humble algorithms? Then the "Amiga guru book" might just be the book for you.
Guys like Thomas and me have been around for a while, and we couldn't help picking up a lot of Amiga technical history along the way. Not that it amounts to much in this day and age when the Amiga is at best considered a significant historical stepping stone for the evolution of personal computers, but at times it feels like we might be carrying knowledge around which is important and useful
Finally, in your example, do I need to invoke/message ACTION_UNDISK_INFO as mentioned by Thomas?
To the best of my knowledge no such packet did exist in the Kickstart 1.x days, and Kickstart 2.x and beyond are neither harmed nor insulted when asked to volunteer information about the window, the console unit and the mode of operation of the console file handle attached to a shell window