Is it possible to write the following scripts in Lua or should I write plugins in VBScript instead?
I rather not use the function os.execute since the DOS pop-up is annoying.
Should I try using LuaCOM? (faq 27)
Accessing COM objects from Lua
http://mushclient.com/forum/?id=6022
This VBScript alias copies my log to the temp directory then opens it in an editor.
This VBScript alias searches an online equipment list. (i.e. submit form data, parse response, print)
I rather not use the function os.execute since the DOS pop-up is annoying.
Should I try using LuaCOM? (faq 27)
Accessing COM objects from Lua
http://mushclient.com/forum/?id=6022
This VBScript alias copies my log to the temp directory then opens it in an editor.
<aliases>
<alias
match="log"
enabled="y"
send_to="12"
sequence="100"
>
<send>Option Explicit
Sub Log
Dim objShell, objFile, strLOG, strTMP, strEditor
Set objShell = CreateObject("WScript.Shell")
Set objFile = CreateObject("Scripting.FileSystemObject")
strLOG = "C:\\Program Files\\MUSHclient\\logs\\DSL.LOG"
strTMP = objShell.ExpandEnvironmentStrings("%TMP%") & "\\DSL.LOG"
strEditor = "C:\\Program Files\\Vim\\vim72\\gvim.exe"
If objFile.FileExists(strLOG) Then
objFile.CopyFile strLOG, strTMP
End IF
objShell.Run Chr(34) & strEditor & Chr(34) & Chr(32) & Chr(34) & strTMP & Chr(34)
Set objFile = Nothing
Set objShell = Nothing
End Sub
Log</send>
</alias>
</aliases>This VBScript alias searches an online equipment list. (i.e. submit form data, parse response, print)
<aliases>
<alias
match="search *"
enabled="y"
send_to="12"
sequence="100"
>
<send>Option Explicit
Dim strHTML
Sub GetEquipmentList
Dim objHTTP
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.Open "POST", "http://www.dsl-mud.org/algoron/equipment/keyword_items.asp"
objHTTP.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.Send "keyword=" & Replace("%1", " ", "+")
strHTML = objHTTP.ResponseText
End Sub
Sub FormatEquipmentList
Dim intX, intY, intZ, objRegExp
intX = instr(strHTML, "#EDBD70")
intY = instr(strHTML, vbCrLf & "</div>")
intZ = intY - intX
If intX = 0 Then
strHTML = "no equipment found"
Else
strHTML = mid(strHTML, intX, intZ)
Set objRegExp = New RegExp
objRegExp.Global = True
objRegExp.Pattern = "#EDBD70.."
strHTML = objRegExp.Replace(strHTML, "")
objRegExp.Pattern = ">\\s+<"
strHTML = objRegExp.Replace(strHTML, "><")
objRegExp.Pattern = "<tr>"
strHTML = objRegExp.Replace(strHTML, vbLf)
objRegExp.Pattern = "&nbsp;</td>"
strHTML = objRegExp.Replace(strHTML, " ")
objRegExp.Pattern = "<[^>]*>"
strHTML = objRegExp.Replace(strHTML, "")
End If
End Sub
GetEquipmentList
FormatEquipmentList
AnsiNote vbLf & ANSI(32) & strHTML</send>
</alias>
</aliases>