If (False) System_LaunchExternalProcess // This wrapper simplifies calling LAUNCH EXTERNAL PROCESS // and serves as a handy place for a few notes. For simple // default behavior, just pass in your statement in $1. The // other parmameters are used to change how LEP runs or // to return stdout and/or stderr. See notes below. End if C_TEXT($1;$command_text) C_BOOLEAN($2;$hide_console) C_BOOLEAN($3;$call_synchronously) C_POINTER($4;$stdout_pointer) // Pass a pointer to a text object if you want the contents of stdout. $call_synchronously or else the pointer is not used. C_POINTER($5;$stderr_pointer) // Same notes as for $stdout_pointer but applied to stderr. $command_text:=$1 If (False) // Put in a breakpoint above here and then drag the cursor in to copy the text out for review. // Sometimes it's very helpful to execute your built LEP code on the command line directly and // see what kind of output you get. SET TEXT TO PASTEBOARD($command_text) End if If ($command_text#"") $hide_console:=True If (Count parameters>=2) $hide_console:=$2 End if $call_synchronously:=True If (Count parameters>=3) $call_synchronously:=$3 End if Case of : ($call_synchronously=False) // stdout and stderr aren't available in this case. $stdout_pointer:=Pointer_GetNil $stderr_pointer:=Pointer_GetNil If (Count parameters>=4) // You could trace or log an error here. End if : (Count parameters>=5) // stdout and stderr $stdout_pointer:=$4 $stderr_pointer:=$5 : (Count parameters>=4) // just stdout $stdout_pointer:=$4 $stderr_pointer:=Pointer_GetNil End case C_TEXT($stdin;$stdout;$stderr) If (System_OnWindows ) // This is a Windows only setting. See // http://doc.4d.com/4D-Language-Reference-13.4/Tools/SET-ENVIRONMENT-VARIABLE.301-1218161.en.html If ($hide_console) // Do you want to see a DOS box on Windows? Probably not. SET ENVIRONMENT VARIABLE("_4D_OPTION_HIDE_CONSOLE";"true") Else SET ENVIRONMENT VARIABLE("_4D_OPTION_HIDE_CONSOLE";"false") End if End if End if If ($call_synchronously) // "Blocking" - set to True by default above unless you override in $3. SET ENVIRONMENT VARIABLE("_4D_OPTION_BLOCKING_EXTERNAL_PROCESS";"true") Else // Asynchronous, "non-blocking" Not sure if $stdout and $stderr get results. SET ENVIRONMENT VARIABLE("_4D_OPTION_BLOCKING_EXTERNAL_PROCESS";"false") End if LAUNCH EXTERNAL PROCESS($command_text;$stdin;$stdout;$stderr) If (False) // Sometimes it's easier to set a breakpoint and drag the curser into the assignment(s) below than to add $4 & $5 parameters. SET TEXT TO PASTEBOARD($stdout) SET TEXT TO PASTEBOARD($stderr) End if If (Not(Nil($stdout_pointer))) $stdout_pointer->:=$stdout End if If (Not(Nil($stderr_pointer))) $stderr_pointer->:=$stderr End if // End of method.