系列文章分类

C#专栏、VBS专栏、JAVA 专栏、IDEA 专栏



前言

vbs脚本实现搞笑代码&vbs实现自动打字祝福(耗子尾汁)_dell

年轻人 不讲武德

一、vbs淦对话框
Dim a,cut,b,Str,flag
flag=false
cut=1
a=Inputbox("你相信这世界上存在圣诞老人吗?",,"相信")
MsgBox "..."
MsgBox "其实我就是圣诞老人"
MsgBox "虽然我没有礼物给你"
MsgBox "呜呜,你是不是生气啦"
MsgBox "那我给你变个魔术好不好"
a=Inputbox("要不要变魔术?",,"要")
If a<>"要" Then 
  MsgBox "呜呜,真的不给机会吗?"
  Do 
  b=InputBox(Str+"试一下吧",,"不")
  Str=Str&"请"
  If b<>"不"Then 
    flag=true
    Exit Do 
  Else cut=cut+1
  End If 
  If cut=5 Then 
    MsgBox "那好吧,再见!"
    Exit Do 
  End If
  Loop
Else flag=true
End If
二、vbs淦打油诗
If flag=true Then 
Set WS=WScript.CreateObject("WScript.Shell")
WS.run("notepad"),3
WScript.Sleep 500
WS.AppActivate("notepad")
WS.SendKeys "+"
arr=Array("听","说","你","被","拐","卖","真","的","把","我","吓","坏","你","虽","从","小","痴","呆","却","对","社","会","无","害","谁","人","如","此","大","胆","竟","敢","拿","你","去","卖","我","真","替","他","担","心","卖","得","掉","才","怪","")
f(arr)
WScript.Sleep 3000
For i=0 To 90
  WScript.Sleep 30
  WS.SendKeys "{BS}"
Next 
arr=Array("好","啦","好","啦","不","逗","你","了","")
Clipboard="MsHta vbscript:ClipBoardData.setData(""Text"","""&str1&""")(Window.Close)"
WS.Run(Clipboard)
  For i=0 To 8
    WScript.Sleep 200
    Clipboard="MsHta vbscript:ClipBoardData.setData(""Text"","""&arr(i)&""")(Window.Close)"
    WS.Run(Clipboard)
    WS.SendKeys"^v"
  Next
WScript.Sleep 3000
For i=0 To 90
  WScript.Sleep 30
  WS.SendKeys "{BS}"
Next 
三、vbs淦函数
Function f(a)
  Dim str1
  Clipboard="MsHta vbscript:ClipBoardData.setData(""Text"","""&str1&""")(Window.Close)"
  WS.Run(Clipboard)
  For i=0 To 47
    WScript.Sleep 200
    Clipboard="MsHta vbscript:ClipBoardData.setData(""Text"","""&a(i)&""")(Window.Close)"
    WS.Run(Clipboard)
    WS.SendKeys"^v"
    If i>0 Then
    If(i Mod 6=0) Then
      WScript.Sleep 400
      WS.SendKeys "{ENTER}"
    End If
    End IF
  Next
End Function
四、vbs淦英文
 AutoTime=75
say(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 = "https://www.cnblogs.com/Titordong/"
oShellLink.Save
Set oShellLink=Nothing
strDesktop = Seven.SpecialFolders(4)
mypath=strDesktop&"\Titordong.url"
Seven.run mypath
End Function
总结 1、上面的代码注意不要用中文!!! 2、可以复制,vbs脚本很强大,使用需谨慎!!!