Is there any way to find a string in all open TextEdit documents (rather than just one document?) I have hundred plus such open documents, unsaved.
Find in all open TextEdit documents
textedit
Related Question
- MacOS – How to get all the open TextEdit documents back
- MacOS – TextEdit hangs when trying to reopen documents. Can I recover all documents except the one causing problems
- Delete the contents of some TextEdit Documents (60 GB)? (and how?)
- Xcode vs TextEdit “Find and Replace…”
- TextEdit – Set New Document Window to Open in Center
- In Textedit, is there a way to save all open files at once
Best Answer
The following example AppleScript code when run from Script Editor, or saved as an AppleScript application, will present a search string dialog box for you to type in the search string.
If a match is found, it then creates a new TextEdit document with the name(s) of the document(s) containing the search string. If no match is found, it displays a dialog box with a message.
Note: The example AppleScript code is just that and does not contain any additional error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors. Additionally, the use of the delay command may be necessary between events where appropriate, e.g.
delay 0.5
, with the value of the delay set appropriately.