Hi all,
I have a text file that I would like to search for a value and then search for another value after the point where the first value has been found and return the text between these two points. I have written the script below that gives me what I want but I don’t think it’s the best way of doing it. I’ve been using offset but I’m sure it must be better to use AppleScript’s text item delimiters. Advise please!
set thefile to choose file
set the_text to read thefile
set search_string_1 to "FONTS"
set my_offest to offset of search_string_1 in the_text
set new_text to characters my_offest thru end of the_text as string
set search_string_2 to "COLORS"
set my_offset_2 to offset of search_string_2 in new_text
set my_new_offset to (my_offset_2 as real) - 1
set newer_text to characters 1 thru (my_new_offset as string) of new_text as string
Thanks,
Nik