I'm currently using it in conjunction with the Python fakemail.py script and a PHP unit test. The fake mail server is started before the tests are run and killed at the end in a very automated fashion.

Code: Select all
OpenConsole()
#kExit_Code_Error=1
#kExit_Code_Success=0
Procedure GetProcessId_(hProcess)
Static *pGetProcessId
If Not *pGetProcessId
*pGetProcessId=GetProcAddress_(GetModuleHandle_("kernel32.dll"),"GetProcessId")
EndIf
If Not *pGetProcessId
ProcedureReturn 0
EndIf
ProcedureReturn CallFunctionFast(*pGetProcessId,hProcess)
EndProcedure
Procedure RunProgram_(ProgramName.s, Parameter.s="", WorkingDirectory.s="", Visible=#SW_SHOW)
Protected ShellExInfo.SHELLEXECUTEINFO
ShellExInfo\cbSize=SizeOf(ShellExInfo)
ShellExInfo\fMask=#SEE_MASK_NOCLOSEPROCESS
ShellExInfo\lpVerb=@"Open"
ShellExInfo\lpFile=@ProgramName.s
ShellExInfo\lpParameters=@Parameter.s
ShellExInfo\lpDirectory=@WorkingDirectory.s
ShellExInfo\nShow=Visible
ShellExecuteEx_(@ShellExInfo)
ProcedureReturn GetProcessId_(ShellExInfo\hProcess)
EndProcedure
If Not CountProgramParameters()
End #kExit_Code_Success
EndIf
Path.s=ProgramParameter(0)
If CountProgramParameters()>1
For i=2 To CountProgramParameters()
If Params.s
Params.s+" "
EndIf
Params.s+ProgramParameter(i-1)
Next i
EndIf
ProgramId=RunProgram_(Path.s,Params.s,GetCurrentDirectory())
If ProgramId
PrintN(Str(ProgramId))
Else
End #kExit_Code_Error
EndIf
End #kExit_Code_Success