I feel there is more to this problem than I have answered. We are in need of more details on what you are attempting to modify. Be specific. Split problem down to each document type you wish to change.
Are you looking to change an Applescript string/text?
I wrote up an alterString function. In this example, I changed all instances of BTS to bts and remove SNAP/.
(*SearchString is MF65BS00063RD3OS.PSD,MF65BS00063RD3OS,,BTS DTI SNAP/PONIO B BURGUNDY ONE SIZE,*)
(*in ~~~ alterString ~~~*)
(*SearchString is MF65BS00063RD3OS.PSD,MF65BS00063RD3OS,,bts DTI SNAP/PONIO B BURGUNDY ONE SIZE,*)
(*in ~~~ alterString ~~~*)
(*SearchString is MF65BS00063RD3OS.PSD,MF65BS00063RD3OS,,bts DTI PONIO B BURGUNDY ONE SIZE,*)
(*
It is easier to diagnose problems with debug information. I suggest adding
log statements to your script to see what is going on. Here is an example.
Author: rccharles
For testing, run in the Script Editor.
1) Click on the Event Log tab to see the output from the log statement
2) Click on Run
For running shell commands see:
https://developer.apple.com/library/archive/technotes/tn2065/_index.html
http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
*)
global debug
set debug to 5
set SearchString to "MF65BS00063RD3OS.PSD,MF65BS00063RD3OS,,BTS DTI SNAP/PONIO B BURGUNDY ONE SIZE,"
if debug ≥ 5 then log "SearchString is " & SearchString
set SearchString to alterString(SearchString, "BTS", "bts")
if debug ≥ 5 then log "SearchString is " & SearchString
-- remove string
set SearchString to alterString(SearchString, "SNAP/", "")
if debug ≥ 5 then log "SearchString is " & SearchString
-- ------------------------------------------------------
(*
alterString
thisText is the input string to change
delim is what string to change. It doesn't have to be a single character.
replacement is the new string
returns the changed string.
*)
on alterString(thisText, delim, replacement)
global debug
if debug ≥ 5 then log "in ~~~ alterString ~~~"
set resultList to {}
set {tid, my text item delimiters} to {my text item delimiters, delim}
try
set resultList to every text item of thisText
set text item delimiters to replacement
set resultString to resultList as string
set my text item delimiters to tid
on error
set my text item delimiters to tid
end try
return resultString
end alterString