Use KM to Activate TE on already created Word Doc?

Hey JustRed,

If you don't have TextWrangler on your system then download and install it.

Open TextWrangler.

Open the Script Editor.app.

Paste in the AppleScript below.

Run the script.

It'll take a couple or three minutes to complete.

-Chris

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2016/02/25 16:39
# dMod: 2016/02/25 16:39 
# Appl: TextExpander
# Task: Export TextExpander Snippets to TextWrangler
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Export, @TextExpander, @Snippets, @TextWrangler
-------------------------------------------------------------------------------------------

set _sep to "------------------------------------------------------------------"

set docSaveLocation to (path to desktop as text) & "TextExpander_Export.txt"
tell application "TextWrangler"
  if not running then run
  delay 1
  activate
  set newDoc to make new text window with properties {bounds:{0, 44, 905, 1196}} initial save location docSaveLocation
  save newDoc's document
end tell

tell application "TextExpander"
  set groupNameList to name of every group
  
  repeat with theGroup in groupNameList
    set _name to _sep & return & (contents of theGroup) & space & "Snippet Group" & return & _sep & return & return
    
    textwranglerSetNamedDocText(1, _name, "append", "don't activate") of me
    
    tell group theGroup
      repeat with theSnippet in snippets
        set theSnippetText to theSnippet's abbreviation & tab & theSnippet's plain text expansion & return
        textwranglerSetNamedDocText(1, theSnippetText & return, "append", "don't activate") of me
      end repeat
    end tell
    
  end repeat
  
end tell

-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on textwranglerSetNamedDocText(_document, _text, _append, _activate)
  tell application "TextWrangler"
    
    if _document = 0 or _document = "new" then
      set newDoc to make new document with properties {text:_text, bounds:{303, 44, 1617, 1196}}
      
    else if _append = true or _append = "append" or _append = 1 then
      set after text of text document _document to _text
    end if
    
    if _activate = 1 or _activate = "activate" then activate
    
  end tell
end textwranglerSetNamedDocText
-------------------------------------------------------------------------------------------