Go语言:操作剪切板

作者: 白祤星 | 来源:发表于2019-03-14 10:35 被阅读5623次

1. 安装


go get github.com/atotto/clipboard

2. 使用


package main

import (
    "github.com/atotto/clipboard"
)

func main() {
    // 复制内容到剪切板
    clipboard.WriteAll(`复制这段内容到剪切板`)

    // 读取剪切板中的内容到字符串
    content, err := clipboard.ReadAll()
    if err != nil {
        panic(err)
    }
    println(content)
}

相关文章

网友评论

    本文标题:Go语言:操作剪切板

    本文链接:https://www.haomeiwen.com/subject/vszfmqtx.html