inline-vbs

Crates.ioinline-vbs
lib.rsinline-vbs
version0.4.0
sourcesrc
created_at2022-03-01 16:54:22.800501
updated_at2023-04-29 12:54:32.720706
descriptionEmbed VBScript (and JScript, Ruby, Perl, ...) code inside Rust
homepagehttps://github.com/zdimension/inline-vbs
repositoryhttps://github.com/zdimension/inline-vbs
max_upload_size
id541659
size32,623
Tom Niget (zdimension)

documentation

https://docs.rs/inline-vbs

README

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

Commit count: 17

cargo fmt