mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-06 16:53:56 +00:00
commit
e48c1ea1d1
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,6 +6,7 @@
|
|||||||
examples/screen/screen
|
examples/screen/screen
|
||||||
examples/screen/saveCapture.png
|
examples/screen/saveCapture.png
|
||||||
examples/bitmap/test.png
|
examples/bitmap/test.png
|
||||||
|
examples/bitmap/test2.png
|
||||||
examples/bitmap/test.tif
|
examples/bitmap/test.tif
|
||||||
examples/bitmap/test31.tif
|
examples/bitmap/test31.tif
|
||||||
test/test.png
|
test/test.png
|
||||||
|
@ -12,8 +12,10 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
"github.com/go-vgo/robotgo"
|
"github.com/go-vgo/robotgo"
|
||||||
|
"github.com/vcaesar/imgo"
|
||||||
// "go-vgo/robotgo"
|
// "go-vgo/robotgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -79,6 +81,20 @@ func main() {
|
|||||||
robotgo.SaveBitmap(bitmap, "test.png")
|
robotgo.SaveBitmap(bitmap, "test.png")
|
||||||
robotgo.SaveBitmap(bitmap, "test31.tif", 1)
|
robotgo.SaveBitmap(bitmap, "test31.tif", 1)
|
||||||
|
|
||||||
|
img, name, err := robotgo.DecodeImg("test.png")
|
||||||
|
if err != nil {
|
||||||
|
log.Println("decode image ", err)
|
||||||
|
}
|
||||||
|
fmt.Println("decode test.png", img, name)
|
||||||
|
|
||||||
|
byt := robotgo.OpenImg("test.png")
|
||||||
|
imgo.Save("test2.png", byt)
|
||||||
|
|
||||||
|
w, h := robotgo.GetImgSize("test.png")
|
||||||
|
fmt.Println("image width and hight ", w, h)
|
||||||
|
w, h = imgo.GetSize("test.png")
|
||||||
|
fmt.Println("image width and hight ", w, h)
|
||||||
|
|
||||||
// convert image
|
// convert image
|
||||||
robotgo.Convert("test.png", "test.tif")
|
robotgo.Convert("test.png", "test.tif")
|
||||||
|
|
||||||
|
@ -26,11 +26,15 @@ func main() {
|
|||||||
robotgo.TypeString("Hello World")
|
robotgo.TypeString("Hello World")
|
||||||
|
|
||||||
robotgo.TypeString("留给真爱你的人")
|
robotgo.TypeString("留给真爱你的人")
|
||||||
|
robotgo.MicroSleep(1)
|
||||||
|
|
||||||
robotgo.TypeStr("所以, 你好, 再见")
|
robotgo.TypeStr("所以, 你好, 再见")
|
||||||
|
robotgo.Sleep(1)
|
||||||
|
|
||||||
ustr := uint32(robotgo.CharCodeAt("所以, 你好, 再见", 0))
|
ustr := uint32(robotgo.CharCodeAt("所以, 你好, 再见", 0))
|
||||||
robotgo.UnicodeType(ustr)
|
robotgo.UnicodeType(ustr)
|
||||||
|
|
||||||
robotgo.PasteStr("粘贴字符串, paste")
|
robotgo.PasteStr(" 粘贴字符串, paste")
|
||||||
|
|
||||||
// press "enter"
|
// press "enter"
|
||||||
robotgo.KeyTap("enter")
|
robotgo.KeyTap("enter")
|
||||||
|
@ -12,8 +12,10 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
"github.com/go-vgo/robotgo"
|
"github.com/go-vgo/robotgo"
|
||||||
|
"github.com/vcaesar/imgo"
|
||||||
// "go-vgo/robotgo"
|
// "go-vgo/robotgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,11 +28,15 @@ func key() {
|
|||||||
robotgo.TypeString("Hello World")
|
robotgo.TypeString("Hello World")
|
||||||
|
|
||||||
robotgo.TypeString("留给真爱你的人")
|
robotgo.TypeString("留给真爱你的人")
|
||||||
|
robotgo.MicroSleep(1)
|
||||||
|
|
||||||
robotgo.TypeStr("所以, 你好, 再见")
|
robotgo.TypeStr("所以, 你好, 再见")
|
||||||
|
robotgo.Sleep(1)
|
||||||
|
|
||||||
ustr := uint32(robotgo.CharCodeAt("所以, 你好, 再见", 0))
|
ustr := uint32(robotgo.CharCodeAt("所以, 你好, 再见", 0))
|
||||||
robotgo.UnicodeType(ustr)
|
robotgo.UnicodeType(ustr)
|
||||||
|
|
||||||
robotgo.PasteStr("粘贴字符串, paste")
|
robotgo.PasteStr(" 粘贴字符串, paste")
|
||||||
|
|
||||||
// press "enter"
|
// press "enter"
|
||||||
robotgo.KeyTap("enter")
|
robotgo.KeyTap("enter")
|
||||||
@ -219,6 +225,20 @@ func bitmap() {
|
|||||||
robotgo.SaveBitmap(bitmap, "test.png")
|
robotgo.SaveBitmap(bitmap, "test.png")
|
||||||
robotgo.SaveBitmap(bitmap, "test31.tif", 1)
|
robotgo.SaveBitmap(bitmap, "test31.tif", 1)
|
||||||
|
|
||||||
|
img, name, err := robotgo.DecodeImg("test.png")
|
||||||
|
if err != nil {
|
||||||
|
log.Println("decode image ", err)
|
||||||
|
}
|
||||||
|
fmt.Println("decode test.png", img, name)
|
||||||
|
|
||||||
|
byt := robotgo.OpenImg("test.png")
|
||||||
|
imgo.Save("test2.png", byt)
|
||||||
|
|
||||||
|
w, h := robotgo.GetImgSize("test.png")
|
||||||
|
fmt.Println("image width and hight ", w, h)
|
||||||
|
w, h = imgo.GetSize("test.png")
|
||||||
|
fmt.Println("image width and hight ", w, h)
|
||||||
|
|
||||||
// convert image
|
// convert image
|
||||||
robotgo.Convert("test.png", "test.tif")
|
robotgo.Convert("test.png", "test.tif")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user