Make e-mail from name and paste it to Indesign

Hello,

I have InDesign document with Job title TAB Name Surname TAB Phone number TAB Room number
This is sample of two lines:
Vecākā referente Baiba ŠTERNA 67028269 214
Vecākā referente Sarmīte JĒKABSONE 67028385 215

Problem is: I need add e-mail address which is formed Name.Surname@apollo.lv.

I wrote script which get manually selected Name and Surname, make e-mail address and put it clipboard.

It will be nice if someone help me wrote such comands:

Select last word in line which is Room number (214) and replace it with my script result e-mail address (baiba.sterna@apollo.lv)

here is my script:



tell application "Adobe InDesign CS3"
	
	
	set myPageItem to text 1 of selection
	
	set NameAndSurName to ""
	set CopyItem to myPageItem as text
	set y to length of myPageItem
	
	repeat with CurentCharNumb from 1 to y by 1
		ignoring case and diacriticals
			set CurrentChar to character CurentCharNumb of CopyItem
			if CurrentChar = "a" then
				set CurrentChar to "a"
			else if CurrentChar = "b" then
				set CurrentChar to "b"
			else if CurrentChar = "č" or CurrentChar = "Č" or CurrentChar = "C" then
				set CurrentChar to "c"
			else if CurrentChar = "d" then
				set CurrentChar to "d"
			else if CurrentChar = "e" then
				set CurrentChar to "e"
			else if CurrentChar = "f" then
				set CurrentChar to "f"
			else if CurrentChar = "Ä£" or CurrentChar = "Ä¢" or CurrentChar = "G" then
				set CurrentChar to "g"
			else if CurrentChar = "h" then
				set CurrentChar to "h"
			else if CurrentChar = "i" then
				set CurrentChar to "i"
			else if CurrentChar = "j" then
				set CurrentChar to "j"
			else if CurrentChar = "ķ" or CurrentChar = "Ķ" or CurrentChar = "k" then
				set CurrentChar to "k"
			else if CurrentChar = "ļ" or CurrentChar = "Ļ" or CurrentChar = "l" then
				set CurrentChar to "l"
			else if CurrentChar = "m" then
				set CurrentChar to "m"
			else if CurrentChar = "ņ" or CurrentChar = "Ņ" or CurrentChar = "n" then
				set CurrentChar to "n"
			else if CurrentChar = "o" then
				set CurrentChar to "o"
			else if CurrentChar = "p" then
				set CurrentChar to "p"
			else if CurrentChar = "r" then
				set CurrentChar to "r"
			else if CurrentChar = "Å¡" or CurrentChar = "Å " or CurrentChar = "s" then
				set CurrentChar to "s"
			else if CurrentChar = "t" then
				set CurrentChar to "t"
			else if CurrentChar = "ū" or CurrentChar = "Ū" or CurrentChar = "u" then
				set CurrentChar to "u"
				
			else if CurrentChar = "v" then
				set CurrentChar to "v"
			else if CurrentChar = "ž" or CurrentChar = "Ž" or CurrentChar = "z" then
				set CurrentChar to "z"
			else if CurrentChar = " " then
				set CurrentChar to "."
			end if
			
		end ignoring
		set NameAndSurName to NameAndSurName & CurrentChar & ""
		
	end repeat
	
	set formedEmailAddress to "	" & NameAndSurName & "@apollo.lv"
	set the clipboard to formedEmailAddress
	
	
end tell


Model: intel iMac
AppleScript: latest
Browser: Safari 525.20.1
Operating System: Mac OS X (10.5)

Hi normundsb,

Please do not post your question multiple times in the same forum. Thank you :wink: