KM vs Node for local Javascript Apps

I plan to use Javascript to write some custom apps for automating searching the web and interacting with various websites

Increasingly I am starting to think of KM as a GUI-based coding environment

I am thus pondering if it is reasonable to use KM to host such Javascript apps rather than the traditional approach use Node and the Terminal in macOS - it seems much easier to test and store code snippets in KM than in a Linux environment and also easier to then integrate such code with other apps on my Mac. Am I correct? If so why is this not more popular as I rarely hear of KM used for that purpose.

Related question - if I want to use a Javascript framework such as JQuery to help with the coding, is there any way to access that from KM or do I then need to go the traditional Linux-oriented route?

I suppose it depends on your use case.

I use KM Execute a JavaScript in Browser actions a lot, mostly to do web scraping. I've posted many of those scripts/macros here.

Good question. You can easily use those frameworks, and any other remote scripts, in the Custom HTML Prompt action, but I'm not sure if they will work in the JS in Browser actions.

Maybe @peternlewis or others can comment on this.

Since KM doesn't behave the same way as browsers, I have abandoned KM's Custom HTML Prompt. Instead, I design HTML pages. In a KM macro, I have KM tell my browser to open a page (locally), whereupon I interact with the page, then the resultant values for variables are sent back to KM, the browser page is closed, and the KM macro proceeds with the variables.

2 Likes

@thoffman666 - If you use KM as you describe, can you use Jquery or other JS frameworks, or are you limited to vanilla Javascript?

Yes, I routinely use Jquery this way.

1 Like

If you are not using the KM HTML Prompt, how do you get data from KM Variables into and out of the local HTML page?

I posted an example back in May.

1 Like