1

I am new to this , trying to run electron app through cmd. I have .js file that runs the .exe file. I can see output in cmd terminal. Along with that I need to print those output in .html.

function coords() {

    var executablePath = "C:\\Users\\cal.exe";

    child(executablePath, function(err, data) {
        if(err){
            console.error(err);
            return;
      }

        console.log(data.toString());
        $("#resultpad").html("lat and long" +console.log()+ "cordinates");
  });
}

JavaScript Output from exe

"The value for number is: "

<h2> 
    JavaScript Display coordinates 
    Using console.log() 
</h2> 



<!-- Script to use console.log() -->
<script>

      console.log(data.toString());
</script> 

vardhan
  • 11
  • 2
  • How do you run the executable? Via childprocess in the main process? – Rhayene Mar 10 '20 at 12:51
  • Well, just looking at your code.. you need to put `data.toString()` into the `.html()` call. `console.log` prints something on the console. – snwflk Mar 10 '20 at 15:55
  • @Rhayene yes, I run the executable with childprocess.' var child = require('child_process').execFile; ' – vardhan Mar 11 '20 at 07:30

0 Answers0