![]() | ![]() |
|
01-28-2012 04:33 AM
Hi,
In v7 of Metastorm, I was able to execute a run command as follows:
%Run("FTP.EXE"," -s:C:\BATCH_FTP.SCR")
The .SCR file had all of the connection information as well as the file information that needed to be transferred.
In v9 I am sure something similar would be included, but I have been unable to find a similar Run command to perform this function.
Any information woudl be appreciated.
Thanks,
01-28-2012 06:23 AM
I'm no expert, but a quick search on Bing gives me:
string targetDir;
targetDir = string.Format(@"C:\Documents and Settings\mmeuse\Desktop\CallBatchFile\BatchFile");
p.StartInfo.UseShellExecute = true;
p.StartInfo.WorkingDirectory = targetDir;
p.StartInfo.FileName = "MyBatchFile.bat";
p.StartInfo.Arguments = string.Format("C-Sharp Console application");
p.StartInfo.CreateNoWindow = false;
p.Start();
p.WaitForExit();
01-30-2012 07:14 AM
I would avoid using a command shell unless you really have to.
For things like this I would use third-party components to add funtionality to a Metastorm solution. There are lots of good components available and you can probably get a suitable component for around $100. You'll get the advantage of tighter integration with your Metastorm solution and the option of catching errors and delaing with them gracefully.
01-30-2012 07:38 PM - last edited on 01-30-2012 07:50 PM
HI Rolandmac,
The closest thing to the %Run command in 9.x would be to start a new (.Net) Process in C# in a server side script. For example, this should do the same thing:
System.Diagnostics.Process ProcFtp = new System.Diagnostics.Process();
ProcFtp.StartInfo.FileName = "ftp.exe";
ProcFtp.StartInfo.Arguments = @"-s:C:\BATCH_FTP.SCR";
ProcFtp.Start();
I should mention that the best practice would be to write a server side script using the native .Net FTPWebRequest class as automating on the server is not recommended. If you choose to go this route, see this example, particularly the async() method: http://msdn.microsoft.com/en-us/library/system.net
Whatever you do, do not specify WaitForExit() on the ProcFtp or you will block execution of the running thread (the engine) until your file transfer is completed!
![]() |
![]() |
![]() |
|
|
![]() |
![]() |
![]() |
















