hello. being new to applescript… i can only assume that this is an easy conversion…
if i have a file containing a variety of letters no specific order…
“a word”
and i want every instance of “a” to be “3” and every instance of “d” to become “5”…
“3 wor5”
i might want to convert every letter to a number or a word…
any help is helpful… thank you.

thank you for the help. this is perfect… i will look into the option of using a texteditor… thanks again.

You probably already know this. Before m_g’s routine:

set oldDelim to AppleScript’s text item delimiters

and immediately after it:

set AppleScript’s text item delimiters to oldDelim

Otherwise you’ll get some very strange things ‘going wrong’.
Forgive me if that was already patently obvious.

The easiest way might be use the letter’s ASCII value as in:

ASCII number “a” – returns 97

You may then recalculate the number as necessary.

The reciprocal operation is

ASCII character 97 – returns "a’


set test_string to "this a word"
set AppleScript's text item delimiters to "a"
set test_parts to every text item of test_string
set AppleScript's text item delimiters to "3"
set new_test_string to test_parts as text

but the best way might be to use a text editor. Most text editors are applescriptable and their search and replace is fast and can handle large files.