If you want to automatically be logged in each time you launch Battlefield 2, edit your BF2 Command Line as follows
(See the Advanced Tweaking section for how to edit the Command Line):
"\Program Files\EA Games\Battlefield 2\BF2.exe" +playerName your playername +playerPassword your password
E.g.: "C:\Program Files\EA Games\Battlefield 2\BF2.exe" +playerName DogMaN +playerPassword Banana1
Basically by using the +playerName and +playerPassword parameters in your command line - along with any other entries you want to put in there - you will automatically be logged in as soon as you start the game, skipping the requirement to click Login on the login screen.
Update: Dennis has emailed me and pointed out that for this to work, the playerName and playerPassword commands are case-sensitive. That is, you must enter them exactly as shown, for example +playerName, not +playername. Furthermore your username and password are case sensitive as well, and must be entered precisely as you have them shown on the login screen. This method works with all versions of BF2, including the 1.12 patch onwards.