Replace in Titles

Summary: Lets you make changes to the titles of the selected records using find and replace.
Requires: EagleFiler
Install Location: ~/Library/Scripts/Applications/EagleFiler/
Last Modified: 2019-10-02


EagleFiler will replace the source string with the replacement string in the title of each selected record.

Installation Instructions · Download in Compiled Format · Download in Text Format


tell application "EagleFiler"
set theSource to my promptForString("Enter text to find in the titles:")
if theSource is not "" then exit repeat
end repeat
set the theReplacement to my promptForString("Enter replacement text:")
set theRecords to selected records of browser window 1
tell library document 1
repeat with theRecord in theRecords
set theName to theRecord's title
set title of theRecord to my replace(theName, theSource, theReplacement)
end repeat
end tell
end tell

on promptForString(thePrompt)
display dialog thePrompt default answer "" buttons {"Cancel", "OK"} default button 2
return text returned of the result
end promptForString

on replace(theString, theSource, theReplacement)
set AppleScript's text item delimiters to theSource
set theItems to every text item of theString
set AppleScript's text item delimiters to theReplacement
return theItems as Unicode text
end replace