Posted By

page_lab on 07/02/12


Tagged

applescript patterns grep bbedit


Versions (?)

Save all BBEdit GREP Patterns in a file


 / Published in: AppleScript
 

  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  

You need to login to post a comment.