I am trying to find out how to insert an existing applescript into a snippet or perhaps a more elegant solution to inserting variables into snippets. Perhaps I need to explain:
I have many variations of boilerplate text that I use dozens of times during the day in my work that require a variable input in certain places. While I am not a programmer, I am all for automating repetitive tasks and I'm not afraid of a little scripting. A little. Some of the stuff in those bundles looked downright scary.
I was kindly directed to use the tab stops for snippets like this:
________________________________________________
Hello ${1:firstname}
Thank you for your order for a ${2:product} ________________________________________________
Perfect. Easy. The next part, though, is to give me more control over the values I am inserting.
For example, I have been using BBedit (which does the job but I don't particularly like) and in their "clippings" you can insert a placeholder that can call up an applescript to run. Even this is awkward compared to the simple way that NoteTabPro worked for me for 10+ years in windows before I switched to a mac - I could create 'clips' in it that would insert boilerplate text and at any placeholders, I could include dialog boxes to type in a value or choose it from a list.
I sat here for 6 hours today trying to see how I can do this or something like it in TextMate - and I found programming languages that I will never use, and syntax for them that I am utterly stumped by.
Can anyone help me?
Janet
Hi Janet,
I am trying to find out how to insert an existing applescript into a snippet or perhaps a more elegant solution to inserting variables into snippets. Perhaps I need to explain:
Snippets are the first level of automation. In snippets you can use environment variables and shell code. You can set variables in the preferences.
For example the snippet
`echo $VARIABLE`
will insert the value of the variable VARIABLE, and you can use regular expression to do some transformations.
I have many variations of boilerplate text that I use dozens of times during the day in my work that require a variable input in certain places. While I am not a programmer, I am all for automating repetitive tasks and I'm not afraid of a little scripting. A little. Some of the stuff in those bundles looked downright scary.
I was kindly directed to use the tab stops for snippets like this:
Hello ${1:firstname}
Thank you for your order for a ${2:product} ________________________________________________
Perfect. Easy. The next part, though, is to give me more control over the values I am inserting.
For example, I have been using BBedit (which does the job but I don't particularly like) and in their "clippings" you can insert a placeholder that can call up an applescript to run.
For more complex insertions you can use TM_Commands. Commands are the second level of automation and can be inserted as snippet, and you can have contextual menus for them (cannot help with applescript).
All the best
Guido -- Dr Guido Governatori School of Information Technology and Electrical Engineering The University of Queensland Brisbane, Queensland, 4072, Australia Phone: +61-(0)7-336 52907 Fax: +61-(0)7-336 54999 http://www.governatori.net/ http://www.defeasible.org