Question about running a complex nodejs program in openbullet (v1/v2)

A solution for either Openbullet v1/v2 is fine. I’m looking to run this nodejs program in openbullet. It outputs a result using console.log in one of the functions. It contains many modules, and runs multiple JS files. When using it in node, all I need to do is open cmd and type “node start.js”. I’m not sure how to use this in openbullet and then parse the data written to the console. The program directory looks like this:

What I’ve tried:

  • Using the shell block, and pointing the executable parameter to a bat file that changes the directory to that of start.js, then runs it using “node start.js”.

  • Using the shell block, and pointing the executable to the location of cmd.exe, then the arguments as a bat file that changes the directory to that of start.js, then runs it using “node start.js”.

  • Copy and pasting all files into the directory, then copy pasting the entire start.js code into the NodeJS interpreter. I believe this isn’t working despite having the correct modules in the scripts folder because it has the line:

var script = ldr.runFile("./stuff.js", null, paramsStatic.url); // This incorporates another javascript file into the script

I’d appreciate some help! In OB1, I tried pointing the executable to cmd and then the arguments to the bat file, but it still didn’t work. Hoping that there’s a simple way to just do the equivalent of “node start.js” in cmd and then parse the console result that I’m missing

Have you tried this?

  executable = "C:\\Program Files\\nodejs\\node.exe"
  arguments = "C:\\myFile.js"
  => VAR @shellCommandOutput

Hey Ruri, I appreciate the response. However, there was sadly no luck. Screenshot by Lightshot

Node isn’t really like python where you can run files directly from node.exe (as you can with opening python.exe then typing, so I suspect that’s why it isn’t working. Even opening node.exe and normally and typing C:\Users\Administrator\Desktop\node\start.js doesn’t work normally, or even using the “Open with” feature on windows. Only way to get the script to run for me was to cd to the directory to where the program exists, then do “node start.js” in cmd.

i also have not much clue about node. But

maybe change the ./stuff.js to a absolute location where you put the stuff.js :man_shrugging:

Doesn’t seem to change anything. I also edited all the ./ lines in the code to contain the absolute location.

Bump! Hopefully someone can think of a solution.

Can you explain what ur scripts is for? I suspect start.js is for deploying and OB2s is jut interpreter like console in Dev Tools of Browsers, which means you cant use deploy functions there

It’s used for generating akamai sensor data and cookies for sites. Stuff.js is the script akamai uses which gets evaluated

Is ldr.runFile a function inside of the script you are using? I know its not a function from node directly.

Is it trying to spawn a child process and listen for a result from it?

I’m not sure how you are trying to get the results back from the script that ran but.

OpenBullet 2 doesn’t get and store any variables from inside console.log or anything related to console.

If you want to pass a result back to your main script you have to set it up using module.export.

Ill provide an example from a script I made.

The script inside of Openbullet looks like this.

const result = require('./test.js')

The script test.js contains this:

const variableName = 'Pure Was Here!'
module.exports = variableName

The result from ob is:

>> Script (InvokeNode) <<
Executed NodeJS script with result: {"result":"Pure Was Here!"}

I found this to be the best way to get variables or push variables to other scripts.

Running another script as a child process doesn’t appear to work when it comes to getting variables back.