Is this possible with Electron


#1

At our company we currently use a piece of (buggy) software.

It is used to take results from other applications (the result is duration) and multiply this with the hourly rate,

I know that the latter is possible, I am interested in the first task. I’ve written out the current workflow.

The current app loads a xml file, in this xml the location of a 3D cad model is stored.

The current app opens a second application, and opens the 3D cad model. Then it performs a task, which results in a certain cycle time. After the task is complete, the cycle time is sent to the first application and the second application is closed.

Inside the first application, the cycle time is multiplied with the hourly rate.

I would like to know if the opening of another application and performing the task above, is something that can be done with Electron.

Thanks!


#2

Probably, but it depends on what the second application is and does. If the second app gives you the ability to replace the buggy app with a series of command line instructions input manually, then Electron can definitely automate that process. If the second app has a special way of receiving external instructions, and there’s a Node package for it, then Electron can definitely do it. If neither of those are true, then it’s a solid maybe.


#3

So are these the steps:

  1. open a file
  2. read the file
  3. open a second app that accepts the parameters (I’ll assume it’s the file name you pass).
  4. get a return value from the second app and it should close it’s self (or just close it from the first app)
  5. use the return value from the second app in some way.
    Not that I don’t believe Electron can do it - but why use Electron. I’d use Python.

#4

For people who have experience with JavaScript and no experience with either QT or TK (which is a lot of people), it’s easier to spin up a quick GUI in JS than Python. The down side of Electron is that you’re essentially installing Chrome just to automate a simple process, but the mitigating factor to that is the fact that computers today have ridiculous amounts of storage and memory to the point where you might not even notice the bloat.

Ease of use is definitely a point in favor of Electron. The barrier to entry for the developer is being able to write an interactive web page, but if the developer does it correctly, the barrier for a user is reduced to clicking on the app icon to open it. A seamless GUI is useful for processes that are going to be used by a bunch of different people, including potentially new hires who aren’t also developers. Python is better for people who are already Python people coding GUIs in Python. But outside of that circle, or people who aspire to be part of that circle, I think the positives for Electron outweigh the negatives.


#5

Hi guys,

Thanks for replying.

The process written out by johnf is almost correct;

  1. open a file
  2. read the file
  3. open a second app that accepts the parameters (I’ll assume it’s the file name you pass).
    4. Run a macro/script to start an action in the second app.
  4. get a return value from the second app and it should close it’s self (or just close it from the first app)
  5. use the return value from the second app in some way.

The reason for exploring is that I have experience with html and css, and limited experience with javascript, but none with Python. I feel that it would be easier (read quicker) for me to brush up my javascript than start learning Python.


#6

It may be that you under estimate yourself. Using python is easy and all the tools you’ll need are available on almost any platform. And I would suggest the learning curve would not be as steep. I.e. to shell out of python to run the second app and get the return is all done on a single line of code and within the same process. Unlike what I believe you would have to do with Electron.


#7

Node’s child_process module does indeed spawn a new process. The examples show more than one line of code, but if you really only need to do one thing with the results and like compact code, you can definitely fit it on two easily enough (one for require() and one for spawn()).

In this case, the difference in how well the languages do the job of shelling out isn’t large. Python is better, definitely, by a tiny bit in terms of code and a big bit in terms of performance. It’s still more difficult for a person who knows a little Python to write a simple GUI in Python than it is for a person who knows a little JavaScript to write a simple GUI in JS. onClick="", document.write(), and document.getElementById() are built into every browser and fundamental to what JS did before Node came in and made it possible for JS to do some of the same things Python does, almost as easily.

But this discussion is entirely irrelevant if it turns out that the second app isn’t able to be controlled from the shell.