Blank line alias

Posted by JSteele1234 on Wed 18 Jun 2003 04:44 PM — 8 posts, 34,121 views.

USA #0
I can't seem to find a way for an alias to stop a blank line from being sent. My only alias is *, which I would hope would match everything that's ever typed in, but it doesn't match on a blank line. ^$ looks like it would work, but it doesn't either. I don't know a whole lot about regular expressions, could there be a better one that will work?
Canada #1
Try:

Click File, Global Preferences, General (tab), and check the box [ ] Regular expressions can match on an empty string
USA #2
It's not working.

Here's my alias for catching the blank line.
http://jsteele1234.shacknet.nu/EditAlias.jpg

But it's not even calling the script function.
Amended on Thu 19 Jun 2003 02:54 AM by JSteele1234
Australia Forum Administrator #3
Take a look at the release notes for version 3.35, in particular point 13, sub-point "h" onwards.

http://www.gammon.com.au/scripts/showrelnote.php?version=3.35&productid=0

In essence, a blank line is treated as a bit of a special case, and does not go through alias processing.
USA #4
Well, I made a script to use in Mushclient to function as a client for a certain chat room, which uses a unique protocol. Whenever a bad command is sent to the server it automatically bans you for 24 hours, and blank lines count as a bad command. So if I ever accidentally press enter, I'm banned for the whole day.
Australia Forum Administrator #5
Ah, I see. In that case, install this plugin, it will suppress blank lines. It uses the plugin callback OnPluginSend to detect and discard them ...


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, June 19, 2003, 6:25 PM -->
<!-- MuClient version 3.42 -->

<!-- Plugin "Suppress_Blank_Lines" generated by Plugin Wizard -->

<muclient>
<plugin
   name="Suppress_Blank_Lines"
   author="Nick Gammon"
   id="020ea5e9855b555be70bcfe3"
   language="VBscript"
   purpose="Suppresses blank lines from being sent"
   date_written="2003-06-19 18:24:57"
   requires="3.31"
   version="1.0"
   >

</plugin>

<script>


Function OnPluginSend (sText)
  If Trim (sText) = "" Then
    OnPluginSend = vbFalse  ' discard blank lines
  Else  
    OnPluginSend = vbTrue  ' process it
  End If
End Function


</script>

</muclient>


USA #6
Its late, so this is a bit fuzzy in my mind right now... but, possible solution would be to make a plugin, and have it automatically add a character to the line, using plugin callbacks.

[edit]

I should probably check for updates before I post... oh well.
Amended on Thu 19 Jun 2003 08:40 AM by Flannel
USA #7
Thank you very much.