Support forum
In VBScript, you can use 'WScript.Arguments' to get the arguments used when the script was called. For the VB.NET Scripting Connector script below, this would be:
If WScript.Arguments.Count >= 2 Then message = WScript.Arguments(1)
Regards, Henk
1:39 pm
Thanks Henk,
can u tell me,how to use VBScript in vb.net code,
as i am using vbscript file in vb.net code,requirement is like, after receiving SMS, want to pass "message" as an argument/variable to the vbScript.
Regards,
Surykant
Hello surikant,
For a simple VB.NET script that calls batch file 'C:\temp\test.bat' with the from address and the message text as the arguments, you can replace the 'OnMessageReceived' method of the default script VB.NET with the following code, you also have to add the line 'Imports System.Diagnostics' to the import list at the top of the script:
pdu As String, gateway As String, sendTime As DateTime, receiveTime As DateTime)
Try
Using proc As New Process
proc.StartInfo.FileName = "C:\temp\test.bat"
proc.StartInfo.Arguments = String.Format("""{0}"" ""{1}""", fromAddress, message)
proc.StartInfo.UseShellExecute = False
proc.StartInfo.RedirectStandardOutput = True
proc.StartInfo.CreateNoWindow = True
proc.Start()
Dim output As String = proc.StandardOutput.ReadToEnd()
End Using
Catch e As Exception
PostEventLog(e.Message, e.ToString(), EventLog.Error)
End try
End Sub
Regards, Henk
1 Guest(s)
Add Reply
Add Topic
Offline
Quote