如何在lua中保存到(从中获取剪贴板数据)剪贴板? (Windows)中
答案 0 :(得分:1)
简单!您可以使用afxLua库从剪贴板保存和获取信息:
0 . go here - http://luaforge.net/projects/jaslatrix/
1 . click on the "clipboard" link
2 . click on "1.0.0"
3 . select lua version accordingly. If unsure try "clipboard-1.0.0-Lua51.zip"
4 . unzip the downloaded file
5 . the documentation is inside of the clipboard.chm file.
6 . place the clipboard.dll inside of your project folder (or in the same folder as the .lua)
7 . add to the top of your code the following - require "clipboard"
8 . to get clipboard data, assign a variable to clipboard.gettext()
9 . to save data to the clipboard do this - clipboard.setdata(yourVariableOrStringHere)
[meta-numbers]
0 . Why did I make this?
Because awhile ago, when I was a total newbie (lua is the first language I learned), I needed this for a project and was unable to figure out how, so the feature was never implemented despite it's importance. I was also a slightly scared of add-on libraries.
1 . I am not jaslatrix nor am I advertising his library. However, when you search "clipboard API lua" on google, it is impossible to find anything except for c library tutorials, so I figured it'd be nice to share this.
答案 1 :(得分:0)
您可以使用get_clipboard中的set_clipboard和winapi功能。