读书人

请帮忙改个VBS

发布时间: 2012-01-14 20:02:35 作者: rapoo

请各位大哥帮忙,改个VBS
set fso=createobject("scripting.filesystemobject")
set ws=wscript.createobject("wscript.shell")
fso.createtextfile("s.txt")
ws.run("s.txt")
wscript.sleep 500
ws.sendkeys("s")
wscript.sleep 500
ws.sendkeys("o")
wscript.sleep 500
ws.sendkeys("r")
wscript.sleep 500
ws.sendkeys("r")
wscript.sleep 500
ws.sendkeys("y")

我想在里面写中文,我要怎么改?这个是输出是sorry我想写输出五个中文,请高手指点。

[解决办法]
参考这个

VB code
Private Sub Form_Load()    Dim x    x = Shell("Notepad.exe", vbNormalFocus)    SendKeys "这是一个文本文件的测试程序.", True    ' 模拟输入英文字符串    SendKeys "{Enter}{Enter}", True      ' 两次回车    waittime (2)     ' 延时 2 秒    SendKeys "自动输入文字", True    SendKeys "{Enter}{Enter}", True    waittime (2)    SendKeys "既不是病毒,也不是木马!", True    SendKeys "{Enter}{Enter}", True    waittime (2)    SendKeys "Being Exit... Look the MenuBar File{(}F{)}...", True    SendKeys "%", True 'Alt 键激活菜单条    waittime (1)    SendKeys "(F)", True '按字母 "F",选择"文件(F)"菜单    waittime (1)    SendKeys "(X)", True '按字母 "X", 选择"退出(X)"    waittime (2)    SendKeys "(N)", True '弹出一个对话框,询问文件是否存盘,按 "N" 不存盘    End '结束本模拟程序    End Sub    Private Sub waittime(delay As Single)        Dim starttime As Single        starttime = Timer        Do Until (Timer - starttime) > delay        Loop    End Sub 

读书人网 >VB

热点推荐