Apply applescript to any open text document

General Infos: I am on MACPRO 2013 Mojave using BBedit latest and Script Editor Version 2.11 (203.1)

I have created an applescript recording it from BBEDIT with this line I would like to use for other similar files:

replace “";” using “” searching in text 1 of text document “Untitled.mer” options {starting at top:true}

instead I’d like to change it in a way I can use the whole script for any txt document I have open in BBEDIT without specifying the name of the file I work with

Maybe changing the "in text 1 of text document “Untitled.mer” with

“all open text documents” in BBEDIT

thanks kindly

Hi danwan,
Try this:

tell application "BBEdit"
	repeat with tw in every text window
		repeat with td in every text document of tw
              -- Change as required
			replace "ABC" using "abc" searching in text 1 of td options {starting at top:true}
		end repeat
	end repeat
end tell