npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@el3um4s/run-vbs

v1.1.2

Published

Run .vbs script with Node

Downloads

330

Readme

Node RunVbs

A simple package to run VBS scripts from NodeJs.

NPM link: @el3um4s/run-vbs

Install and use the package

To use the package in a project:

npm i @el3um4s/run-vbs

and then in a file:

import { runVbs, runVbsFile } from "@el3um4s/run-vbs";

const vbs = `Wscript.Echo "hello world"`;
const result = await runVbs({ vbs });
console.log(result); // hello world

const file = "./test.vbs";
const fromFile = await runVbsFile({ vbs: file });
console.log(fromFile); // hello world

API: runVbs

  • runVbs(data: { vbs: string; args?: string[]; }): Promise<string> Run a VBS script and return the result.
  • runVbsBuffer(data: { vbs: string; args?: string[]; }): Promise<string[]> Run a VBS script and return the result as a buffer.
import { runVbs } from "@el3um4s/run-vbs";

const vbs = `
set args = Wscript.Arguments

Dim name, surname

Dim count
count = WScript.arguments.count

if count = 0 then
    name = ""
    surname = ""
    Wscript.Echo "hello world"
end if

if count = 1 then
    name = args(0)
    surname = ""
    Wscript.Echo "hello" & " " & name & "!"
end if

if count = 2 then
    name = args(0)
    surname = args(1)
    Wscript.Echo "hello" & " " & name & " " & surname  & "!"
end if
`;

const result = await runVbs({
  vbs,
});
console.log(result); // hello world

const result2 = await runVbs({
  vbs,
  args: ["John", "Doe"],
});
console.log(result2); // hello John Doe!

API: runVbsFile

  • runVbsFile(data: { vbs: string; args?: string[]; }): Promise<string> Run a VBS script and return the result.
  • runVbsFileBuffer(data: { vbs: string; args?: string[]; }): Promise<string[]> Run a VBS script and return the result as a buffer.
import { runVbsFile } from "@el3um4s/run-vbs";

const result = await runVbsFile({
  vbs: "./src/__tests__/test_no_output.vbs",
});
console.log(result); // hello world

const result2 = await runVbsFile({
  vbs: "./src/__tests__/test_no_output.vbs",
  args: ["John", "Doe"],
});
console.log(result2); // hello John Doe!

Known Issues

There can be issues when the file path has a space.

Acknowledgments

To create this package I was inspired by: