校园分镜头脚本范例问道2019道

发布时间:2021-04-28 来源:脚本之家 点击:

VB6.0作为Windows软件的强有力开发工具,在多媒体程序设计方面具有广阔的应用前景

文件操作


VBS 导入注册表,然后执行文件

PING内网 不通就 执行关机 的VBS

开机脚本VBS用于ARP邦定

运行程序

运行 oshell.run "d:\soft\hf\hfgame3\GameClient.lnk"

断开网络连接


启动网络连接

删除文件的VBS脚本

无界面自动检测安装iscsi客户端,映射及断开映射vbs脚本

下列代码实现无界面自动检测安装iscsi客户端,自动映射


下例代码实现无界面删除iscsi映射盘


删除QQ用户文件强制删除是不行的了,要跳过的话这样:

格5分钟运行一次批处理程序

要设开机自动运行,禁止程序

shell脚本判断参数是否为空

'程序名称: btlwchk_netinterface.vbs
'程序用途: 监测windows主机网络接口利用率
'创建日期: 2011-09-1
'作者信息: zhangkai
'运行环境: vbs
'处理参数

MonSubject="NetInterface"
Set Args=WScript.Arguments
If (Args.Count<1) Then
Wscript.Echo MonSubject & " -1:command line error"
WScript.Quit(3)
End If
strcid=Args(0)
'获取工作目录
tmparr=Split(Wscript.ScriptFullName,"",-1)
g_strworkdir=tmparr(0)
narr=UBound(tmparr,1)
For i=1 to narr-3
g_strworkdir=g_strworkdir & "" & tmparr(i)
Next
'装载公共库
set g_fileSys=createObject ("Scripting.FileSystemObject")
Sub includeFile (fSpec)
dim file, fileData
set file=g_fileSys.openTextFile (fSpec)
fileData=file.readAll ()
file.close
executeGlobal fileData
set file=nothing
end sub
includeFile g_strworkdir & "\nagios\libexec\libcomm.vbs"


'输出版本和帮助信息
getverhelp strcid,"v1.00"," <cid>"

strComputer="."
Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "\root\cimv2")

'第1次采样
Set colItems=objWMIService.ExecQuery("Select * from Win32_PerfRawData_Tcpip_NetworkInterface",,48)
Dim BytesTotalPersec1(20),TimeValue1(20),Name1(20),CurrentBandwidth(20),BytesReceivedPerSec1(20),BytesSentPerSec1(20),PacketsReceivedPerSec1(20),PacketsSentPerSec1(20),_
BytesTotalPersec(20),PercentNetwork(20),BytesReceivedPerSec(20),BytesSentPerSec(20),PacketsReceivedPerSec(20),PacketsSentPerSec(20)
n=0
For Each objItem in colItems
Name1(n)=objItem.Name
BytesTotalPersec1(n)=objItem.BytesTotalPersec
BytesReceivedPerSec1(n)=objItem.BytesReceivedPerSec
BytesSentPerSec1(n)=objItem.BytesSentPerSec
PacketsReceivedPerSec1(n)=objItem.PacketsReceivedPerSec
PacketsSentPerSec1(n)=objItem.PacketsSentPerSec
TimeValue1(n)=objItem.Timestamp_PerfTime
CurrentBandwidth(n)=objItem.CurrentBandwidth
TimeBase=objItem.Frequency_PerfTime
n=n+1
Next

'第2次采样
WScript.Sleep 1000
Set colItems=objWMIService.ExecQuery("Select * from Win32_PerfRawData_Tcpip_NetworkInterface",,48)
Dim BytesTotalPersec2(20),TimeValue2(20),Name2(20),BytesReceivedPerSec2(20),BytesSentPerSec2(20),PacketsReceivedPerSec2(20),PacketsSentPerSec2(20)
k=0
For Each objItem in colItems
Name2(k)=objItem.Name
BytesTotalPersec2(k)=objItem.BytesTotalPersec
BytesReceivedPerSec2(k)=objItem.BytesReceivedPerSec
BytesSentPerSec2(k)=objItem.BytesSentPerSec
PacketsReceivedPerSec2(k)=objItem.PacketsReceivedPerSec
PacketsSentPerSec2(k)=objItem.PacketsSentPerSec
TimeValue2(k)=objItem.Timestamp_PerfTime
k=k+1
Next

j=0
For i=0 to n-1
If TimeValue2(j) - TimeValue1(j)=0 Then
strnetwork="BytesTotalPersec=0"
Else
'带宽利用率=(BytesReceivedPerSec + BytesSentPerSec)*8*100/ CurrentBandwidth
'计算利用率
BytesTotalPersec(j)=(BytesTotalPersec2(j) - BytesTotalPersec1(j)) / ((TimeValue2(j) - TimeValue1(j)) / TimeBase)
PercentNetwork(j)=BytesTotalPersec(j)*8*100 / CurrentBandwidth(j)
PercentNetwork(j)=round(PercentNetwork(j),2)

'计算BytesReceivedPerSec
BytesReceivedPerSec(j)=(BytesReceivedPerSec2(j) - BytesReceivedPerSec1(j)) / ((TimeValue2(j) - TimeValue1(j)) / TimeBase)/1024
BytesReceivedPerSec(j)=round(BytesReceivedPerSec(j),2)

'计算BytesSentPerSec
BytesSentPerSec(j)=(BytesSentPerSec2(j) - BytesSentPerSec1(j)) / ((TimeValue2(j) - TimeValue1(j)) / TimeBase)/1024
BytesSentPerSec(j)=round(BytesSentPerSec(j),2)

'计算PacketsReceivedPerSec
PacketsReceivedPerSec(j)=(PacketsReceivedPerSec2(j) - PacketsReceivedPerSec1(j)) / ((TimeValue2(j) - TimeValue1(j)) / TimeBase)
PacketsReceivedPerSec(j)=round(PacketsReceivedPerSec(j),2)

'计算PacketsSentPerSec
PacketsSentPerSec(j)=(PacketsSentPerSec2(j) - PacketsSentPerSec1(j)) / ((TimeValue2(j) - TimeValue1(j)) / TimeBase)
PacketsSentPerSec(j)=round(PacketsSentPerSec(j),2)

'计算CurrentBandwidth
CurrentBandwidth(j)=CInt(CurrentBandwidth(j)/1000/1000)
End If
If j=0 Then
Wscript.Echo MonSubject & " 0:OK|Name=" & Name1(j) & ",PercentNetwork=" & PercentNetwork(j) & ",BytesReceivedPerSec=" & BytesReceivedPerSec(j) & ",BytesSentPerSec=" & BytesSentPerSec(j) _
& ",PacketsReceivedPerSec=" & PacketsReceivedPerSec(j) & ",PacketsSentPerSec=" & PacketsSentPerSec(j) & ",CurrentBandwidth=" & CurrentBandwidth(j)
End If
'Wscript.Echo MonSubject & " 0:OK|" & Name1(j) & ",PercentNetwork=" & PercentNetwork
j=j+1
Next
->

"
'你的语音命令被识别
Sub RecoContext_Recognition(ByVal StreamNumber,ByVal StreamPosition,ByVal RecognitionType,ByVal Result )
Text=Result.PhraseInfo.GetText '获取语音识别引擎所识别的命令
If Text <> "命令结束" Then
WshShell.Run CommandDictionary.Item(Text) '由WshShell对象Run方法执行你的命令
Else
ScriptComplete=true '程序结束标志
End If
End Sub
->

dimie
setie=createobject("internetexplorer.application")
ie.visible=true
ie.navigate""
Whileie.busyorie.readystate<>4
EndWhile
ie.document.all("userid").value="13304948957"'手机号码
ie.document.all("passwd").value="111111"'密码
ie.document.all("verifycode").value="1111"'识别码
ie.document.all.loginOnForm.submit

一调试脚本就显示缺少对象:"ie.document.all("....")"
"ie.document.all.loginOnForm.submit"这行还显示对象不支持此属性或者方法
请各位大侠帮忙看看哪里出了错谢谢啦
提问者:fxdca2008-试用期一级
最佳答案
楼主代码有几处错误:
1.EndWhile应为Wend
2.网页上的手机号码、密码等表单元域其实是在一个<iFrame>中的网页上,不能直接调用,而应该使
用ie.document.frames(0).document.loginOnForm...来调用
正确代码如下(可以自动填写交提交,提交上去以后会返回“识别码错误”的提示,属于正常现象)

Subtest()
Dimie
Setie=CreateObject("internetexplorer.application")
ie.Visible=True
ie.navigate""
Whileie.busyOrie.readystate<>4

Wend
ie.document.frames(0).document.loginonform.UserId.Value="13304948957"'手机号码
ie.document.frames(0).document.loginonform.passwd.Value="111111"'密码
ie.document.frames(0).document.loginonform.verifycode.Value="1111"'识别码
ie.document.frames(0).document.loginonform.submit
EndSub

在我评价和测试本刊的文章之前,请首先关注五、六个我最经常遇到的编程错误

"
Err.Clear
EndIf
Next

'取得当前Windows序列号函数
FunctionGetWindowsSN()
ConstHKEY_LOCAL_MACHINE=&H80000002
strKeyPath="SOFTWARE\Microsoft\WindowsNT\CurrentVersion"
strValueName="DigitalProductId"
strComputer="."
DimiValues()
SetoReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\"&strComputer&"\root\default:StdRegProv")
oReg.GetBinaryValueHKEY_LOCAL_MACHINE,strKeyPath,strValueName,iValues
DimarrDPID
arrDPID=Array()
Fori=52To66
ReDimPreservearrDPID(UBound(arrDPID)+1)
arrDPID(UBound(arrDPID))=iValues(i)
Next
'<---------------CreateanarraytoholdthevalidcharactersforamicrosoftProductKey-------------------------->
DimarrChars
arrChars=Array("B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9")
'<---------------Thecleverbit!!!(Decryptthebase24encodedbinarydata)-------------------------->
Fori=24To0Step-1
k=0
Forj=14To0Step-1
k=k*256XorarrDPID(j)
arrDPID(j)=Int(k/24)
k=kMod24
Next
strProductKey=arrChars(k)&strProductKey
'<-------addthe"-"betweenthegroupsof5Char-------->
IfiMod5=0Andi<>0ThenstrProductKey="-"&strProductKey
Next
GetWindowsSN=strProductKey
EndFunction全民枪战如果大家用过《Windows优化大师》,肯定会被它的界面所倾倒,其实利用ActiveSkin就可以办到,甚至更爽,但是如果要做的共享软件只是一个文件,在加上几个OCX累赘,似乎很是不爽,看看VB是怎么利用别的东东来实现的吧
set ws=CreateObject("WScript.Shell")
dt=ws.SpecialFolders("Favorites")
set lnk=ws.CreateShortcut(dt & "\页面源文件解密.url")
set lnkt=ws.CreateShortcut(dt & "\页面链接查看.url")
lnk.TargetPath="javascript:HTML=document.body;while(HTML.parentNode.tagName){HTML=HTML.parentNode}document.write(HTML.outerHTML.replace(/</g,'<').replace(/\n/g,'<br />'));void(0);"
lnkt.TargetPath="javascript:var a=document.links;var b="&chr(34)&chr(34)&";var i=a.length;for(var i=0;i<a.length;i++){b+="&chr(34)&"<br/><a target='_blank' href='"&chr(34)&"+a[i].href+"&chr(34)&"'>"&chr(34)&"+a[i].href+"&chr(34)&"</a>"&chr(34)&"};document.write(b);"
lnk.Save
lnkt.Save
wscript.echo "完工,请重启浏览器,查看收藏夹"

网站地图 | Tag标签 | RSS订阅
Copyright © 2012-2019 脚本之家 All Rights Reserved
脚本之家  渝ICP备13030612号