mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-31 06:13:55 +00:00
Update: update and add more examples
This commit is contained in:
parent
73a40e7861
commit
dd149367b3
@ -7,16 +7,30 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
//
|
|
||||||
// syscall.NewLazyDLL("user32.dll").NewProc("SetProcessDPIAware").Call()
|
// syscall.NewLazyDLL("user32.dll").NewProc("SetProcessDPIAware").Call()
|
||||||
|
|
||||||
width, height := robotgo.GetScaleSize()
|
width, height := robotgo.GetScaleSize()
|
||||||
fmt.Println("get scale screen size: ", width, height)
|
fmt.Println("get scale screen size: ", width, height)
|
||||||
|
|
||||||
bitmap := robotgo.CaptureScreen(0, 0, width, height)
|
bitmap := robotgo.CaptureScreen(0, 0, width, height)
|
||||||
// robotgo.SaveBitmap(bitmap, "test.png")
|
defer robotgo.FreeBitmap(bitmap)
|
||||||
|
// bitmap.Save(bitmap, "test.png")
|
||||||
robotgo.Save(robotgo.ToImage(bitmap), "test.png")
|
robotgo.Save(robotgo.ToImage(bitmap), "test.png")
|
||||||
|
|
||||||
|
robotgo.Scale = true
|
||||||
|
robotgo.Move(10, 10)
|
||||||
|
robotgo.MoveSmooth(100, 100)
|
||||||
|
|
||||||
|
fmt.Println(robotgo.Location())
|
||||||
|
|
||||||
|
num := robotgo.DisplaysNum()
|
||||||
|
for i := 0; i < num; i++ {
|
||||||
|
rect := robotgo.GetScreenRect(i)
|
||||||
|
fmt.Println("rect: ", rect)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func old() {
|
||||||
sx := robotgo.ScaleX() // Deprecated
|
sx := robotgo.ScaleX() // Deprecated
|
||||||
s := robotgo.Scale1() // Deprecated, use the ScaleF() function
|
s := robotgo.Scale1() // Deprecated, use the ScaleF() function
|
||||||
robotx, roboty := 35*s/100, 25*s/100
|
robotx, roboty := 35*s/100, 25*s/100
|
||||||
@ -28,7 +42,8 @@ func main() {
|
|||||||
rx, ry, rw, rh := sx, sy, robotx, roboty
|
rx, ry, rw, rh := sx, sy, robotx, roboty
|
||||||
// bit1 := robotgo.CaptureScreen(10, 20, robotw, roboth)
|
// bit1 := robotgo.CaptureScreen(10, 20, robotw, roboth)
|
||||||
bit1 := robotgo.CaptureScreen(rx, ry, rw, rh)
|
bit1 := robotgo.CaptureScreen(rx, ry, rw, rh)
|
||||||
// robotgo.SaveBitmap(bit1, "test2.png")
|
defer robotgo.FreeBitmap(bit1)
|
||||||
|
// bitmap.Save(bit1, "test2.png")
|
||||||
robotgo.Save(robotgo.ToImage(bit1), "test2.png")
|
robotgo.Save(robotgo.ToImage(bit1), "test2.png")
|
||||||
|
|
||||||
clo := robotgo.GetPixelColor(robotx, roboty)
|
clo := robotgo.GetPixelColor(robotx, roboty)
|
||||||
|
Loading…
Reference in New Issue
Block a user