![]() |
![]() |
|
Help: AppleScript Snippets and Shell Script SnippetsTextExpander 2.0 introduces a new type of snippet -- AppleScript. You can choose "AppleScript" as the format type then enter an AppleScript such as this one: -- add seconds to current date When you enter the abbreviation associated with an AppleScript snippet, the AppleScript will execute and if the snippet has a text result, it will replace the abbreviation. If you'd like to have access to the abbreviation used to trigger the AppleScript snippet, you'll need to write your script as a textexpander handler such as this: on textexpander(days) The script above allows you to set up multiple abbreviations with the same script to get different results. For example, you could use the abbreviations "d+1" and "d+2" to get tomorrow's date and the day after tomorrow. Also, you could use "d-1" for yesterday. Shell ScriptsTextExpander 2.5.2 introduces a new type of snippet -- shell scripts. You can choose "Shell Script" as the format type then enter a shell script such as this one: #!/usr/bin/perl print "Hello from Perl!\n"; Your shell script must have the “shebang” (#!) on its first line and that must specify the interpreter to be used for your script. Here is an example of a Unix shell script #!/bin/bash echo "Hello from Bash!" AppleScripts and shell scripts can also be nested using %snippet:[snippet name]%. Feel free to share your cool scripts with us. |
||
© 2006-2009 SmileOnMyMac, LLC. All rights reserved. Smile and TextExpander are trademarks of SmileOnMyMac, LLC. |