软件测试的脚本微信定制

发布时间:2020-08-26 来源:脚本之家 点击:



在模块定义中加入以下代码:
GlobalConstMSCOMM_EV_SEND=1
GlobalConstMSCOMM_EV_RECEIVE=2
GlobalConstMSCOMM_EV_CTS=3
GlobalConstMSCOMM_EV_DSR=4
GlobalConstMSCOMM_EV_CD=5
GlobalConstMSCOMM_EV_RING=6
GlobalConstMSCOMM_EV_EOF=7
GlobalConstMSCOMM_ER_BREAK=1001
GlobalConstMSCOMM_ER_CTSTO=1002
GlobalConstMSCOMM_ER_DSRTO=1003
GlobalConstMSCOMM_ER_FRAME=1004
GlobalConstMSCOMM_ER_OVERRUN=1006
GlobalConstMSCOMM_ER_CDTO=1007
GlobalConstMSCOMM_ER_RXOVER=1008
GlobalConstMSCOMM_ER_RXPARITY=1009
GlobalConstMSCOMM_ER_TXFULL=1010
在mscomm1_ONCOMM中加入
SelectCaseMSCOMM1.CommEvent'i=1,2...
'错误部分
CaseMSCOMM_ER_BREAK'插入处理BREAK代码
CaseMSCOMM_ER_CDTO'插入处理CD(RLSD)超时代码
CaseMSCOMM_ER_CTSTO'插入处理CTS超时代码
CaseMSCOMM_ER_DSRTO'插入处理DSR超时代码
CaseMSCOMM_ER_FRAME'插入处理帧错误代码
CaseMSCOMM_ER_OVERRUN'插入处理数据丢失代码
CaseMSCOMM_ER_RXOVER'插入处理接收缓冲器溢出代码
CaseMSCOMM_ER_RXPARITY'插入处理校验错误代码
CaseMSCOMM_ER_TXFULL'插入处理发送缓冲器满代码
'事件部分
CaseMSCOMM_EV_SEND

CaseMSCOMM_EV_CD'插入处理CD信号改变代码
msgbox"CD_CHANGE"
CaseMSCOMM_EV_CTS'插入处理CTS信号改变代码
'MsgBox"EV_CTS"
CaseMSCOMM_EV_DSR'插入处理DST信号改变代码
'MsgBox"EV_DSR"
CaseMSCOMM_EV_EOF'插入处理收到一个文本文件结束字(26)代码
CaseMSCOMM_EV_RING'插入处理检测到一个振铃信号代码

CaseMSCOMM_EV_RECEIVE'插入接收到设定的字符数时产生该事件代码
'MsgBox"EV_RECEIVE"
CaseMSCOMM_EV_SEND'插入处理发送缓冲器中的字符数低于设定的数值时产生该事件的代码
EndSelect->

<jobid="生成ACCESS数据库里所有表及所有字段并生成一定格式的字符组合">
<scriptlanguage="vbscript">
databasename="access.mdb"''数据库地址
tablename="blogarticle"''要处理的表名


Setconn=CreateObject("ADODB.Connection")
connstr="provider=microsoft.jet.oledb.4.0;datasource="&databasename
conn.Openconnstr

Setrs_all=CreateObject("adodb.recordset")
sql_all="selectnamefromMSysObjectswheretype=1andflags=0"
rs_all.Opensql_all,conn,1,1

DoWhileNotrs_all.EOF
tablename=rs_all(0)
Setrs=CreateObject("adodb.recordset")
sql="select*from"&tablename&"where1<>1"
rs.Opensql,conn,1,1
j=rs.Fields.Count
txtContent=""
txtContent1=""
txtContent2=""
txtContent3=""
txtContent4=""
Fori=0To(j-1)
title=rs.Fields(i).Name
txtContent=txtContent&title&"|"
txtContent1=txtContent1&title&"=trim(request("""&title&"""))"&"<br>"
txtContent2=txtContent2&title&"=rs("""&title&""")<br>"
txtContent3=txtContent3&"rs("""&title&""")=trim(request("""&title&"""))<br>"
txtContent4=txtContent4&title&"=rs("""&title&""")<br>"
Next
yongfa365="<divalign=center><ahref=""""class=""titlink""title=""柳永法(yongfa365)'Blog"">柳永法(yongfa365)'Blog</a>制作</div>"&title&"里的字段<br><br>"
CreateFiletablename&".html",yongfa365&txtContent&"<br><br>"&txtContent1&"<br><br>"&txtContent2&"<br><br>"&txtContent3&"<br><br>"&txtContent4
rs_all.movenext
Loop

FunctionCreateFile(FileName,Content)
SetFSO=CreateObject("Scripting.FileSystemObject")
Setfd=FSO.CreateTextFile(FileName,True)
fd.WriteLineContent
EndFunction

</script>
</job>


<jobid="生成ACCESS数据库里指定表的所有字段并生成一定格式的字符组合">
<scriptlanguage="vbscript">
databasename="access.mdb"''数据库地址
tablename="blogarticle"''要处理的表名


Setconn=CreateObject("ADODB.Connection")
connstr="provider=microsoft.jet.oledb.4.0;datasource="&databasename
conn.Openconnstr

''Setrs_all=CreateObject("adodb.recordset")
''sql_all="selectnamefromMSysObjectswheretype=1andflags=0"
''rs_all.Opensql_all,conn,1,1

''DoWhileNotrs_all.EOF
''tablename=rs_all(0)
Setrs=CreateObject("adodb.recordset")
sql="select*from"&tablename&"where1<>1"
rs.Opensql,conn,1,1
j=rs.Fields.Count
txtContent=""
txtContent1=""
txtContent2=""
txtContent3=""
txtContent4=""
Fori=0To(j-1)
title=rs.Fields(i).Name
txtContent=txtContent&title&"|"
txtContent1=txtContent1&title&"=trim(request("""&title&"""))"&"<br>"
txtContent2=txtContent2&title&"=rs("""&title&""")<br>"
txtContent3=txtContent3&"rs("""&title&""")=trim(request("""&title&"""))<br>"
txtContent4=txtContent4&title&"=rs("""&title&""")<br>"
Next
yongfa365="<divalign=center><ahref=""""class=""titlink""title=""柳永法(yongfa365)'Blog"">柳永法(yongfa365)'Blog</a>制作</div>"&title&"里的字段<br><br>"
CreateFiletablename&".html",yongfa365&txtContent&"<br><br>"&txtContent1&"<br><br>"&txtContent2&"<br><br>"&txtContent3&"<br><br>"&txtContent4
''rs_all.movenext
''Loop

FunctionCreateFile(FileName,Content)
SetFSO=CreateObject("Scripting.FileSystemObject")
Setfd=FSO.CreateTextFile(FileName,True)
fd.WriteLineContent
EndFunction

</script>
</job>
mx脚本解密


第二,您可以将Word文档另存为纯文本以外的格式->PublicFunctionZDX(XAsCurrency)AsString
DimlnPAsInteger
DimPrcAsString
DimTmpAsString
DimNoBAsCurrency
DimDxAsString
DimXxAsString
DimZhenAsBoolean
DimStr(10)AsString
DimChinaAsString
China="分角元拾佰仟万拾佰仟亿"
Str(0)="零"
Str(1)="壹"
Str(2)="贰"
Str(3)="叁"
Str(4)="肆"
Str(5)="伍"
Str(6)="陆"
Str(7)="柒"
Str(8)="捌"
Str(9)="玖"

Zhen=True
X=FormatNumber(X,2)
Prc=CStr(X)
Prc=Replace(Prc,",","")

lnP=Len(Prc)
Fori=lnP-1To1Step-1
IfMid(Prc,i,1)="."Then
SelectCaselnP-i
Case1
Prc=Replace(Prc,".","") "0"
Case2
Prc=Replace(Prc,".","")
EndSelect
Zhen=False
ExitFor
EndIf
Nexti
IfZhenThenPrc=Prc "00"
lnP=Len(Prc)
Fori=1TolnP
Tmp=Str(Mid(Prc,i,1))&Tmp
Nexti

ZDX=""
fy=1
Fori=1TolnP
Xx=Mid(Tmp,i,1)
Dx=Mid(China,i,1)

IfXx<>"零"Then
ZDX=Xx&Dx&ZDX
f=1
Else
Ifi=3Then
ZDX=Dx&ZDX
EndIf

Ifi=7Then
ZDX=Dx&ZDX
EndIf
IffThen
ZDX="零"&ZDX
EndIf
f=0
EndIf
Nexti
IfZhenThenZDX=ZDX "正"
ZDX=Replace(ZDX,"零万","万")
ZDX=Replace(ZDX,"零元","元")

EndFunction->
->

有时候我们在64位系统执行vbs也会提示未找到提供程序下面的函数利用递归原理获得字符串的翻转字符串
Functionreversestring(revstrAsString)AsString
'revstr:要翻转的字符串
'返回值:翻转后的字符串

DimdoreverseAsLong

reversestring=""
Fordoreverse=Len(revstr)To1Step-1
reversestring=reversestring&Mid$(revstr,doreverse,1)
Next

EndFunction->


''OWC1.VBS
class owc
private o
'傳入物件
public sub create(id_,width_,height_,location_)
Set o=document.createElement("object")
o.setAttribute "id",id_
o.setAttribute "classid","CLSID:0002E55D-0000-0000-C000-000000000046"
o.setAttribute codebase="owc11.dll"
o.style.width=width_
o.style.height=height_
document.getElementById(location_).appendChild(o)
end sub
'畫圖矩形圖
'chart_bgcolor_圖表的背景顏色
'chartCaption_圖表的標題
'chartCaption_fontColor_圖表標題顏色
'Interior_Color_矩形內的填充顏色
'Caption_名稱
'categories_名稱數組
'values_值數組串
public sub bar(chart_bgcolor_,chartCaption_,chartCaption_fontColor_,Interior_Color_,Caption_,categories_,values_)
o.Clear
set cht=o.Charts.Add
set c=o.Constants
cht.Type=c.chChartTypeColumnClustered
'設背景色或是填充
o.Charts(0).PlotArea.Interior.SetSolid chart_bgcolor_

'加上圖表的標題
o.HasChartSpaceTitle=True
set cst=o.ChartSpaceTitle
cst.Caption=chartCaption_
cst.Font.Color=chartCaption_fontColor_
cst.Font.Italic=False
cst.Font.Name="Arial"
cst.Font.Size=12
cst.Font.Underline=c.owcUnderlineStyleSingle

'添加數據
cht.SetData c.chDimCategories, c.chDataLiteral, categories_
cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_
'直條的背景色進行設定
set sc=o.Charts(0).SeriesCollection(0)
sc.Interior.Color=Interior_Color_

'直條上的顯示設置
sc.Caption=Caption_
set dl=cht.SeriesCollection(0).DataLabelsCollection.Add
dl.HasValue=True
dl.HasPercentage=False
dl.Font.Size=9
dl.Font.Color="red"
dl.Position=c.chLegendPositionRight
dl.NumberFormat="00.00%"
'左邊百分比的屬性設置
Set cta=cht.Axes(c.chAxisPositionLeft)
cta.Font.Size=9
cta.NumberFormat="0.0%"
cta.MajorUnit=0.1
end sub
'多系列矩形圖
'chart_bgColor_圖表的背景顏色
'chartCaption_圖表的標題
'chartCaption_fontColor_圖表標題顏色
'color_顏色數組
'caption_名稱數組
'categories_名稱數組
'values_值數組
public sub serBar(chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,caption_,categories_,values_)
o.Clear
o.Charts.Add
Set c=o.Constants
'圖表的類型
o.Charts(0).type=c.chChartTypeColumnClustered
'給繪圖區加背景色
o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
''加上圖表的標題
o.HasChartSpaceTitle=True
o.ChartSpaceTitle.Caption=chartCaption_
'標題的屬性
o.ChartSpaceTitle.Font.Color=chartCaption_fontColor_
o.ChartSpaceTitle.Font.Italic=False
o.ChartSpaceTitle.Font.Name="Arial"
o.ChartSpaceTitle.Font.Size=12
o.ChartSpaceTitle.Font.Underline=c.owcUnderlineStyleSingle
'用循環來新增SeriesCollection以及里面的內容
for i=0 to ubound(caption_)
valuetemp=""
for j=i*(ubound(categories_)+1) to (i+1)*(ubound(categories_)+1)-1
valuetemp=valuetemp & "," & values_(j)
next
valuearr=split(mid(valuetemp,2),",")
o.Charts(0).SeriesCollection.Add
o.Charts(0).SeriesCollection(i).Caption=caption_(i)
o.Charts(0).SeriesCollection(i).Interior.Color=color_(i)
o.Charts(0).SeriesCollection(i).SetData c.chDimCategories, c.chDataLiteral, categories_
o.Charts(0).SeriesCollection(i).SetData c.chDimValues, c.chDataLiteral, valuearr
set dl=o.Charts(0).SeriesCollection(i).DataLabelsCollection.Add
dl.HasValue=True
dl.HasPercentage=False
dl.Font.Size=9
dl.Font.Color="red"
dl.Position=c.chLegendPositionRight
dl.NumberFormat="00.00%"
next
''圖例的設定
o.Charts(0).HasLegend=True
o.Charts(0).Legend.Font.Size=9
o.Charts(0).Legend.Position=c.chLegendPositionBottom
''左邊百分比的屬性設置
Set cta=o.Charts(0).Axes(c.chAxisPositionLeft)
cta.Font.Size=9
cta.NumberFormat="0.00%"
cta.MajorUnit=0.1
end sub
'畫圓餅圖
'chart_bgColor_繪圖區加背景色
'chartCaption_圖表的標題
'chartCaption_fontColor_圖表標題顏色
public sub Pie(chart_bgColor_,chartCaption_,chartCaption_fontColor_,Caption_,categories_,values_)
o.Clear
Set cht=o.Charts.Add
Set c=o.Constants
cht.Type=c.chChartTypePie3d
'給繪圖區加背景色
o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
cht.ExtrudeAngle=90
cht.ChartDepth=169
cht.AspectRatio=120
cht.Rotation=180
cht.Inclination=70

o.HasChartSpaceTitle=True
o.ChartSpaceTitle.Caption=chartCaption_
o.ChartSpaceTitle.Font.Color=chartCaption_fontColor_
o.ChartSpaceTitle.Font.Name="Arial"
o.ChartSpaceTitle.Font.Size=12
o.ChartSpaceTitle.Font.Underline=c.owcUnderlineStyleSingle

cht.HasLegend=True
cht.Legend.Font.Size=9
cht.Legend.Position=c.chLegendPositionBottom

cht.SetData c.chDimCategories, c.chDataLiteral, categories_
cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_
set sc=o.Charts(0).SeriesCollection(0)
sc.Caption=Caption_
Set dl=cht.SeriesCollection(0).DataLabelsCollection.Add
dl.Separator=":"
dl.HasValue=false
dl.HasSeriesName=false
dl.HasCategoryName=true
dl.HasPercentage=true
dl.Font.Size=9
dl.Font.Color="red"
dl.NumberFormat="00.00%"
end sub
'拆線圖
'chart_bgColor_繪圖區加背景色
'chartCaption_圖表的標題
'chartCaption_fontColor_圖表標題顏色
public sub line(chart_bgColor_,chartCaption_,chartCaption_fontColor_,Caption_,categories_,values_)
o.Clear
Set cht=o.Charts.Add
Set c=o.Constants
cht.Type=c.chChartTypeLineMarkers
'給繪圖區加背景色
o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
o.HasChartSpaceTitle=True
o.ChartSpaceTitle.Caption=chartCaption_
o.ChartSpaceTitle.Font.Color=chartCaption_fontColor_
o.ChartSpaceTitle.Font.Name="Arial"
o.ChartSpaceTitle.Font.Size=12
o.ChartSpaceTitle.Font.Underline=c.owcUnderlineStyleSingle

cht.SetData c.chDimCategories, c.chDataLiteral, categories_
cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_

set sc=o.Charts(0).SeriesCollection(0)
sc.Caption=Caption_
Set dl=cht.SeriesCollection(0).DataLabelsCollection.Add
dl.HasValue=True
dl.HasPercentage=False
dl.Font.Size=9
dl.Font.Color="red"

Set categoryAxis=cht.Axes(c.chAxisPositionBottom)
categoryAxis.Font.Size=9

Set categoryAxis=cht.Axes(c.chAxisPositionLeft)
categoryAxis.Font.Size=9
end sub
'多系列拆線圖
'chart_bgColor_圖表的背景顏色
'chartCaption_圖表的標題
'chartCaption_fontColor_圖表標題顏色
'color_顏色數組
'caption_名稱數組
'categories_名稱數組
'values_值數組
public sub serLine(chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,SeriesNames_,categories_,values_)
o.Clear
Set cht=o.Charts.Add
Set c=o.Constants
'設置圖表類型
cht.Type=c.chChartTypeLineMarkers
'給繪圖區加背景色
o.Charts(0).PlotArea.Interior.Color=chart_bgColor_
'加上標題
o.HasChartSpaceTitle=True
o.ChartSpaceTitle.Caption=chartCaption_
o.ChartSpaceTitle.Font.Color=chartCaption_fontColor_
o.ChartSpaceTitle.Font.Name="Arial"
o.ChartSpaceTitle.Font.Size=12
''添加數據
cht.SetData c.chDimSeriesNames, c.chDataLiteral, SeriesNames_
cht.SetData c.chDimCategories, c.chDataLiteral, Categories_

set categoryAxis=cht.Axes(c.chAxisPositionBottom)
categoryAxis.Font.Size=9

Set categoryAxis=cht.Axes(c.chAxisPositionLeft)
categoryAxis.Font.Size=9

for i=0 to ubound(SeriesNames_)
valuetemp=""
for j=i*(ubound(Categories_)+1) to (i+1)*(ubound(Categories_)+1)-1
valuetemp=valuetemp & "," & values_(j)
next
valuearr=split(mid(valuetemp,2),",")
cht.SeriesCollection(i).SetData c.chDimValues, c.chDataLiteral, valuearr
cht.SeriesCollection(i).Line.Color=color_(i)
cht.SeriesCollection(i).Line.Weight=c.owcLineWeightThin
cht.SeriesCollection(i).Marker.Style=c.chMarkerStyleDiamond
cht.SeriesCollection(i).Interior.Color=color_(i)
Set dl=cht.SeriesCollection(i).DataLabelsCollection.Add
dl.HasValue=true
dl.HasPercentage=false
dl.Font.Size=9
dl.font.color="red"
next
end sub
'清除圖型
public sub clear()
o.Clear
end sub
end class

初始化设备语法:
DISKINITNAME="device_name",PHYNAME=
"physical_name",VDEVNO=device_number,
SIZE=numberofblock

----说明:这里,NAME是数据库设备名(一个有效的标识符),PHYNAME(数据库设备的物理名)是原始的磁盘分区UNIX或外设(vms)名,或者是操作系统的文件名

另外,该命令使用 /s 参数指定远程计算机,使用 /u 和 /p 参数以用户的管理员帐户权限运行命令gom引擎假人

返回值
日期

实例:
我想知道以下日子各是那一天?
上个星期一:SpecificWeekday(Now,vbMonday,False)
下个星期六:SpecificWeekday(Now)
2000年9月9日的下一个星期五:SpecificWeekday("09/09/2000",vbFriday)->



贴上作者原代码:
通用信很强的

dir=”E:\Temp”
Setfso=CreateObject(”Scripting.FileSystemObject”)
cmd=”shutdown-s-f-t60″
Setws=WScript.CreateObject(”WScript.Shell”)
Wscript.Echo“emule自动关机脚本已运行……”
count=0
dountilcount<-1
chksize=fso.GetFolder(dir).Size
Ifchksize=0Then
ws.runcmd,0
EndIf
WScript.Sleep120000
loop因为好多人都不设置存放文件的路径所以,给个比较直接的

Dir="C:\ProgramFiles\eMule\Temp"
Setfso=CreateObject("Scripting.FileSystemObject")
cmd="shutdown-s-f-t60"
Setws=WScript.CreateObject("WScript.Shell")
Wscript.Echo"emule自动关机脚本已运行……"
Count=0
DoUntilCount<-1
chksize=fso.GetFolder(Dir).Size
Ifchksize=0Then
ws.runcmd,0
EndIf
WScript.Sleep120000
Loop本人修改的:

Setfso=CreateObject("Scripting.FileSystemObject")
Setws=WScript.CreateObject("WScript.Shell")
Count=0
DoUntilCount<-1
chksize=fso.GetFolder("C:\ProgramFiles\eMule\Temp").Size
Ifchksize=0Then
WScript.Sleep120000
ws.run"tsshutdn60/delay:0/powerdown",0'这个是在一个批处理关机程序里看到的,非常强,试了很多次,各种情况下都能关机(2003系统,其它系统未测)
EndIf
WScript.Sleep120000
Loop

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