Changing the country in Address book

I have written a little script that cleans up the variations I have used for the US in the country field in Address Book. I ran it in script debugger a line at a time and when it gets to the part where a match is made to make the change, it apparently tells address book to set the country field but nothing happens. The script just proceeds onto the next record. No errors. Here is the code:

set old_Country to "US"
set new_country to "United States"

tell application "Address Book"
	repeat with this_person in every person
		set this_name to name of this_person -- this is to know what person the script is working on so I can see the changes made in AB
		set the_addresses to addresses of this_person
		
		repeat with this_address in the_addresses --rotate thru all addresses under the person
			
			set this_countrycode to country code of this_address --this is just to peak at what has been set, since you cannot view it directly in AB
			set this_country to country of this_address
			
			if this_country = old_Country then
				set country of this_address to new_country --HERE is where the country SHOULD be set
			end if
			
		end repeat
		
	end repeat
end tell

Any ideas? Also on a sorta related note - I found another script off the net that sets country codes based on the country field. This too would not make changes. But lets work on this script first. I appreciate any help.

Model: Powerbook G4
Browser: Safari 531.9
Operating System: Mac OS X (10.5)

Hi,

it’s probably a common mistake.
The index variable of the repeat with index_variable in list form is a reference to the element, not the element itself.
Reading the value is no problem, but to change a value you have to dereference the element with contents of

try


.
set country of contents of this_address to new_country
.

Well it seems that the script does work. I had to quit and relaunch Address Book to see the changes. Silly me.
:rolleyes: