Open historydev opened 1 year ago
The same here, and even more. I guess this is related to the Windows compiler (gcc or something)
go: upgraded github.com/go-vgo/robotgo v0.100.10 => v1.0.0-beta1 \golang\mouseClick> go run .\cmd\main.go
..\..\go\src\pkg\mod\github.com\go-vgo\robotgo@v1.0.0-beta1\ps.go:23:9: cannot use ps.Pids() (value of type []int) as []int32 value in return statement
..\..\go\src\pkg\mod\github.com\go-vgo\robotgo@v1.0.0-beta1\ps.go:28:22: cannot use pid (variable of type int32) as int value in argument to ps.PidExists
..\..\go\src\pkg\mod\github.com\go-vgo\robotgo@v1.0.0-beta1\ps.go:37:4: cannot use nps[i].Pid (variable of type int) as int32 value in struct literal
..\..\go\src\pkg\mod\github.com\go-vgo\robotgo@v1.0.0-beta1\ps.go:49:21: cannot use pid (variable of type int32) as int value in argument to ps.FindName
..\..\go\src\pkg\mod\github.com\go-vgo\robotgo@v1.0.0-beta1\ps.go:61:9: cannot use ps.FindIds(name) (value of type []int) as []int32 value in return statement
..\..\go\src\pkg\mod\github.com\go-vgo\robotgo@v1.0.0-beta1\ps.go:66:21: cannot use pid (variable of type int32) as int value in argument to ps.FindPath
..\..\go\src\pkg\mod\github.com\go-vgo\robotgo@v1.0.0-beta1\ps.go:76:17: cannot use pid (variable of type int32) as int value in argument to ps.Kill
i have same error
I'm getting the same. Should I rollback to an old version?
Same. As far as I can tell, robotgo
is completely unusable on Windows from a fresh install.
For anyone looking for a workaround on Windows, I ended up using AutoHotkey. It certainly leaves a lot to be desired in terms of syntax and data structures but I was able to accomplish what I needed with a few Map()
data structures.
Because the robotgo version does not match its dependency versions. Run go mod graph
check it.
Re download the go mod
dependencies will solve it.
Just like this:
go get -u github.com/go-vgo/robotgo
.go.mod
file second require.go mod tidy
.module tests
go 1.18
require (
github.com/go-vgo/robotgo v1.0.0-rc1.0.20230706172004-af321105215d
)
- require (
- github.com/vcaesar/gops v0.30.1 // indirect
- github.com/vcaesar/imgo v0.30.2 // indirect
- github.com/vcaesar/keycode v0.10.0 // indirect
- github.com/vcaesar/tt v0.20.0 // indirect
- ...
- )
@wilon This isn't for go 1.18. This is for people running go 1.20+ on Windows.
We have to use:
go get -u github.com/go-vgo/robotgo@v1.0.0-beta1
Or otherwise we get this issue documented in the OPs post:
hook.go:98:17: invalid operation: geve == 0 (mismatched types bool and untyped int)
But using the beta causes the second issue in the OPs post:
ps.go:23:9: cannot use ps.Pids() (value of type []int) as []int32 value in return statement
I've tried to manually set my go.mod file to use go 1.15
but this seems to be an issue with the go 1.20 base installation I have.
It doesn't matter which go version, try execute steps 2 and 3.
I don't have the second require in my go.mod
file, so step 2 is not possible.
I don't have the second require in my
go.mod
file, so step 2 is not possible.
Run go mod graph
check the dependencies, then find out the mismatching package, reinstall it.
Or remove the go.mod
and reinstall all dependencies.
Thanks @wilon. Just removing whatever was in my second require (even though it didn't match what you wrote) and running go mod tidy
worked. It is really strange to me that these issues pop up on a fresh install but it was likely because I didn't start with the beta but instead switched to it after trying the non-beta.
First error i have this:
Second error after change robotgo version on 1.0.0-beta1 have only this: