Skip to content

Embed VBScript code inside Rust code files

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

zdimension/inline-vbs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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