Hello everyone,
I hope for your help with the following problem:
I am dynamically creating a batch file.
This batch file calls a SQLite database and creates a JSON file from any table.
I am now calling this batch file from B4J.
I have tried 2 variants for this call so far.
a) via the JShell library
b) via the JAWTRobot library
The calls to both libraries do not return an error.
But neither library leads to a result and no shell environment (cmd) is opened.
Calling the created batch file from Explorer works without problems and delivers the desired result.
The content of the batch file must be correct.
The following code:
Creating the batch file:
Calling via the JShell library:
and the event procedure:
Calling via the JAWTRobot library:
Is it perhaps a problem to call a batch file from B4J in general?
I really hope you can help me.
Thank you in advance for your effort.
I hope for your help with the following problem:
I am dynamically creating a batch file.
This batch file calls a SQLite database and creates a JSON file from any table.
I am now calling this batch file from B4J.
I have tried 2 variants for this call so far.
a) via the JShell library
b) via the JAWTRobot library
The calls to both libraries do not return an error.
But neither library leads to a result and no shell environment (cmd) is opened.
Calling the created batch file from Explorer works without problems and delivers the desired result.
The content of the batch file must be correct.
The following code:
Creating the batch file:
B4X:
Dim RString As String = "sqlite3 D:\B4A_Programs\Databases\d4h.sqlite" & " -cmd " & """.mode json""" & " -cmd " & """.once mytest.out""" & " -cmd " & """select * from glucose where datum like('10.10.%');"""
File.WriteString("D:\B4A_Programs\Databases\","tjson_1.bat",RString)
Dim mybatchfile As String = File.Combine("D:\B4A_Programs\Databases","tjson_1.bat")
Calling via the JShell library:
B4X:
shl as jshell
shl.Initialize("shl",mybatchfile , Null)
shl.Run(-1)
and the event procedure:
B4X:
Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log($"Success: ${Success},
Out: ${StdOut}
Error: ${StdErr}"$)
End Sub
Calling via the JAWTRobot library:
B4X:
Dim jawt As AWTRobot
Log(jawt.SystemRunCommand(mybatchfile ))
Is it perhaps a problem to call a batch file from B4J in general?
I really hope you can help me.
Thank you in advance for your effort.