For the menu option look at something like this
Volv's reply to Tips
As far as creating a Window this is all done in XML. Take a look at some other script and see how they do things and don't forget to check out the official documentation on the site.