Support forum

Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

how to run .bat file in diafaan using
sp_NewPost Add Reply sp_NewTopic Add Topic
December 29, 2015
4:09 pm
Henk Helmantel
Forum Posts: 1502
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

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 >= 1 Then fromAddress = WScript.Arguments(0)
If WScript.Arguments.Count >= 2 Then message = WScript.Arguments(1)

Regards, Henk

December 29, 2015
1:39 pm

Thanks Henk,

can u tell me,how to use VBScript in code,

as i am using vbscript file in code,requirement is like, after receiving SMS, want to pass "message" as an argument/variable to the vbScript.


December 28, 2015
3:55 pm
Henk Helmantel
Forum Posts: 1502
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

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:

Private Sub OnMessageReceived(fromAddress As String, toAddress As String, message As String, messageType As String, messageId As String, smsc As String, _
pdu As String, gateway As String, sendTime As DateTime, receiveTime As DateTime)
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
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

December 28, 2015
7:02 am

how to run batch scripts in diaffan using connector or if any other way??

Forum Timezone: Europe/Amsterdam

Most Users Ever Online: 529

Currently Online:
14 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 677

Members: 0

Moderators: 0

Admins: 1

Forum Stats:

Groups: 2

Forums: 3

Topics: 1149

Posts: 3928

Newest Members:

, Henk Helmantel

Administrators: Henk Helmantel: 1502