China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-06 06:02
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Programmers, how to express love to the beloved MM View 3,485 Replies 35
Original Poster Posted 2007-04-24 07:24 ·  中国 新疆 乌鲁木齐 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline
Copy the following code into Notepad, save it as a VBS file, and run it to enjoy the effect ^^!


set fso=createobject("scripting.filesystemobject")
set ws=wscript.createobject("wscript.shell")

fso.createtextfile("love.txt")
ws.run("love.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")
wscript.sleep 500
ws.sendkeys(" ")
wscript.sleep 500
ws.sendkeys("g")
wscript.sleep 500
ws.sendkeys("r")
wscript.sleep 500
ws.sendkeys("i")
wscript.sleep 500
ws.sendkeys("l")
wscript.sleep 500
ws.sendkeys(":")
wscript.sleep 500
ws.sendkeys(chr(10))
wscript.sleep 500
ws.sendkeys("I")
wscript.sleep 500
ws.sendkeys(" ")
wscript.sleep 500
ws.sendkeys("t")
wscript.sleep 500
ws.sendkeys("h")
wscript.sleep 500
ws.sendkeys("i")
wscript.sleep 500
ws.sendkeys("n")
wscript.sleep 500
ws.sendkeys("k")
wscript.sleep 500
ws.sendkeys(" ")
wscript.sleep 500
ws.sendkeys("I")
wscript.sleep 500
ws.sendkeys(".")
wscript.sleep 500
ws.sendkeys(".")
wscript.sleep 500
ws.sendkeys(".")
wscript.sleep 500
ws.sendkeys(chr(10))
wscript.sleep 500
ws.sendkeys("d")
wscript.sleep 500
ws.sendkeys("o")
wscript.sleep 500
ws.sendkeys("n")
wscript.sleep 500
ws.sendkeys("'")
wscript.sleep 500
ws.sendkeys("t")
wscript.sleep 500
ws.sendkeys(" ")
wscript.sleep 500
ws.sendkeys("l")
wscript.sleep 500
ws.sendkeys("o")
wscript.sleep 500
ws.sendkeys("v")
wscript.sleep 500
ws.sendkeys("e")
wscript.sleep 500
ws.sendkeys(" ")
wscript.sleep 500
ws.sendkeys("y")
wscript.sleep 500
ws.sendkeys("o")
wscript.sleep 500
ws.sendkeys("u")
wscript.sleep 500
ws.sendkeys("!")






[ Last edited by zhoushijay on 2007-4-23 at 06:26 PM ]
Floor 2 Posted 2007-04-24 08:39 ·  中国 辽宁 本溪 联通
银牌会员
★★★
Credits 1,212
Posts 464
Joined 2006-12-13 21:11
19-year member
UID 73417
Gender Male
Status Offline
Nice
Floor 3 Posted 2007-04-24 08:49 ·  中国 浙江 杭州 联通
银牌会员
★★★
Credits 1,928
Posts 931
Joined 2007-01-06 11:46
19-year member
UID 75624
Gender Male
Status Offline
Correcting the LZ's spelling mistake. It should be "girl" right?
dim ws
set ws=wscript.createobject("wscript.shell")
ws.run("notepad.exe")
wscript.sleep 200
ws.appactivate "无标题-记事本"
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")
wscript.sleep 500
ws.sendkeys(" ")
wscript.sleep 500
ws.sendkeys("g")
wscript.sleep 500
ws.sendkeys("i")
wscript.sleep 500
ws.sendkeys("r")
wscript.sleep 500
ws.sendkeys("l")
wscript.sleep 500
ws.sendkeys(":")
wscript.sleep 500
ws.sendkeys(chr(10))
wscript.sleep 500
ws.sendkeys("I")
wscript.sleep 500
ws.sendkeys(" ")
wscript.sleep 500
ws.sendkeys("t")
wscript.sleep 500
ws.sendkeys("h")
wscript.sleep 500
ws.sendkeys("i")
wscript.sleep 500
ws.sendkeys("n")
wscript.sleep 500
ws.sendkeys("k")
wscript.sleep 500
ws.sendkeys(" ")
wscript.sleep 500
ws.sendkeys("I")
wscript.sleep 500
ws.sendkeys(".")
wscript.sleep 500
ws.sendkeys(".")
wscript.sleep 500
ws.sendkeys(".")
wscript.sleep 500
ws.sendkeys(chr(10))
wscript.sleep 500
ws.sendkeys("d")
wscript.sleep 500
ws.sendkeys("o")
wscript.sleep 500
ws.sendkeys("n")
wscript.sleep 500
ws.sendkeys("'")
wscript.sleep 500
ws.sendkeys("t")
wscript.sleep 500
ws.sendkeys(" ")
wscript.sleep 500
ws.sendkeys("l")
wscript.sleep 500
ws.sendkeys("o")
wscript.sleep 500
ws.sendkeys("v")
wscript.sleep 500
ws.sendkeys("e")
wscript.sleep 500
ws.sendkeys(" ")
wscript.sleep 500
ws.sendkeys("y")
wscript.sleep 500
ws.sendkeys("o")
wscript.sleep 500
ws.sendkeys("u")
wscript.sleep 500
ws.sendkeys("!")
Floor 4 Posted 2007-04-24 09:25 ·  中国 新疆 乌鲁木齐 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline
....
Fortunately, there are no girls here, otherwise I'd be dead!
Floor 5 Posted 2007-04-24 09:54 ·  中国 广西 南宁 电信
新手上路
Credits 6
Posts 3
Joined 2007-04-24 00:36
19-year member
UID 86221
Gender Male
Status Offline
Floor 6 Posted 2007-04-24 11:18 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
The " - " on both sides of the window name "Untitled - Notepad" should each have a space.

Simplify (replace $ with newline later):
dim ws
str = "Sorry girl:$I think I...$don't love you!"
Num = len(str)
set ws=wscript.createobject("wscript.shell")
ws.run("notepad.exe")
wscript.sleep 200
ws.appactivate "Untitled - Notepad"
wscript.sleep 500

for i = 1 to Num
Input = Mid(str, i, 1)
if Input = "$" then Input = vbCr
wscript.sleep 500
ws.sendkeys(Input)
next
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
lxmxn +4 2007-04-24 12:23
everest79 +15 2007-04-24 22:33
Floor 7 Posted 2007-04-24 12:24 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
A post like the one the LZ made is an imperfect script if it doesn't use loops.
Floor 8 Posted 2007-04-24 22:44 ·  中国 江苏 苏州 电信
初级用户
Credits 72
Posts 35
Joined 2006-11-13 01:26
19-year member
UID 70380
Gender Male
Status Offline
I have associated the txt with other editors. Is it useful to change it to activate Notepad upstairs? Isn't this making it less universal? The owner's code can directly call my editor. I don't know if it will go wrong after modification.
I'm using the English version.
There was no error during operation, but I don't know if it has achieved the activation effect.
Floor 9 Posted 2007-04-24 22:45 ·  中国 河南 洛阳 联通
初级用户
Credits 28
Posts 14
Joined 2007-02-01 01:26
19-year member
UID 78259
Gender Male
Status Offline
It seems difficult to implement a loop, right? Every time you have to change a character.
Floor 10 Posted 2007-04-24 23:00 ·  中国 上海 浦东新区 电信
中级用户
★★
Credits 302
Posts 138
Joined 2007-03-29 02:33
19-year member
UID 83224
Gender Male
Status Offline
Although simple but practical. However, for some MM who don't have a computer knack, if they type halfway or close it, the effect may not be satisfactory.......
Floor 11 Posted 2007-04-24 23:15 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Originally posted by aspirer at 2007-4-24 09:44:
I have associated txt with other editors. Did the person upstairs who changed it to activate Notepad work? Isn't this making it less universal? The code of the original poster can directly call my editor. After modification, I don't know...

Actually, it doesn't matter much whether it's activated or not, because the newly opened window of ws.run("notepad.exe") is generally set to the front. As long as the delay is appropriate after opening, it's okay.
Originally posted by xuehu at 2007-4-24 09:45:
It seems that the loop is not easy to implement?
You have to change a character each time...

My third sentence Num = len(str) outputs the length of the character to the number of loops for i = 1 to Num. You just need to modify the sentence.
PS: VBS does not support sending Chinese.
Originally posted by lililulula at 2007-4-24 10:00:
Although simple but practical. However, some MM who have no computer sense may not get the desired effect if they type or close the window halfway.......

You can add activating the window to judge whether to continue. When the window is closed, the script can't activate the Notepad window and will jump out of the loop. It's just for fun, so I didn't consider it.
Floor 12 Posted 2007-04-25 00:40 ·  中国 贵州 贵阳 电信
中级用户
★★
Credits 304
Posts 117
Joined 2006-04-04 18:43
20-year member
UID 53325
Gender Male
Status Offline
zh159
Powerful!!
Top!!
Floor 13 Posted 2007-04-25 01:01 ·  中国 广东 广州 天河区 电信
中级用户
★★
Credits 259
Posts 112
Joined 2006-09-18 04:55
19-year member
UID 62928
Gender Male
Status Offline
Hehe.. Interesting.. Fun, right~
Floor 14 Posted 2007-04-25 02:05 ·  中国 广东 广州 海珠区 电信
新手上路
Credits 10
Posts 5
Joined 2007-01-02 13:31
19-year member
UID 75272
Gender Male
Status Offline
Floor 15 Posted 2007-04-25 04:34 ·  中国 辽宁 本溪 联通
银牌会员
★★★
Credits 1,212
Posts 464
Joined 2006-12-13 21:11
19-year member
UID 73417
Gender Male
Status Offline
It would be nice to be able to type Chinese characters....
Forum Jump: