1. Don't use F1, it is assigned by default to open help files in most Windows programmes and a script will over ride this (in mIRC anyway), though the point is you'll lose the functionality.
2. F2 ns identify <nickname> <password> will work (just alter the command itself to suit your network's services) but I don't recommend storing passwords as text. The best thing to do is store it in your brain and make it ia mix of upper/lower case, numerals and ASCII characters, ie: eUd4X&a< as this format will help prevent losers guessing your password with a script.