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.
```rust use inline_vbs::*;
fn main() {
vbs! { On Error Resume Next } // tired of handling errors?
vbs! { MsgBox "Hello, world!" }
let language = "VBScript";
asserteq!(vbs!['language & " Rocks!"], "VBScript Rocks!".into());
}
``
Macros:
*
vbs!- Executes a statement or evaluates an expression (depending on context)
*
vbs!- Evaluates an expression
*
vbsraw!` - Executes a statement (string input instead of tokens, use for multiline code)
See more examples in tests/tests.rs
Add this to your Cargo.toml
:
toml
[dependencies]
inline-vbs = "0.2"
Important: You need to have the MSVC Build Tools installed on your computer, as required by cc.
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).
N/A
This project is licensed under either of * Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0) * MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT) at your option.