| Message |
This example alias does what you asked, however it does not do any command (eg. copy files).
<aliases>
<alias
match="grep *"
enabled="y"
send_to="12"
sequence="100"
>
<send>Dim FSO, TexttFile, sContents, sFileName, LineArray, L, Count
sFileName = GetVariable ("filename")
'
' Get a FileSystemObject
'
Set FSO = CreateObject("Scripting.FileSystemObject")
'
' Open the file
'
On Error Resume Next
Set TexttFile = FSO.OpenTextFile(sFileName,1)
'
' Check for error opening it
'
If Err.Number <> 0 Then
ColourNote "white", "red", "Could not open file: " & sFileName
ColourNote "white", "red", Err.Description
On Error GoTo 0
Else
On Error GoTo 0
'
' Read contents
'
Contents = TexttFile.ReadAll
TexttFile.Close
Set TexttFile = Nothing
'
' Split file into lines at carriage return, line feed
'
LineArray = Split (Contents, vbCrLf)
Count = 0
'
' Go through a line at a time
'
For Each L in LineArray
Count = Count + 1
'
' If found, display it
'
If InStr (1, L, "%1", vbTextCompare) > 0 Then
world.Note CStr (Count) & ": " & L
End If
Next
Contents = ""
End If ' no error on open
Set FSO = Nothing
</send>
</alias>
</aliases>
I wasn't sure what file name you wanted, so you need to put it into a MUSHclient variable "filename".
The alias is just "grep *" so you would type:
grep blue
and it will search the file in the variable "filename". (See the variables configuration screen to add a variable).
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|