I have to often reference documents from a list of several dozen and have successfully made hotstrings to call them up. For example:
Code: Select all
;Document List Hotstrings
::abc0101::ABC-01.01 Title One
::abc0202::ABC-01.02 Title Two
::def0101::DEF-01.01 Title Three
::def0102::DEF-01.02 Title Four
abc0101 > ABC-01.01 Title One
[abc0101 > [[ABC-01.01 Title One]]
Now, I could duplicate all the hotstrings and make two versions, one with brackets, one without, but what I would really like to do is something like below; which would read my hotstring, decide if there is a leading "[" and then choose whether or not to enclose the title based on that.
The problem is, SendInput only sends the hotstring and it doesn't trigger the text expansion. I end up with something like [[abc0101]] instead of [[ABC-01.01 Title One]]. Is it even a possibility to do what I want to do, or is there a better way to do this? I feel like I'm missing some simple thing, but I can't find anything addressing this.
Here is my _not working_ vision of what the code should look like (which would be paired with the document hostring list, of course):
Code: Select all
#k::
Input, UserInput, L8, {enter}
FirstChar := SubStr(UserInput, 1, 1) ; What is the first character of the UserInput?
if (FirstChar = "[")
{
Chop := SubStr(UserInput, 2) ;remove the leading bracket
SendInput, [[%Chop%]] ;enclose the title in brackets
} else {
SendInput, %UserInput% ;otherwise send the title without brackets
}
return
Thank you for any help you can provide.
MR