Save all BBEdit GREP Patterns in a file

/ Published in: AppleScript
Save to your folder(s)

Copy this code and paste it in your HTML
  1. set patternFile to "~/Library/Application Support/BBEdit/Setup/Grep Patterns.xml"
  2. set patternFile to do shell script "echo " & patternFile
  3. tell application "System Events"
  4. tell property list file patternFile's property list item "SavedGrepPatterns"
  5. set SavedGrepPatterns to value of property list items
  6. end tell
  7. end tell
  8. set patternList to {}
  9. repeat with i in SavedGrepPatterns
  10. tell (contents of i)
  11. set end of patternList to its Title
  12. set end of patternList to its SearchPattern
  13. set end of patternList to its ReplacePattern
  14. set end of patternList to ""
  15. end tell
  16. end repeat
  17. set AppleScript's text item delimiters to return
  18. set patternList to patternList as text
  19. tell application "BBEdit"
  20. activate
  21. make new document with properties {text:patternList}
  22. end tell

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.