Changing date format in existing Word docs...

Hi:

My brother publishes for both American and European journals and has need of a method to change American date format - October 5, 2010 - to European format - 5 October 2010 - or back… within fairly lengthy Word 2008 (Mac) documents… in the text body AND in footnotes.

I wrote a simple (and very imperfect) AppleScript routine (below) to detect the two formats in plain text, but have no idea (not having Word) how one would go about a find and replace procedure for existing Word documents.

I guess my question is this: If my brother can’t find anyone else to do this for him are there folk here who might be able to help… with or without economic ‘incentives’?

I believe he’s using 10.5.x…

Suggestions?

Thanks Very Much.

Peter B.




property months_of_the_year : {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}

set sample_text to "The Treaty on the Non-Proliferation of Nuclear Weapons, also Nuclear Non-Proliferation Treaty (NPT or NNPT) is a treaty to limit the spread of nuclear weapons, opened for signature on July 1, 1968. There are currently 189 countries party to the treaty, five of which have nuclear weapons: the United States, the United Kingdom, France, Russia, and the People's Republic of China (the permanent members of the UN Security Council).

The Treaty on the Non-Proliferation of Nuclear Weapons, also Nuclear Non-Proliferation Treaty (NPT or NNPT) is a treaty to limit the spread of nuclear weapons, opened for signature on 1 July 1968. There are currently 189 countries party to the treaty, five of which have nuclear weapons: the United States, the United Kingdom, France, Russia, and the People's Republic of China (the permanent members of the UN Security Council)."

tell me to activate
display dialog "Two otherwise identical paragraphs in plain text differing only in date format:" & return & return & sample_text with title "Date Format Detection"

set the_paras to paragraphs of sample_text

repeat with this_para in the_paras
	
	set these_words to words of this_para
	
	repeat with this_num from 1 to count of these_words
		
		set this_word to (item this_num of these_words) as string
		
		if this_word is in months_of_the_year then
			
			set prev_num to (this_num as integer) - 1
			set next_num to (this_num as integer) + 1
			set next_next_num to (this_num as integer) + 2
			
			set prev_word to item (prev_num as integer) of these_words
			set next_word to item (next_num as integer) of these_words
			set next_next_word to item (next_next_num as integer) of these_words
			
			try
				set integer_check to (prev_word as integer)
				tell me to activate
				display dialog "European Date Format" & return & return & prev_word & " " & this_word & " " & next_word with title "Date Format Detection"
			on error
				tell me to activate
				display dialog "American Date Format" & return & return & this_word & " " & next_word & ", " & next_next_word with title "Date Format Detection"
			end try
			
		end if
		
	end repeat
	
end repeat