Support forum
Hello Bruno,
Both methods you describe can be used to start a batch file or executable, but there are some points you should take into account that are specific to scripts in Diafaan SMS Server.
1. It is good practice to wrap all your code in a try..catch statements so that the script adds exception errors to the event log of Diafaan SMS Server:
System.Diagnostics.Process.Start(@"c:\temp\batchfilename.bat");
}
catch (Exception e) {
PostEventLog(e.Message, e.ToString(), EventLog.Error);
}
2. By default, the Diafaan SMS Server service runs under the local system account. This account has limited rights and it might not have the rights to start you batch file in the folder where you placed it. You can either place the batch file to a location where the local system account can use it or change the startup account for the service in the Service Control Manager to a(n) (administrator) user with more rights.
3. It is also possible that you batch file is called but that it cannot execute the batch commands, either because Diafaan SMS Server does not have the proper rights or because the environment parameters are incorrect. You can add re-directions for the output of the batch commands as debug statements to see if the commands are executed correctly. E.g.:
Regards, Henk
6:26 pm
Hi,
Its possible when i receive one message, the script connector runs a bat or exe file?
I trying some things, but not happens.
____________________________
I'm put the code in "OnMessageReceived",
__________________________
I'm try this:
string command = @"C:\My Dir\MyFile.exe";
Process process = new Process();
process.StartInfo.FileName = command;
process.Start();
_____________________________
And this:
System.Diagnostics.Process.Start("c:\\batchfilename.bat");
_____________________________
The code compile without errors, but the file not execute.
Do you have any suggestion to resolve this ?
thx.
Most Users Ever Online: 529
Currently Online:
6 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Member Stats:
Guest Posters: 671
Members: 0
Moderators: 0
Admins: 1
Forum Stats:
Groups: 2
Forums: 3
Topics: 1140
Posts: 3897
Newest Members:
, Henk HelmantelAdministrators: Henk Helmantel: 1487