I’m looking for a way to perform an operation on every file in a BBedit project. I have everything already scripted and working smoothly for individual files but I need to perform the same operation on every file (55 of them) in a project. Right now I do it manually, select the file and run the script, 55 times. That’s not efficient.
Unfortunately, all the files are in different folders scattered all over the place. That’s why I put them in a project. I just want to iterate through the project files whether they are open or not, not necessarily a folder.
Here’s an example of the script.
tell application "BBEdit"
activate
tell text of text document 1
replace "zzzzzzz" using selection as text options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
end tell
save document 1
end tell
tell application "BBEdit"
tell front project document
set projectItemList to project items
end tell
tell front project window
set docList to documents whose name does not end with ".bbprojectd"
end tell
end tell
Note there’s a difference between project items and open documents.