-- Add Filename Prefix-Suffix -- https://c-command.com/scripts/eaglefiler/add-filename-prefix-suffix -- Summary: Add text to the beginning or end of the selected records’ filenames. -- Requires: EagleFiler -- Install Location: ~/Library/Scripts/Applications/EagleFiler/ -- Last Modified: 2019-05-24 tell application "EagleFiler" set _affix to my promptForString("Enter text to add to the filenames:") set _shouldPrefix to my shouldPrefix() set _records to selected records of browser window 1 tell library document 1 repeat with _record in _records set _oldBase to _record's basename if _shouldPrefix then set _newBase to _affix & _oldBase else set _newBase to _oldBase & _affix end if set basename of _record to _newBase end repeat end tell end tell on shouldPrefix() set _prompt to "Add the text to the filename as a prefix or suffix?" display dialog _prompt buttons {"Cancel", "Prefix", "Suffix"} default button 3 return button returned of the result is equal to "Prefix" end shouldPrefix on promptForString(_prompt) display dialog _prompt default answer "" buttons {"Cancel", "OK"} default button 2 return text returned of the result end promptForString