Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    yb3616
    @yb3616
    Is there anything like "mouse up" and "mouse down" events ?
    吴彬彬
    @wuyueCreator

    For the hotkey monitoring implementation I want to use goroutine+AddEvents/AddEvent

    Example code:

    package main
    
    import (
        "fmt"
        "github.com/go-vgo/robotgo"
        "time"
    )
    
    func main() {
        go addKeysListen("q", "ctrl")
        go addKeyListen("k")
        for {
            // do something
            time.Sleep(time.Millisecond * 50)
        }
    }
    
    func addKeysListen(key string, arr ...string) {
        for {
            if ok := robotgo.AddEvents(key, arr...); ok {
                fmt.Println("pressed Ctrl + q")
            }
        }
    }
    
    func addKeyListen(key string) {
        for {
            if ok := robotgo.AddEvent(key); ok {
                fmt.Println("Pressed k")
            }
        }
    }

    If I only listen to a hotkey, it is ok, but more than one will fail.
    Can you change the underlying code to support this type of writing? Or has a more elegant solution?

    github:clipboard recorder.

    Cauê Felchar
    @cauefcr
    i recomend everyone to use the async event listener and do some switches instead of the addevent interface, it's more elegant and feature-full
    Lansana Camara
    @lansana
    How can I specify a tolerance for Bitmap?
    Everything I try fails with a panic
    Carlos Armando
    @InfeCtlll3
    hey, is there a way to convert from[]byte to C.MMBitmapRef ?
    Aquarian-Age
    @Aquarian-Age
    go get -u -v github.com/go-vgo/robotgo
    github.com/go-vgo/robotgo (download)
    github.com/go-vgo/robotgo/vendor/github.com/robotn/gohook
    # github.com/go-vgo/robotgo/vendor/github.com/robotn/gohook
    In file included from ./event/pub.h:20:0,
    from ./event/goEvent.h:18,
    from go_work/src/github.com/go-vgo/robotgo/vendor/github.com/robotn/gohook/hook.go:22:
    ./event/../hook/x11/input_c.h:39:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory
    #include <xkbcommon/xkbcommon.h>
    ^~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    ---+------------------------------+-----------------------------------------------------+---------
    | libxkbcommon | Library for handling xkb descriptions | 源代码包
    i+ | libxkbcommon-devel | Development files for the libxkbcommon library | 软件包
    | libxkbcommon-devel-32bit | Development files for the libxkbcommon library | 软件包
    i+ | libxkbcommon-x11-0 | Library for handling xkb descriptions using XKB-X11 | 软件包
    i+ | libxkbcommon-x11-0-32bit | Library for handling xkb descriptions using XKB-X11 | 软件包
    i+ | libxkbcommon-x11-devel | Development files for the libxkbcommon-x11 library | 软件包
    | libxkbcommon-x11-devel-32bit | Development files for the libxkbcommon-x11 library | 软件包
    i+ | libxkbcommon0 | Library for handling xkb descriptions | 软件包
    i+ | libxkbcommon0-32bit | Library for handling xkb descriptions | 软件包
    ~
    EnochTheWise
    @EnochTheWise
    Hi, i have cross compilation error:
    $ GOOS=windows GOARCH=386 go build -o sendkey.exe sendkey.go
    # github.com/go-vgo/robotgo
    ../../github.com/go-vgo/robotgo/keycode.go:14:16: undefined: Map
    ../../github.com/go-vgo/robotgo/keycode.go:25:15: undefined: Map
    ../../github.com/go-vgo/robotgo/robotgo_mac_win.go:22:9: undefined: internalGetBounds
    ../../github.com/go-vgo/robotgo/robotgo_mac_win.go:31:12: undefined: cgetTitle
    ../../github.com/go-vgo/robotgo/robotgo_mac_win.go:45:2: undefined: internalActive

    How can i fix it?

    Code:

    ```
    package main

    import (
    "fmt"
    "os"
    "os/signal"
    "syscall"
    "time"
    "math/rand"
    "github.com/go-vgo/robotgo"
    )

    // SetupCloseHandler creates a 'listener' on a new goroutine which will notify the
    // program if it receives an interrupt from the OS. We then handle this by calling
    // our clean up procedure and exiting the program.
    func SetupCloseHandler() {
    c := make(chan os.Signal, 2)
    signal.Notify(c, os.Interrupt, syscall.SIGTERM)
    go func() {
    <-c
    fmt.Println("\r- Ctrl+C pressed in Terminal")
    os.Exit(0)
    }()
    }

    func main() {
    // Setup our Ctrl+C handler
    SetupCloseHandler()

    fmt.Println("\r- Press Ctrl+C to interrupt")

    // Run our program...
    for {
    rand.Seed(time.Now().UnixNano())
    min := 120
    max := 480
    sleep_secs := rand.Intn(max - min + 1) + min

    fmt.Println("\r- Type key and sleep: ", sleep_secs, "sec's")
    robotgo.ActiveName("KWrite")
    robotgo.TypeString("Hello World")
    robotgo.KeyTap("space")
    time.Sleep(time.Duration(sleep_secs) * time.Second)
    }
    }
    ```
    Cauê Felchar
    @cauefcr
    hello everyone
    can i use the guntest.heroku.com/gun for some simple chat application?
    wrong channel, oops
    Aaron N. Brock
    @AaronNBrock
    Hey, is it possible to cancel a key-press event for a given event? I.e. when i is pressed, move the mouse and don't type i.
    西行寺幽幽子
    @SaigyoujiYuyuko233
    Hi everyone, May someone help me about a problem?
    go: downloading....
    go-vgo/robotgo@v0.90.2/hook.go:30:24: undefined: hook.Event
    go-vgo/robotgo@v0.90.2/hook.go:31:9: undefined: hook.Start
    go-vgo/robotgo@v0.90.2/hook.go:36:2: undefined: hook.End
    go-vgo/robotgo@v0.90.2/hook.go:40:31: undefined: hook.Event
    go-vgo/robotgo@v0.90.2/hook.go:41:9: undefined: hook.Process
    go-vgo/robotgo@v0.90.2/hook.go:45:64: undefined: hook.Event
    go-vgo/robotgo@v0.90.2/hook.go:46:2: undefined: hook.Register
    go-vgo/robotgo@v0.90.2/hook.go:77:10: undefined: hook.AddEvent
    go-vgo/robotgo@v0.90.2/hook.go:89:2: undefined: hook.StopEvent
    go-vgo/robotgo@v0.90.2/hook.go:94:19: undefined: hook.Event
    go-vgo/robotgo@v0.90.2/hook.go:89:2: too many errors
    Env:
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=E:/TDM-GCC-64/bin/../libexec/gcc/x86_64-w64-mingw32/5.1.0/lto-wrapper.exe
    Target: x86_64-w64-mingw32
    Configured with: ../../../src/gcc-5.1.0/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs
    Thread model: posix
    gcc version 5.1.0 (tdm64-1)
    go version go1.14.2 windows/amd64
    Silvio Lucas Pereira Filho
    @slpereira
    Hi Guys, how can I capture all inputs available in a screen or window?
    Walker de Alencar Oliveira
    @walkeralencar
    @slpereira ai tu quer fazer um Keylogger, nao uma automação...
    Hey gents, I've get some issues with hooks, have any documentation that i can understand better how it works. some times, when I press the specified key, the callback function repeat forever.;
    Eric L'Hostis
    @elhostis_twitter
    @SaigyoujiYuyuko233 , I had the same issue. You need to define the compilator.
    GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -x ./
    Then you'll probably have problem with the mingw. So install it : sudo apt-get install mingw-w64
    At last, you'll have problem with zlib.h. So install the dev version : sudo apt install libz-mingw-w64-dev
    (tried on Ubuntu 18.04)
    西行寺幽幽子
    @SaigyoujiYuyuko233
    @elhostis_twitter Thanks! I'll try your solution later!
    Walker de Alencar Oliveira
    @walkeralencar

    GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -x ./

    not worked for me, returns error 0xc000007b

    image.png
    go-vgo/robotgo#228
    I've documented what worked for me.
    Merritt
    @Merrit
    I can't seem to get single keys working as needed for a global hotkey. AddEvent only fires once, I need it to keep working. EventHook works with the example, 'w', and keeps firing. However if I try something different like "pause", "pause/break", or maybe "home" it fires on many keypresses like Tab, backspace, enter, and normal letters. How can I get this to work with, for example, the pause/break key?
    DocDrydenn
    @DocDrydenn
    Code works perfectly locally, however, over a remote connection (like SSH), I get nadda. Coding on a basic Ubuntu install. I've tried via MobaXterm, Putty, Windows CMD, etc... All give same results. Am I just missing something simple? (specifically talking about the KeyTaps i.e. robotgo.KeyTap("lctrl", "a"))
    Victor
    @MetalBlueberry
    Hello all, I wonder if it is possible to prevent an event hook captured with robotgo.EventHook from interacting with the system. For example, to change the key J to act as ESC. The system must only see a keypress like if ESC has been pressed.
    I've managed to do something similar on Linux devices by using evdev.Grab()
    Bird
    @Bird-Kid
    +1 re capturing & preventing event hooks. @MetalBlueberry did you have any luck by any chance?
    Victor
    @MetalBlueberry

    +1 re capturing & preventing event hooks. @MetalBlueberry did you have any luck by any chance?

    nope, I'm using golang-evdev package as an alternative,but it only works on Linux. My project is a programmable keyboard https://github.com/MetalBlueberry/chkb

    Logan
    @xackery
    Since gitter doesn't let me search I can't verify already noted, but the intro message "RobotGo, Go Native cross-platform GUI automation" the "Go native" part is not correct. With 87.0% of the codebase in C, it is far from go native. The requirements in CGO and headaches with crosspiling is all signs it isn't a native go solution.
    Onns
    @onns
    Hey, I wanna help to complete the doc of Chinese version, so which instruction should I follow?
    falsechicken
    @falsechicken:chickensnest.us
    [m]

    Hey everyone. Can robotgo be built for arm? I am trying to cross compile but I am getting errors. Works fine if I just run "go build ." without cross compilng.

    GOOS=linux GOARCH=arm go build . 
    
    # github.com/go-vgo/robotgo
    
    ../../../github.com/go-vgo/robotgo/hook.go:30:24: undefined: hook.Event
    ../../../github.com/go-vgo/robotgo/hook.go:31:9: undefined: hook.Start
    ../../../github.com/go-vgo/robotgo/hook.go:36:2: undefined: hook.End
    ../../../github.com/go-vgo/robotgo/hook.go:41:19: undefined: hook.Event
    ../../../github.com/go-vgo/robotgo/hook.go:42:9: undefined: hook.Start
    ../../../github.com/go-vgo/robotgo/hook.go:47:2: undefined: hook.End
    ../../../github.com/go-vgo/robotgo/hook.go:52:2: undefined: hook.StopEvent
    ../../../github.com/go-vgo/robotgo/hook.go:56:31: undefined: hook.Event
    ../../../github.com/go-vgo/robotgo/hook.go:57:9: undefined: hook.Process
    ../../../github.com/go-vgo/robotgo/hook.go:61:64: undefined: hook.Event
    ../../../github.com/go-vgo/robotgo/hook.go:57:9: too many errors

    ```

    Thago MadPin
    @madpin

    Hello, I'm trying to have a remap tool in MacOS.
    But it's not working, with the examples given in the repo.

    Do you have any idea for the investigation?

    First time programming in Go.
    =]

    HL
    @heli0915
    # github.com/go-vgo/robotgo
    go\src\github.com\go-vgo\robotgo\hook.go:30:24: undefined: hook.Event
    go\src\github.com\go-vgo\robotgo\hook.go:31:9: undefined: hook.Start
    go\src\github.com\go-vgo\robotgo\hook.go:36:2: undefined: hook.End
    go\src\github.com\go-vgo\robotgo\hook.go:41:19: undefined: hook.Event
    go\src\github.com\go-vgo\robotgo\hook.go:42:9: undefined: hook.Start
    go\src\github.com\go-vgo\robotgo\hook.go:56:31: undefined: hook.Event
    go\src\github.com\go-vgo\robotgo\hook.go:61:64: undefined: hook.Event
    go\src\github.com\go-vgo\robotgo\img.go:61:40: undefined: Bitmap
    go\src\github.com\go-vgo\robotgo\img.go:76:38: undefined: Bitmap
    go\src\github.com\go-vgo\robotgo\img.go:106:20: undefined: Bitmap
    go\src\github.com\go-vgo\robotgo\hook.go:42:9: too many errors
    @falsechicken:chickensnest.us
    syatsuu
    @Sya-tsuu
    C:\Users\Syatsuu\sdk\go1.17\pkg\tool\windows_amd64\link.exe: running g++ failed: exit status 1
    C:/Users/Syatsuu/sdk/go1.17/bin/pkg/mod/github.com/andlabs/ui@v0.0.0-20200610043537-70a69d6ae31e/libui_windows_amd64.a(init.cpp.obj): In function DllMain': C:/projects/libui/windows/init.cpp:170: multiple definition ofDllMain'
    C:\Users\Syatsuu\AppData\Local\Temp\go-link-4269226518\000047.o:C:/Users/Syatsuu/sdk/go1.17/bin/pkg/mod/github.com/robotn/gohook@v0.31.2/hook/windows/properties_c.h:192: first defined here
    collect2.exe: error: ld returned 1 exit status
    ravasan
    @ravasan
    Hello, is there a way to smooth scroll(like in a browser, where we can scroll using pixels) using the scroll commands in robotgo? I've tried them all but they're all noticeable and jagged. Any idea how I could go about implementing smooth scroll?
    aj3423
    @aj3423
    robotgo.gif
    Hi, I'm trying to activate 3 notepad window one by one, but only the first is activated successfully, why not the other two ?
    image.png
    haphupan
    @haphupan

    go get github.com/go-vgo/robotgo

    github.com/vcaesar/gops

    vcaesar/gops/ps.go:160:2: cannot use []string value as type string in return argument

    burque505
    @burque505
    I've downloaded the latest beta, and so far examples are working. Thank you! Looking forward to being able to pull the 1.0 version with "go install" or "go get". I really appreciate this project, and would like to echo the sentiment above about looking forward to 'FindBitmap'!
    andrewfstratton
    @andrewfstratton
    I've tried the Wheel presses, e.g. robotogo.Click("wheelUp") with Win 10 - and they didn't seem to work - all the wheel options seemed to do a single middle button click instead (tried in the browser and VS Code editor). I have a Logitech mouse with wheel scrolling - and the wheel up/down works differently (i.e. fine) from what robotgo is doing. Is this a bug - or am doing something wrong? BTW - left/right/center clicks work fine. Thank you - Andy
    rajkumarks7
    @rajkumarks7
    Maximum number of clients reached fatal error: unexpected signal during runtime execution. getting this error while i use the
    title := robotgo.GetTitle()
    for ubuntu works fine for the windows
    @vcaesar