系列文章分类
C#专栏、VBS专栏、JAVA 专栏、IDEA 专栏
vbs脚本实现搞笑代码&vbs实现自动打字祝福
前言一、vbs淦对话框二、vbs淦打油诗三、vbs淦函数四、vbs淦英文五、vbs淦C+实现模拟键盘功能六、六六大顺祝福总结前言
年轻人 不讲武德
一、vbs淦对话框
Dim a,cut,b,Str,flagflag=falsecut=1a=Inputbox("你相信这世界上存在圣诞老人吗?",,"相信")MsgBox "..."MsgBox "其实我就是圣诞老人"MsgBox "虽然我没有礼物给你"MsgBox "呜呜,你是不是生气啦"MsgBox "那我给你变个魔术好不好"a=Inputbox("要不要变魔术?",,"要")If a<>"要" Then MsgBox "呜呜,真的不给机会吗?"Do b=InputBox(Str+"试一下吧",,"不")Str=Str&"请"If b<>"不"Then flag=trueExit Do Else cut=cut+1End If If cut=5 Then MsgBox "那好吧,再见!"Exit Do End IfLoopElse flag=trueEnd If
二、vbs淦打油诗
If flag=true Then Set WS=WScript.CreateObject("WScript.Shell")WS.run("notepad"),3WScript.Sleep 500WS.AppActivate("notepad")WS.SendKeys "+"arr=Array("听","说","你","被","拐","卖","真","的","把","我","吓","坏","你","虽","从","小","痴","呆","却","对","社","会","无","害","谁","人","如","此","大","胆","竟","敢","拿","你","去","卖","我","真","替","他","担","心","卖","得","掉","才","怪","")f(arr)WScript.Sleep 3000For i=0 To 90WScript.Sleep 30WS.SendKeys "{BS}"Next arr=Array("好","啦","好","啦","不","逗","你","了","")Clipboard="MsHta vbscript:ClipBoardData.setData(""Text"","""&str1&""")(Window.Close)"WS.Run(Clipboard)For i=0 To 8WScript.Sleep 200Clipboard="MsHta vbscript:ClipBoardData.setData(""Text"","""&arr(i)&""")(Window.Close)"WS.Run(Clipboard)WS.SendKeys"^v"NextWScript.Sleep 3000For i=0 To 90WScript.Sleep 30WS.SendKeys "{BS}"Next
三、vbs淦函数
Function f(a)Dim str1Clipboard="MsHta vbscript:ClipBoardData.setData(""Text"","""&str1&""")(Window.Close)"WS.Run(Clipboard)For i=0 To 47WScript.Sleep 200Clipboard="MsHta vbscript:ClipBoardData.setData(""Text"","""&a(i)&""")(Window.Close)"WS.Run(Clipboard)WS.SendKeys"^v"If i>0 ThenIf(i Mod 6=0) ThenWScript.Sleep 400WS.SendKeys "{ENTER}"End IfEnd IFNextEnd Function
四、vbs淦英文
AutoTime=75say(AutoTime)Function say(AutoTime)End Function
五、vbs淦C+实现模拟键盘功能
#include<iostream>#include<fstream>using namespace std;int main() {ifstream ifile;ifile.open("D:\\in.txt");ofstream ofile;ofile.open("D:\\out.txt");char str[100];while (ifile.getline(str, 100)) {if (str[0] == '\0') {ofile << "WS.SendKeys \"{ENTER}\"" << endl << endl<<endl;}else {for (int i(0); i < strlen(str); i++) {ofile << "WScript.Sleep AutoTime" << endl;ofile << "WS.SendKeys \"" << str[i] << "\"" << endl;}ofile << "WScript.Sleep 1000" << endl;ofile << "WS.SendKeys \"{ENTER}\"" << endl << endl << endl;}}ofile.close();ifile.close();return 0;}
六、六六大顺祝福
Function link()Set Seven = WScript.CreateObject("WScript.Shell")strDesktop = Seven.SpecialFolders("Desktop")set oShellLink = Seven.CreateShortcut(strDesktop & "\Titordong.url")oShellLink.TargetPath = "/Titordong/"oShellLink.SaveSet oShellLink=NothingstrDesktop = Seven.SpecialFolders(4)mypath=strDesktop&"\Titordong.url"Seven.run mypathEnd Function