obv-mikhail / InputBot

Rust library for creating global hotkeys, and simulating inputs
MIT License
421 stars 74 forks source link

Can't type the text #72

Closed IAFahim closed 1 year ago

IAFahim commented 1 year ago
use inputbot::{KeySequence};

fn main() {
    KeySequence("Hello, world!").send();
}
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
 Running `target\debug\office_owl.exe`

thread 'main' panicked at 'cannot transmute_copy if Dst is larger than Src', /rustc/69f9c33d71c871fc16ac445211281c6e7a340943\library\core\src\mem\mod.rs:1056:5 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\std\src\panicking.rs:575 1: core::panicking::panic_fmt at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library\core\src\panicking.rs:65 2: core::mem::transmute_copy<winapi::um::winuser::KEYBDINPUT,winapi::um::winuser::INPUT_u> at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943\library\core\src\mem\mod.rs:1056 3: inputbot::windows::send_keybd_input at C:\Users\Fahim.cargo\registry\src\github.com-1ecc6299db9ec823\inputbot-0.5.1\src\windows\mod.rs:215 4: enum2$::press at C:\Users\Fahim.cargo\registry\src\github.com-1ecc6299db9ec823\inputbot-0.5.1\src\windows\mod.rs:29 5: inputbot::public::KeySequence::send at C:\Users\Fahim.cargo\registry\src\github.com-1ecc6299db9ec823\inputbot-0.5.1\src\public.rs:217 6: office_owl::main at .\src\main.rs:4 7: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> > at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943\library\core\src\ops\function.rs:251 note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace. error: process didn't exit successfully: target\debug\office_owl.exe (exit code: 101)

Process finished with exit code 101

hb0nes commented 1 year ago

Same issue on Win11, tried version 0.5.0 and 0.5.1:

Clipboard contents:       KeySequence("bladiebla").send();

thread 'main' panicked at 'cannot transmute_copy if Dst is larger than Src', /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483\library\core\src\mem\mod.rs:1048:5
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\std\src\panicking.rs:575
   1: core::panicking::panic_fmt
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library\core\src\panicking.rs:64
   2: core::mem::transmute_copy<winapi::um::winuser::KEYBDINPUT,winapi::um::winuser::INPUT_u>
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483\library\core\src\mem\mod.rs:1048
   3: inputbot::windows::send_keybd_input
             at C:\Users\b0nes\.cargo\registry\src\github.com-1ecc6299db9ec823\inputbot-0.5.1\src\windows\mod.rs:215
   4: enum2$<inputbot::public::KeybdKey>::press
             at C:\Users\b0nes\.cargo\registry\src\github.com-1ecc6299db9ec823\inputbot-0.5.1\src\windows\mod.rs:29
   5: inputbot::public::KeySequence::send
             at C:\Users\b0nes\.cargo\registry\src\github.com-1ecc6299db9ec823\inputbot-0.5.1\src\public.rs:219
   6: rs_type_clipboard::main
             at .\src\main.rs:21
   7: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483\library\core\src\ops\function.rs:507
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\debug\rs-type-clipboard.exe` (exit code: 101)
hb0nes commented 1 year ago

Fixed by reading README properly:

[dependencies]
inputbot = { git = "https://github.com/obv-mikhail/InputBot", branch = "develop" }