These triggers will add the ability to define an unlimited number of targets and add them to the end of any command. All aliases are Regular Expression and Send to Script.
First, add the alias:
^t(\d+)(.*)
With the text:
if "%2" == "" then
Note ("Target %1 is set to:" .. (GetVariable("target%1") or " nothing"))
else
Note ("Setting target %1 to:%2")
SetVariable("target%1", "%2")
end
That will allow you to set an alias by typing t + any number. So you could type t1 Jack or t98 Jill. Typing t1 or t98 would remind you who you set as the target.
Now add the alias:
^(\D.*?)(\d+)$
This alias will match on any line that does not start with a number (to not interfere with number shortcuts) but does end with a number. Give it the text:
Execute ("%1 " .. (GetVariable("target%2") or " "))
Now if you type something like bash1 or bash98 it will check the contents of that target variable and fill in the person for you. bash1 becomes bash Jack. But there is one potential problem we need to fix. What about commands that naturally end in numbers, such as bank commands? First, give the current alias a high sequence, like 150. Then, add one more alias:
^(withdraw|deposit)(.*)$
With the text:
Send ("%1%2")
This will allow those commands to go through (and any others you may wish to add to the pipe separated list) as long as this is a earlier sequence (default 100) than the target alias (recommended 150 or so).
Edited 1 time(s). Last edit at 12/10/2011 06:50AM by joecloud.