本帖最后由 CrLf 于 2014-4-15 17:49 编辑
那更简单了: | randomize | | set fso = CreateObject("Scripting.Filesystemobject") | | set file = fso.OpenTextFile("英语谚语.txt") | | text = file.ReadAll | | a = Split(text,vbCrLf) | | file.Close | | | | h = (rnd*UBound(a)\2)*2 | | str = a(h) & vbCrLf & a(h+1) | | | | | | setClip str | | Set WshShell= WScript.CreateObject("WScript.Shell") | | WshShell.SendKeys "^v" | | WshShell.SendKeys "^{ENTER}" | | | | Sub setClip(str) | | Dim Form, TextBox | | Set Form = CreateObject("Forms.Form.1") | | Set TextBox = Form.Controls.Add("Forms.TextBox.1").Object | | TextBox.MultiLine = True | | TextBox.Text = str | | TextBox.SelStart = 0 | | TextBox.SelLength = TextBox.TextLength | | TextBox.Copy | | End SubCOPY |
setClip 修改自 demon 的博客里的内容,这样就不需要第三方支持了(如果 com 可以不算的话) |