# Input alias having a place holder which gets selected when the alias is used

If one executes the following code

SetOptions[EvaluationNotebook[], InputAliases -> {"aa" ->
"AFunctionWithAVeryLongName[\!$$\*TagBox[FrameBox[\"input\"],\"Placeholder\"]$$]"}]


the front end will change ESC+a+a+Esc into a long expression with a placeholder. I want the placeholder selected after the replacement.

If I try to use SelectionPlaceholder, instead of Placeholder, then a character from AFunctionWithAVeryLongName gets selected.

If I try to include a tab at the end of the string,

SetOptions[EvaluationNotebook[], InputAliases -> {"aa" ->
"AFunctionWithAVeryLongName[\!$$\*TagBox[FrameBox[\"input\"],\"Placeholder\"]\:0009$$]"}]


the tab goes in literally as a tab character, not a tab command.

Also, I want the output to have a string, say "input", in the placeholder.

-
Related. The answer there by the user matTECmatica appears to answer your question. I think that code could be slightly improved, maybe also see my comment there. –  Jacob Akkerboom Aug 11 '13 at 14:49
Hector, you haven't answered my question: if as I believe this is not possible from InputAliases what alternatives are acceptable to you? What about a shortcut-key, or a palette button? –  Mr.Wizard Aug 12 '13 at 1:13
Unfortunately, I do not see how Mathematica would allow key modifiers for shortcuts. I am working on a palette button to be controlled by AutoHotkey. –  Hector Aug 13 '13 at 13:22
Hector, I'm not sure what you mean. If you doubt it is possible to create your own keyboard shortcuts please see this search result as it surely is. Are you going to post a new question? –  Mr.Wizard Aug 13 '13 at 14:11
@Mr.Wizard I am looking for shortcuts available only when a package has been loaded (as opposed to system-wide ones). Also, I will post a new question because creating palette brought new challenges. –  Hector Aug 13 '13 at 14:28

SetOptions[EvaluationNotebook[],
InputAliases -> {
"aa" -> RowBox[{"AFunctionWithAVeryLongName", "[", "\[SelectionPlaceholder]", "]"}]
}
]


A placeholder with a name does not seem possible with Input Aliases.

-
Very nice! You were quick too :) –  Jacob Akkerboom Aug 11 '13 at 14:53
Duh!, the manual does say that InputAliases accepts "strings or box expressions." –  Hector Aug 11 '13 at 14:54
@Hector There are lots of things the manual says that I didn't understand until someone gave me an example, or sometimes several examples. –  Mr.Wizard Aug 11 '13 at 14:56
I updated the question to make explicit the requirement on the string within the placeholder … –  Hector Aug 11 '13 at 15:11
@Hector I'm not certain that is possible from an input alias (I'll be happy to see it if it is). Things like command completion templates are inserted programmatically and use e.g. SelectionMove to select the labels. At least that's my recollection. –  Mr.Wizard Aug 11 '13 at 15:15