Add a command to history?

Posted by Kahenraz on Mon 02 Apr 2018 03:55 PM — 4 posts, 19,224 views.

#0
Is there a way to add a command directly to the the history?

I have a script which runs and sends a particular command to the world but I want a different command to appear in the history.

For example:

I can use SendPush() to send a command "do something now" but I want the command history to "dsn" in the command history to run the alias for this command rather than same command exactly.

Send/SendPush does not pass the command to be processed as an alias so I'm looking at the possibility to just to Send() and add my own command directly to the history but I don't see a way to do this.
USA Global Moderator #1
Use SelectCommand(), PasteCommand("foo"), PushCommand().
#2
I don't know if there is a race condition or what but this doesn't seem to work.

SelectCommand() -- confirmed working
PasteCommand("foo") -- confirmed working

And then when PushCommand() is called, the command window blanks but nothing else happens. Even if I just want it to sent text like "north" it will blank out the command window but nothing gets sent to the world.

I also tried SetCommand() with the same result.
Australia Forum Administrator #3
It seems to work for me:


<aliases>
  <alias
   match="test"
   enabled="y"
   omit_from_command_history="y"
   send_to="12"
   sequence="100"
  >
  <send>

  Send ("sigh")
  SelectCommand()
  PasteCommand("foo")
  PushCommand()

</send>
  </alias>
</aliases>


Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


Now typing "test" sends "sigh" to the world but "foo" ends up in the command history.