最简单的方法:让VBS也有强大的后台功能!(超赞,啥事都能干了!)
vbs吧
全部回复
仅看楼主
level 6
baorca 楼主

'////////前提是必须要有dm.dll(大漠插件, 按键精灵论坛下载)/////
'>>>>http://bbs.vrbrothers.com/viewthread.php?tid=118820&extra=page%3D1
Dim dm,WshShell,oExec
set WshShell = WScript.CreateObject("WScript.Shell")
Set dm= CreateObject("dm.dmsoft")
WshShell.run("cmd.exe")
While hwnd=0
hwnd= dm.FindWindow("","cmd.exe")
wscript.sleep 100
Wend
dm_ret=dm.GetWindowRect(hwnd,x1,y1,x2,y2)
msgbox hwnd & vbcrlf & x1 & "," & y1 & "," & x2 & "," & y2,, "打开了DOS窗口"
dm.SetWindowText hwnd,"test"
dm_ret = dm.BindWindow(hwnd,"normal","windows","windows",0)
dm.KeyPress 13
dm.sendstring hwnd,"cls&@echo off"
dm.KeyPress 13
for i=0 to 8
str= "cls&color " & i & (i+1)
dm.sendstring hwnd,str
dm.KeyPress 13
wscript.sleep 200
next
dm.sendstring hwnd,"echo 3秒倒计时&pause"
dm.KeyPress 13
wscript.sleep 3000
dm.KeyPress 13
dm.KeyPress 13
dm.sendstring hwnd,"cls&start notepad&exit"
dm.KeyPress 13
dm_ret = dm.UnBindWindow()
wscript.sleep 500
hwnd1 = dm.FindWindow("","无标题 - 记事本")
if hwnd1>0 then
hwnd = dm.FindWindowEx(hwnd1,"Edit","")
dm_ret = dm.BindWindow(hwnd,"normal","windows","windows",0)
msgbox hwnd1 & vbcrlf & x1 & "," & y1 & "," & x2 & "," & y2 & vbcrlf & "确定后,最小化记事本!",, "打开了记事本"
dm_ret = dm.SetWindowState(hwnd1,2)
dm.sendstring hwnd,"看到了吧,这个是被最小化过后发送的字符串!" & vbcrlf
wscript.sleep 500
dm_ret = dm.SetWindowState(hwnd1,5)
dim arr
str = "怎么 样 , 神 奇 吧 , 祝 你 好 运 ! "
arr = split(str," ")
if hwnd>0 then
for i=0 to ubound(arr)
dm.sendstring hwnd,arr(i)
wscript.sleep 200
next
end if
dm_ret = dm.UnBindWindow()
else
msgobx "未能打开记事本,失败!"
end if
'//以后有了这个, 写游戏挂机脚本都可以了。。。。

2011年11月15日 01点11分 1
level 9
2011年11月15日 06点11分 2
level 7
2011年11月15日 07点11分 3
level 6
IE后台点击的例子有没?
2014年12月28日 17点12分 6
群主
2015年01月01日 00点01分
1