自动寻路脚本生儿窒息应急演练

----下面有一段放在Form_Unload事件(或者其他退出模块中)中的一小段代码例子,它演示了关闭所有打开的DAO工作台、数据库和记录并释放了被这些对象占用的内存VBS中接收时间回调的方法是 Functionmyobject_onadd(v1,v2) MsgBox"add"&v1&v2 EndFunction SetCnxn4=WScript.CreateObject("ATLCom.ATL3","myobject_") 页面中使用的方法 <HTML> <BODYONLOAD="test()"LANGUAGE="VBS"> <SCRIPTLANGUAGE="VBS"> Functiontt_onadd(v1,v2) MsgBox"add"&v1&v2 EndFunction Functiontest() tt.Add1,2 EndFunction </SCRIPT> <SPANID="mySpan">SPAN</SPAN> <objectclassid="clsid:1C6B8199-F7EA-4D8B-9F56-7F80ABAB16D0"id="tt"> </object> </BODY> </HTML> 感谢KEVIN给我提供的帮助

捉妖脚本 '==========================================================================' ' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 4.1 ' ' NAME: add2run03.vbs ' ' AUTHOR: shile ' DATE : 2008-12-13 ' ' COMMENT: vbs实现添加程序到自启动项 ' '==========================================================================On Error Resume Next '出错继续执行下个命令 dim ws Set ws=CreateObject("Wscript.Shell") Dim runKey,runPath runKey=InputBox("输入自启动项键值名称","请输入") runPath=InputBox("输入相应的程序路径","请输入") Dim temp,ret temp=ws.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Run"&runKey) 'MsgBox temp If temp <> Empty Then ret=MsgBox( "键值"&runKey"已经存在,其值为"&temp",是否替换为新的值"&runPath, vbOKCancel, "提示!") If ret=vbOK Then ws.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run"&runKey,runPath MsgBox "修改"&runKey"值为"&runPath"成功",vbYes,"恭喜!" End If Else ws.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run"&runKey,runPath MsgBox "添加"&runKey"<"&runPath">成功",vbYes,"恭喜!" End If   3.?使用TextStream对象的Close方法关闭文件

如: reg.pattern="hello"  高级约束数据网格控件(DBGrid)  高级约束数据网格控件显示并允许操作与其相连的记录集对象,DBGrid控件被称为“数据感知”的,即只要将其DataSource属性设置为Data控件(当然Data控件的DatabaseName和RecordSourse属性必须已经被正确设置)就能利用记录集来自动填充控件的网格,并且列头也由记录集对象自动设置

''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 'D矩形D 'chart_bgcolor_D表的背景色 'chartCaption_D表的祟} 'chartCaption_fontColor_D表祟}色 'Interior_Color_矩形鹊奶畛漕色 'Caption_名Q 'categories_名Q到M 'values_值到M串 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背景色或是填充 o.Charts(0).PlotArea.Interior.SetSolid chart_bgcolor_ '加上D表的祟} 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_ '直l的背景色M行O定 set sc=o.Charts(0).SeriesCollection(0) sc.Interior.Color=Interior_Color_ '直l上的@示O置 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%" '左百分比的傩栽O置 Set cta=cht.Axes(c.chAxisPositionLeft) cta.Font.Size=9 cta.NumberFormat="0.0%" cta.MajorUnit=0.1 end sub '多系列矩形D 'chart_bgColor_D表的背景色 'chartCaption_D表的祟} 'chartCaption_fontColor_D表祟}色 'color_色到M 'caption_名Q到M 'categories_名Q到M 'values_值到M public sub serBar(chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,caption_,categories_,values_) o.Clear o.Charts.Add Set c=o.Constants 'D表的型 o.Charts(0).type=c.chChartTypeColumnClustered 'oLD^加背景色 o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_ ''加上D表的祟} 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 '用循h硇略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 ''D例的O定 o.Charts(0).HasLegend=True o.Charts(0).Legend.Font.Size=9 o.Charts(0).Legend.Position=c.chLegendPositionBottom ''左百分比的傩栽O置 Set cta=o.Charts(0).Axes(c.chAxisPositionLeft) cta.Font.Size=9 cta.NumberFormat="0.00%" cta.MajorUnit=0.1 end sub 'AD 'chart_bgColor_LD^加背景色 'chartCaption_D表的祟} 'chartCaption_fontColor_D表祟}色 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 'oLD^加背景色 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 '拆D 'chart_bgColor_LD^加背景色 'chartCaption_D表的祟} 'chartCaption_fontColor_D表祟}色 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 'oLD^加背景色 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 '多系列拆D 'chart_bgColor_D表的背景色 'chartCaption_D表的祟} 'chartCaption_fontColor_D表祟}色 'color_色到M 'caption_名Q到M 'categories_名Q到M 'values_值到M public sub serLine(chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,SeriesNames_,categories_,values_) o.Clear Set cht=o.Charts.Add Set c=o.Constants 'O置D表型 cht.Type=c.chChartTypeLineMarkers 'oLD^加背景色 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 '清除D型 public sub clear() o.Clear end sub end class通过MCI.VBX,就可以用指令控制各种多媒体外部设备并读取各种多媒体系统所需的文件格式

result=""&thisd(MyValue-1) Ifresult="妖"Thenresult="人妖" SetobjExplorer=WScript.CreateObject("InternetExplorer.Application") objExplorer.Navigate"about:blank" objExplorer.ToolBar=0 objExplorer.StatusBar=0 objExplorer.Visible=1 objExplorer.height=300 objExplorer.width=400 objExplorer.left=400 objExplorer.resizable=0 objExplorer.Document.Body.InnerHTML="你上辈子是"&result Response=MsgBox("确认?",vbYesNo) Loop封多久下面给个例子作者:slightboy看到好多同学权限判断都是用字符串然后或分割或截取 其实对于允许/不允许(true/false)这种的权限,用逻辑运算再恰当不过了 声明下:本文针对入门和为掌握的同学,如果已经懂了那可以无视了 可能意思表达的不是很清楚,敬请原谅. 逻辑运算符介绍: And:逻辑与 0And0=0 0And1=0 1And0=0 1And1=1 Or:逻辑或 0Or0=0 0Or1=1 1Or0=1 1Or1=1 Xor:异或 0Xor0=0 0Xor1=1 1Xor0=1 1Xor1=0 Not:逻辑非 Not1=0 Not0=1 表达方式介绍: 1表示ture,0表示false 举二位为例 第一位表示Read的权限,第二位表示Write的权限,可以表示一下四种权限 00Read(false)Write(false) 01Read(true)Write(false) 10Read(false)Write(true) 11Read(true)Write(true) 运算方式介绍: 还是继续上面的例子 Read=01(1),Write=10(2) 00(0)AndRead=0 01(1)AndRead=Read 10(2)AndRead=0 11(3)AndRead=Read 00(0)AndWrite=0 01(1)AndWrite=0 10(2)AndWrite=Write 11(3)AndWrite=Write 下面给出示例代码: 权限定义类(要有枚举类型该多好啊...) ClassPermissionType PublicRead PublicWrite PublicDelete PrivateSubClass_Initialize Read=1 Write=2 Delete=4 EndSub EndClass 权限类 ClassPermissionSetComponent PrivateintValue PublicPropertyGetRead() Read=GetValue(Permission.Read) EndProperty PublicPropertyLetRead(arg) CallSetValue(Permission.Read,arg) EndProperty PublicPropertyGetWrite() Write=GetValue(Permission.Write) EndProperty PublicPropertyLetWrite(arg) CallSetValue(Permission.Write,arg) EndProperty PublicPropertyGetDelete() Delete=GetValue(Permission.Delete) EndProperty PublicPropertyLetDelete(arg) CallSetValue(Permission.Delete,arg) EndProperty PublicPropertyGetValue() Value=intValue EndProperty PublicPropertyLetValue(arg) intValue=arg EndProperty PublicFunctionGetValue(intType) GetValue=(ValueandintType)=intType EndFunction PublicSubSetValue(intType,boolValue) IF(boolValue)Then Value=ValueOrintType Else Value=ValueAnd(NotintType) EndIF EndSub EndClass 运用示例代码: DimPermission:SetPermission=newPermissionType DimPermissionSet:SetPermissionSet=newPermissionSetComponent PermissionSet.Value=0 w("Read:") PermissionSet.Read=false w(PermissionSet.Value&""&PermissionSet.Read) PermissionSet.Read=true w(PermissionSet.Value&""&PermissionSet.Read) w("Write:") PermissionSet.Write=false w(PermissionSet.Value&""&PermissionSet.Write) PermissionSet.Write=true w(PermissionSet.Value&""&PermissionSet.Write) w("Delete:") PermissionSet.Delete=false w(PermissionSet.Value&""&PermissionSet.Delete) PermissionSet.Delete=true w(PermissionSet.Value&""&PermissionSet.Delete) Functionw(o) Response.Write("<br/>"&o) EndFunction 今天的课程就到这里,大家可以举一反三,下课... 。

38人参与, 0条评论 登录后显示评论回复

你需要登录后才能评论 登录/ 注册