Here is the script. Who knows... maybe it could be useful for another person. I changed it so it provides the wep key when detects my access point, or disables wep encryption otherwise (for the office).

It is written is perl, since I'm more familiar (not expert) with this languague than shell scripting.

Code:
#!/usr/bin/perl

# myaccesspoint.pl
# Looks for my home access point and provides my WEP key if it is found.
# Otherwise, it disables WEP key

# Some "configurations"
# My card device
$card = "eth0";
# access point address
$AP = "xx:xx:xx:xx:xx";
# WEP KEY
$WEP = "yyyyyyyyyyyyyy";

# Checks for the access point
open( CHECK,"iwlist $card scan | grep $AP |" );

if(<CHECK> ) {
  # Provides WEP key if my access point is found
  print STDERR "Configuring network with WEP key\n";
  system "iwconfig $card key $WEP";
} else {
   # Configures wireless network without key if my access point is not found
  print STDERR "Configuring network without WEP\n";
  system "iwconfig $card key off";
}

# Asks for IP (I have DHCP in both places).
print STDERR "Pumping for an IP\n";
system "pump -i $card";