Giter Club home page Giter Club logo

autopilot-deno's People

Contributors

justjavac avatar littledivy avatar maximousblk avatar tionis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

autopilot-deno's Issues

Linux: Window Management

Introduce cross-platform window management in AutoPilot.

On linux, wmctrl bindings can be used.
This issue will be for discussion on implementing this on Windows and Mac.

Ref: #14

Property 'openPlugin' does not exist on type 'typeof Deno'

From #3,
This issue is for reference to the error above.

FIX:
The --unstable --allow-plugin flags are probably missing.

So the full command will be,
deno run --unstable --allow-net --allow-plugin --allow-env --allow-read --allow-write file.ts

Fatal Runtime Error

After following the fixes from #3 I get rust panic with following stacktrace:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Error("invalid type: null, expected f64", line: 1, column: 9)', src/lib.rs:108:34
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1063
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:470
  11: rust_begin_unwind
             at src/libstd/panicking.rs:378
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  13: core::option::expect_none_failed
             at src/libcore/option.rs:1211
  14: core::result::Result<T,E>::unwrap
             at /rustc/8d69840ab92ea7f4d323420088dd8c9775f180cd/src/libcore/result.rs:1003
  15: autopilot_deno::op_move_mouse
             at src/lib.rs:108
  16: <deno::ops::plugin::PluginInterface as deno_core::plugin_api::Interface>::register_op::{{closure}}
  17: deno_core::isolate::CoreIsolate::dispatch_op
  18: deno_core::bindings::send
  19: <extern "C" fn(A0) .> R as rusty_v8::support::CFnFrom<F>>::mapping::c_fn
  20: _ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE
  21: _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16BuiltinArgumentsE
  22: _ZN2v88internalL26Builtin_Impl_HandleApiCallENS0_16BuiltinArgumentsEPNS0_7IsolateE
  23: Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
fatal runtime error: failed to initiate panic, error 5
Aborted (core dumped)

`Uncaught SyntaxError: Identifier 'path1' has already been declared` when running bundled/compiled code (upstream)

Create the file test.js with:

import AutoPilot from "https://deno.land/x/autopilot/mod.ts";

const pilot = new AutoPilot();

Run this:

deno run -A --unstable test.js

Output should be nothing, everything's fine. Now run this:

deno bundle --unstable test.js test.bundle.js

And then this:

deno run -A --unstable test.bundle.js

Output will be:

error: Uncaught SyntaxError: Identifier 'path1' has already been declared
function path1(url, ns) {
^
    at <anonymous> (file:///path/to/test.bundle.js:1723:1)

Can't type single quote symbol

I can't write a text that contains a single quote symbol, ie: "I don't understand"

Steps to reproduce the behavior:

import AutoPilot from 'https://deno.land/x/[email protected]/mod.ts';

const pilot = new AutoPilot();
await pilot.type("I don't understand");

Expected behavior
Auto typing text I don't understand

Screenshots
image

Desktop:

  • OS: Ubuntu 20.10 (Groovy Gorilla)

Mouse move speed is ignored and defaults to 10

Hey there.
I was trying to speed up the mouse move, and tried using 0.1, 1 and 20 to test out which is the fastest, but all of them are equal and in console, d always appears as 10 (that's a bit of another issue - mouseMove always logs it's params, but it's not as bad as this).

FFI

Plugins are dead. We need to move to FFI once passing buffer support is added. This module should still work up until Deno 1.12.2

Demo?

I'd love to see a simple YouTube demo of Autopiilot. With this native I/O and ability to capture bitmap, how hard would it be to manipulate the screen bitmap to build a mini 'Electron'?

Cross: nothing happens for some programs

deno --version

deno 1.0.5
v8 8.4.300
typescript 3.9.2

(I like this lib, thank you for building it)

I noticed when I tried to use .tap or .type nothing happens for some programs.

For example:

  • .tap: IE and Firefox get into full screen mode with f11 or open the dev console with f12 but it's not triggered with autopilot. Whereas F12 triggers the definition search on VS Code.

  • .type: trying to add some text into a login field or a chat field in a game like lineage2 doesn't show anything but it works with the browser search bar or a terminal.

Are there some known limitation or is that a bug?

Hotkey support

Is your feature request related to a problem? Please describe.
I can't switch between two windows, switch language or doing anything using hotkeys.

Describe the solution you'd like
add hotkey method like pyautogui hotkey('alt', 'tab').

Segmentation fault when running on Mac

deno run --allow-env --allow-write --allow-read --allow-net --unstable --allow-plugin --reload autopilot.ts
Compile file:///Users/samuelteixeira/Documents/deno/autopilot.ts
Download https://raw.githubusercontent.com/divy-work/autopilot-deno/master/mod.ts
Download https://raw.githubusercontent.com/divy-work/autopilot-deno/master/plugin/index.js
Download https://raw.githubusercontent.com/divy-work/autopilot-deno/master/types.ts
Download https://raw.githubusercontent.com/manyuanrong/deno-plugin-prepare/master/mod.ts
Compile https://raw.githubusercontent.com/manyuanrong/deno-plugin-prepare/master/mod.ts
Download https://raw.githubusercontent.com/manyuanrong/deno-plugin-prepare/master/deps.ts
Download https://deno.land/[email protected]/fs/exists.ts
Download https://deno.land/x/[email protected]/mod.ts
Download https://deno.land/x/[email protected]/hash.ts
Download https://deno.land/x/[email protected]/sha1.ts
Download https://deno.land/x/[email protected]/md5.ts
Download https://deno.land/[email protected]/log/mod.ts
Download https://deno.land/[email protected]/path/mod.ts
Compile https://deno.land/[email protected]/log/mod.ts
Download https://deno.land/[email protected]/log/logger.ts
Download https://deno.land/[email protected]/log/handlers.ts
Download https://deno.land/[email protected]/testing/asserts.ts
Download https://deno.land/[email protected]/log/levels.ts
Download https://deno.land/[email protected]/log/levels.ts
Download https://deno.land/[email protected]/fmt/colors.ts
Download https://deno.land/[email protected]/testing/diff.ts
Compile https://deno.land/[email protected]/path/mod.ts
Download https://deno.land/[email protected]/path/win32.ts
Download https://deno.land/[email protected]/path/posix.ts
Download https://deno.land/[email protected]/path/common.ts
Download https://deno.land/[email protected]/path/separator.ts
Download https://deno.land/[email protected]/path/interface.ts
Download https://deno.land/[email protected]/path/glob.ts
Download https://deno.land/[email protected]/path/_constants.ts
Download https://deno.land/[email protected]/path/_util.ts
Download https://deno.land/[email protected]/path/_globrex.ts
INFO downloading deno plugin "autopilot_deno" from "https://github.com/divy-work/autopilot-deno/releases/latest/download/libautopilot_deno.dylib"
INFO load deno plugin "autopilot_deno" from local "/Users/samuelteixeira/Documents/deno/.deno_plugins/autopilot_deno_5a886ecea39dcd1615a56a8f3ea30d0f.dylib"
Segmentation fault: 11

My mac: Mojave version 10.14.6

Documentation: Clarify Keymap

At the current state of the documentation it is unclear what strings to specify to address specific keys. Does this follow the same standard as xmodmap, how to specify only one key (e.g. w) to toggle.

Doesn't work in Deno 1.4.1

Running the example code with the latest version of Autopilot and Deno produces this error:

error: TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Prefix } from './lib/prefix/Prefix.ts'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/[email protected]/src/types.ts:9:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Metadata } from "./file.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/[email protected]/file_fetcher.ts:3:1

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { File, Policy, Origin, RELOAD_POLICY };
         ~~~~
    at https://deno.land/x/[email protected]/cache.ts:6:10

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { File, Policy, Origin, RELOAD_POLICY };
               ~~~~~~
    at https://deno.land/x/[email protected]/cache.ts:6:16

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Mark } from "./mark.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/error.ts:6:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { ArrayObject, Any } from "./utils.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/type.ts:6:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { KindType, Type } from "./type.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/schema.ts:7:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { ArrayObject, Any } from "./utils.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/schema.ts:8:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Any } from "../utils.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/type/binary.ts:6:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Any } from "../utils.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/type/map.ts:7:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Any } from "../utils.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/type/omap.ts:7:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Any } from "../utils.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/type/pairs.ts:7:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Any } from "../utils.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/type/seq.ts:7:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Any } from "../utils.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/type/set.ts:7:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { SchemaDefinition } from "./schema.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/state.ts:6:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { YAMLError } from "../error.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/loader/loader_state.ts:6:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Schema, SchemaDefinition, TypeMap } from "../schema.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/loader/loader_state.ts:7:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Type } from "../type.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/loader/loader_state.ts:9:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Any, ArrayObject } from "../utils.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/loader/loader_state.ts:10:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Type } from "../type.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/loader/loader.ts:10:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { LoaderStateOptions } from "./loader/loader_state.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/parse.ts:7:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Schema, SchemaDefinition } from "../schema.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/dumper/dumper_state.ts:6:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { StyleVariant, Type } from "../type.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/dumper/dumper_state.ts:8:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { ArrayObject, Any } from "../utils.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/dumper/dumper_state.ts:9:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { RepresentFn, StyleVariant, Type } from "../type.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/dumper/dumper.ts:9:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { DumperStateOptions } from "./dumper/dumper_state.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/_yaml/stringify.ts:7:1

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { ParseOptions, parse, parseAll } from "./_yaml/parse.ts";
         ~~~~~~~~~~~~
    at https://deno.land/std/encoding/yaml.ts:6:10

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
  DumpOptions as StringifyOptions,
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/yaml.ts:8:3

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { SchemaDefinition } from "./_yaml/schema.ts";
         ~~~~~~~~~~~~~~~~
    at https://deno.land/std/encoding/yaml.ts:11:10

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { StyleVariant } from "./_yaml/type.ts";
         ~~~~~~~~~~~~
    at https://deno.land/std/encoding/yaml.ts:12:10

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import {
^
    at https://deno.land/x/[email protected]/autopilot_deno/autopilot.ts:24:1

Found 31 errors.

CACHE env var is ignored

Describe the bug
The line here will always produce checkCache: true ignoring whether the CACHE env var was set or not
https://github.com/divy-work/autopilot-deno/blob/a091c759a0a1857664727a79ba1e27fcfcc3b42f/plugin/index.ts#L27

To Reproduce
Use the plugin out of dev mode

Expected behavior
Take the CACHE env variable into account

Screenshots
N/A

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context
Not sure if that was intentional, but I thought I'd point it out.

keyboard && mouse listener

I have been looking for a library that can monitor keyboard and mouse events globally. Unfortunately, robotjs in nodejs only supports input and does not support monitoring.
Hope you can achieve this feature.

Benchmarks should be fair

So currently we have a cute benchmarking system. Simply, run the method and calculate the time taken.

The problem:
Some methods like alert are only completed when the user clicks Ok...which is expected in real life scenario but that disrupts the benchmarks by many milliseconds/secs!

We need to come up with another op that mocks the alert methods the closest way possible.

Can't start autopilot under windows

On windows:
I run this

import AutoPilot from 'https://raw.githubusercontent.com/divy-work/autopilot-deno/master/mod.ts';

var pilot = new AutoPilot();

But I got an error:

PS C:\Users\IEUser\Downloads> deno run --unstable  -A .\autopilot.ts
Compile file:///C:/Users/IEUser/Downloads/autopilot.ts
[2020-06-12T10:47:35.601Z INFO] Downloading latest Autopilot release from Github
INFO loading autopilot plugin "autopilot_deno" from local "C:\Users\IEUser\Downloads\.autopilot_plugin\autopilot_deno_01d30cec9d205cfbaac871ba17c0ba9e.dll"
error: Uncaught Error: The specified module could not be found. (os error 126)
    at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
    at Object.sendSync ($deno$/ops/dispatch_json.ts:72:10)
    at Object.openPlugin ($deno$/ops/plugins.ts:4:15)
    at prepare (https://raw.githubusercontent.com/divy-work/autopilot-plugin-prepare/master/mod.ts:66:15)
    at async https://raw.githubusercontent.com/divy-work/autopilot-deno/master/plugin/index.ts:26:20

My setup:
PS C:\Users\IEUser\Downloads> deno --version deno 1.0.5 v8 8.4.300 typescript 3.9.2

Writing Deno Plugins

Hey there!
I'm new to deno, but I'm really interested in it.
I couldn't find any help about importing deno plugins, and the only lib I found (https://deno.land/x/plugin_prepare/mod.ts) doesn't work since there's no Deno.openPlugin.

Can you tell me how to import the plugin to use this lib? Thanks!

Error at importing Autopilot with M1 Mac

file:

//autopilot1.dn.js
import * as autopilot from "https://deno.land/x/[email protected]/mod.ts";

when I run this:

% deno --unstable run --allow-ffi --allow-env --allow-read autopilot1.dn.js
error: Uncaught (in promise) TypeError: Error parsing args at position 0: data did not match any variant of untagged enum ForeignSymbol
  return Deno.dlopen(file.path, symbols);
              ^
    at new DynamicLibrary (deno:ext/ffi/00_ffi.js:286:39)
    at Object.dlopen (deno:ext/ffi/00_ffi.js:390:12)
    at Module.prepare (https://deno.land/x/[email protected]/plug.ts:77:15)
    at async https://deno.land/x/[email protected]/bindings/bindings.ts:8:14
  • Device: Mac mini (M1, 2020)
  • OS: MacOS Monterey 12.5
  • Deno 12.4.3
  • Autopilot 0.4.0

Note

According to README.md, the command should be:

% deno run --unstable --allow-ffi autopilot1.dn.js

Though, Deno.dlopen isn't defined when I put --unstable after run.
When I just put --unstable before run, that requests:

  • env access to "DENO_DIR"
  • env access to "HOME"
  • read access to "~/Library/Caches/deno/plug/https/github.com/c7ce6d2dafee0de7e635a6112ad5903d788bace477d867b0a342e540acf23633.dylib"
  • read access to "~/Library/Caches/deno/plug/https/github.com"

And when I arrow all of these, same error causes as with --allow-env --allow-read.

Windows: getMonitors() return value

Firstly, cool work! I had a quick look into the 'Writing Deno Plugins' issue, and it sounds like everything works really nicely together.

Describe the bug
Played around with printing some of the return values. getMonitors() returned 1 but I have 2 monitors. small thing. No idea how, or where, or why. Can test later if you wish.

To Reproduce

  1. console.log(pilot.getMonitors())
  2. See 1 instead of 2

Expected behavior
Expected 2 got 1.

Desktop (please complete the following information):

  • OS: Windows

Modifier keys don't really seem to work

Description

Modifier keys don't really work like they should on MacOS. Maybe this is only an issue with MacOS Monterey, I don't think it is though. I can't really "describe" the bug in detail because I have no clue what's really going on. All I know is that using toggleKey and then type with a single letter really just inserts that letter as text and autopilot will completely ignore that modifier keys are ignored. However, I can compare autopilot's behaviour with cliclick's.

Reproduce

  1. Go to https://w3c.github.io/uievents/tools/key-event-viewer.html
  2. Run this:
    deno repl --no-check --unstable
  3. Then enter this and press enter:
    import AutoPilot from "https://deno.land/x/autopilot/mod.ts";
    
    const sleep = async (milliseconds) => new Promise(resolve => setTimeout(resolve, milliseconds));
    
    await sleep(5000);
    
    await pilot.toggleKey("meta", true);
    await pilot.toggleKey("shift", true);
    await pilot.type("g");
    await pilot.toggleKey("meta", false);
    await pilot.toggleKey("shift", false);
  4. You now have five seconds to switch to your browser again and click on that input field.
  5. This is the result:
    Bildschirmfoto 2021-12-13 um 06 40 55
  6. Install cliclick and run this, then click on the input field on the website again:
    cliclick w:5000 kd:cmd,shift t:g ku:cmd,shift
  7. This is the result:
    Bildschirmfoto 2021-12-13 um 06 55 34

Expected Behaviour

While modifier keys somehow work individually, they don't work like expected in most cases I experienced. For example, all hotkey combinations that include a modifier key and any ordinary letter, like the typical +C to copy, just don't work in my experience. To give you one more example, on MacOS, whenever an "open file" dialog is present, you can use ++G to open a textbox allowing you to enter the path to a folder. Using cliclick for this just works, while autopilot doesn't, and instead just presses G.

Desktop

  • OS: MacOS Montery 12.1 Beta (21C5045a)
  • Browser Chrome
  • Version 0.4.0

Additional context

Going through the issues of this repository, I assume the root of this issue going unnoticed is toggleKey only allowing specific keys for some reason. Looks like up until version 0.4.0, hotkey stuff did work, by using toggleKey. Note that I haven't found any evidence of the combination toggleKey(modifier, true); type(letter); toggleKey(modifier, false); ever working. If one uses ordinary letters with toggleKey today, everything crashes and rust panicks:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Error("unknown variant `c`, expected one of `f1`, `f2`, `f3`, `f4`, `f5`, `f6`, `f7`, `f8`, `f9`, `f10`, `f11`, `f12`, `f13`, `f14`, `f15`, `f16`, `f17`, `f18`, `f19`, `f20`, `f21`, `f22`, `f23`, `f24`, `leftarrow`, `uparrow`, `rightarrow`, `downarrow`, `insert`, `delete`, `home`, `end`, `pageup`, `pagedown`, `tab`, `backspace`, `enter`, `escape`, `space`, `meta`, `alt`, `control`, `shift`, `capslock`", line: 1, column: 10)', src/lib.rs:122:1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5

Backtrace with RUST_BACKTRACE=1:

stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: _toggle_key
   4: _ffi_call_unix64
   5: _ffi_call_int
   6: deno_ffi::ffi_call
   7: deno_core::ops_json::op_sync::{{closure}}
   8: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
   9: deno_core::ops::OpTable::route_op
  10: <extern "C" fn(A0) .> R as v8::support::CFnFrom<F>>::mapping::c_fn
  11: __ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE
  12: __ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16BuiltinArgumentsE
  13: __ZN2v88internalL26Builtin_Impl_HandleApiCallENS0_16BuiltinArgumentsEPNS0_7IsolateE
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
fatal runtime error: failed to initiate panic, error 5

Backtrace with RUST_BACKTRACE=full:

stack backtrace:
   0:        0x1144675d1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hec762383110a7685
   1:        0x11447f3bb - core::fmt::write::h2d5ecb4b9764759c
   2:        0x114465c0a - std::io::Write::write_fmt::h9d7d3ae333151289
   3:        0x114468805 - std::panicking::default_hook::{{closure}}::h552de0233eed7dab
   4:        0x1144683ef - std::panicking::default_hook::hf4e8e1e5a5c43b90
   5:        0x114468ef0 - std::panicking::rust_panic_with_hook::h7c7e0153f3e14d6b
   6:        0x11446898e - std::panicking::begin_panic_handler::{{closure}}::h3c7f7ffd2b05c635
   7:        0x114467a47 - std::sys_common::backtrace::__rust_end_short_backtrace::h3bdf4f6c89eee6ea
   8:        0x1144688fa - _rust_begin_unwind
   9:        0x114489d6f - core::panicking::panic_fmt::h88a1b6fbb9084d2c
  10:        0x114489e55 - core::result::unwrap_failed::h8abe20a396a5e82a
  11:        0x114403a35 - _toggle_key
  12:        0x1100571e2 - _ffi_call_unix64
  13:        0x110056c35 - _ffi_call_int
  14:        0x10f6eff40 - deno_ffi::ffi_call::h7b8d00a17ac9084e
  15:        0x10f9613b3 - deno_core::ops_json::op_sync::{{closure}}::h2dff410c79672602
  16:        0x10f67b81f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hd8d69a3a2de8f014
  17:        0x10f67074c - deno_core::ops::OpTable::route_op::h86ef2e6087baaab6
  18:        0x10f682a8c - <extern "C" fn(A0) .> R as v8::support::CFnFrom<F>>::mapping::c_fn::hfa3b6c5b5cdbaae7
  19:        0x1101345d5 - __ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE
  20:        0x110133bc1 - __ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16BuiltinArgumentsE
  21:        0x11013312e - __ZN2v88internalL26Builtin_Impl_HandleApiCallENS0_16BuiltinArgumentsEPNS0_7IsolateE
fatal runtime error: failed to initiate panic, error 5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.