Skip to content

Commit

Permalink
update key example code
Browse files Browse the repository at this point in the history
  • Loading branch information
vcaesar committed Jan 6, 2019
1 parent 9d585cc commit c9ba544
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions examples/key/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,38 @@ func keyTap() {
// press "enter"
robotgo.KeyTap("enter")
robotgo.KeyTap("a")
robotgo.KeyTap("a", "control")
robotgo.KeyTap("a", "ctrl")

// hide window
err := robotgo.KeyTap("h", "command")
err := robotgo.KeyTap("h", "cmd")
if err == "" {
fmt.Println("robotgo.KeyTap run error is nil.")
}

robotgo.KeyTap("h", "command", 12)
robotgo.KeyTap("h", "cmd", 12)

// press "i", "alt", "command" Key combination
robotgo.KeyTap("i", "alt", "command")
robotgo.KeyTap("i", "alt", "command", 11)

arr := []string{"alt", "command"}
arr := []string{"alt", "cmd"}
robotgo.KeyTap("i", arr)
robotgo.KeyTap("i", arr, 12)

// close window
robotgo.KeyTap("w", "command")
robotgo.KeyTap("w", "cmd")

// minimize window
robotgo.KeyTap("m", "command")
robotgo.KeyTap("f1", "control")
robotgo.KeyTap("m", "cmd")

robotgo.KeyTap("f1", "ctrl")
robotgo.KeyTap("a", "control")
}

func keyToggle() {
robotgo.KeyToggle("a", "down")
robotgo.KeyToggle("a", "down", "alt")
robotgo.KeyToggle("a", "down", "alt", "command")
robotgo.KeyToggle("a", "down", "alt", "cmd")

err := robotgo.KeyToggle("enter", "down")
if err == "" {
Expand Down

0 comments on commit c9ba544

Please sign in to comment.