inline-vbs 0.2.1

Embed VBScript code inside Rust
docs.rs failed to build inline-vbs-0.2.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

inline-vbs

inline-vbs is a crate that allows you to embed VBScript code inside Rust code files. It uses the Active Scripting COM APIs to dynamically parse and execute (optionally, evaluate) code.

Basic usage

use inline_vbs::*;

fn main() {
    vbs! { On Error Resume Next } // tired of handling errors?
    vbs! { MsgBox "Hello, world!" }
    let language = "VBScript";
    assert_eq!(vbs_!['language & " Rocks!"], "VBScript Rocks!".into());
}

Macros:

  • vbs! - Executes a statement or evaluates an expression (depending on context)
  • vbs_! - Evaluates an expression
  • vbs_raw! - Executes a statement (string input instead of tokens, use for multiline code) See more examples in tests/tests.rs

Installation

Add this to your Cargo.toml:

[dependencies]
inline-vbs = "0.2.1"

Important: You need to have the MSVC Build Tools installed on your computer, as required by cc.

Limitations

Many. Most notably, IDispatch objects (i.e. what CreateObject returns) can't be passed to the engine (let x = vbs! { CreateObject("WScript.Shell") }; vbs! { y = 'x } won't work).

Motivation

N/A

License

This project is licensed under either of