2

I want to use TextExpander to activate when I type the specific text "attached", and have the AppleScript type out the word "attached" (since TextExpander will remove it), and then invoke the keystroke Control-Z

I can get each to work individually, but not together. Here is the code I am using based off of code I found here:

    tell application "System Events"
    keystroke "attached"
    keystroke "z" using control down
    end tell

2 Answers 2

3

I'm not sure what the TextExpander application name and process name is so I will guess what it is.

activate application "TextExpander"
    tell application "System Events"
        tell process "TextExpander"
            keystroke "attached"
            delay 0.5
            keystroke "z" using {command down}
        end tell
    end tell
2
  • For whatever reason, the "attached" text does not type out. The delay and the Ctrl-Z actions work fine.
    – George C
    Nov 7, 2012 at 15:34
  • If the edited version does not work, you may need to save it as an app, change the plist so it runs in the background and remove the tell process..
    – adayzdone
    Nov 7, 2012 at 15:50
0

TextExpander has its own script-ability.

Links:

Example:

tell application "Alfred 2"
    search ""
    tell application "TextExpander"
        expand abbreviation ";drmt"
    end tell
end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .