JEdit持ってないからTextEditで
複数ファイル渡すと別々に分かれることがある(理由不明)
on open someItems
set outNames to {}
repeat with anItem in someItems
tell application "Finder"
set aName to name of anItem
set anExte to name extension of anItem
if anExte is not "" then
set aName to text 1 thru ((length of aName) - (length of anExte) - 1) of aName
set anExte to "." & anExte
end if
considering case
if aName contains "A" then
set aName to do shell script "echo " & quoted form of aName & " | sed 's/A/B/'"
end if
end considering
set end of outNames to aName & anExte
end tell
end repeat
set oldASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {" "}
set outNames to outNames as text
set AppleScript's text item delimiters to oldASTID
set outNames to outNames & linefeed
tell application "TextEdit"
launch
set aDoc to make new document
set text of aDoc to outNames
activate
end tell
end open