Skip to content

Latest commit

 

History

History
60 lines (46 loc) · 2.33 KB

README.md

File metadata and controls

60 lines (46 loc) · 2.33 KB

inline-vbs

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

image

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.4.0"

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

Language support

VBScript (vbs!) and JScript (js!) are available out of the box on 32-bit and 64-bit.

Other Active Scripting engines exist:

Note: install an engine matching the bitness of your program; by default Rust on Windows builds 64-bit programs, which can only use 64-bit libraries. If you want to use a 32-bit library, you need to build your program with --target i686-pc-windows-msvc.

Limitations

Many.

Motivation

N/A

License

This project is licensed under either of