«http://www.scripting.com/fatPages/09/fileSearchReplace.html
«Sun, Sep 14, 1997 at 9:40:56 AM by DW
local (filelist = FinderMenu.getSelectionList ())
on selectionError ()
scripterror ("Please select a folder in the Finder.")
if sizeof (filelist) != 1
selectionError ()
local (folder = filelist [1])
if not file.isfolder (folder)
selectionError ()
local (foldername = file.fileFromPath (folder) - ":")
if not dialog.ask ("Search '" + foldername + "' for what string?", @scratchpad.searchfor)
return
if not dialog.ask ("Replace with what string?", @scratchpad.replacewith)
return
local (filetext, filetype)
fileloop (f in folder, infinity)
filetype = file.type (f)
if filetype == 'TEXT'
filetext = toys.readWholeFile (f)
if filetext contains scratchpad.searchfor
msg (f)
filetext = string.replaceAll (filetext, scratchpad.searchfor, scratchpad.replacewith)
toys.writeWholeFile (f, filetext, filetype, file.creator (f), file.created (f))