tried about ten variants found here but no success.
For example this code, I have "success" in the log but the command prompt windows does not appear. Where I'm wrong ?
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
Log("Hello world!!!")
Dim shl As Shell
shl.Initialize("shl","c:\windows\system32\cmd.exe",Null)
shl.Run(3000)
StartMessageLoop
End Sub
Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
If Success And ExitCode = 0 Then
Log("Success")
Else
Log("Error: " & StdErr)
End If
End Sub
Ah ... so the command prompt window does not appear ?
If I call a batch file I see nothing ?
If I call an exe that is a B4J Non-UI app packaged with B4J packager It is executed but I see nothing ? Any workaround in this case ?
BTW, always better to use Wait For when possible. This code will open a new console window.
B4X:
Sub AppStart (Args() As String)
Log("Hello world!!!")
DoSomething
StartMessageLoop
End Sub
Sub DoSomething
Dim shl As Shell
shl.Initialize("shl","c:\windows\system32\cmd.exe",Array("/c", "start"))
shl.Run(-1)
Wait For shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
If Success And ExitCode = 0 Then
Log("Success")
Else
Log("Error: " & StdErr)
End If
End Sub