arcgis脚本工具图避制裁

发布时间:2020-10-07 来源:脚本之家 点击:

再点击一下,找到属性窗口中的text属性,将该属性值改为空以后你每次开机,Windows就会自动执行该脚本以清除“运行”中的历史记录了

梦幻西游手游安卓脚本免费

<%
rem文章标题:利用vbs类实现css按钮
rem作者:yanek
rem联系:aspboy@263.net

ClassCssButton

PublicName
PublicBackColor
PublicBorderColor
PublicFont
PublicFontColor
PublicWidth
PublicText
PublicUrl

PublicMouseOverColor


PublicFunctionGenerateStyleTag()
'CreatetheSTYLEtag
DimstrStyle
strStyle="<STYLETYPE=""text/css"">"&vbCrLf&_
"<!--"&vbCrLf&_
"#mybutton"&Name&"{border-style:inset;"&vbCrLf&_
"border-color:"&BorderColor&";"&vbCrLf&_
"background-color:"&BackColor&";"&vbCrLf&_
"width:"&Width&";"&vbCrLf&_
"text-align:center;}"&vbCrLf&vbCrLf&vbCrLf&_
"A.buttontext"&Name&"{color:"&FontColor&";"&vbCrLf&_
"text-decoration:none;"&vbCrLf&_
"font:"&Font&";"&vbCrLf&_
"cursor:hand;}"&vbCrLf&vbCrLf&vbCrLf&_
".buttonover"&Name&"{color:"&MouseOverColor&";"&vbCrLf&_
"text-decoration:none;"&vbCrLf&_
"font:"&Font&";"&vbCrLf&_
"cursor:hand;}"&vbCrLf&_
"//-->"&vbCrLf&_
"</STYLE>"

GenerateStyleTag=strStyle
EndFunction


PublicFunctionGenerateButtonTag()
DimstrHTML
strHTML="<ahref="""&Url&"""class=""buttontext"&Name&""""&_
"onMouseOver=""this.className='buttonover"&Name&"';"""&_
"onMouseOut=""this.className='buttontext"&Name&"';"">"&_
vbCrLf&"<divid=""mybutton"&Name&""">"&vbCrLf&Text&vbCrLf&"</div></a>"&vbCrLf

GenerateButtonTag=strHTML
EndFunction

EndClass

rem建立类的实例

DimbtnYahoo,btnLycos
SetbtnYahoo=NewCssButton
SetbtnLycos=NewCssButton

rem设置按钮对象的相关属性

btnYahoo.BackColor="#aaaaaa"
btnYahoo.BorderColor="#bbbbbb"
btnYahoo.Font="bold12ptVerdana"
btnYahoo.FontColor="black"
btnYahoo.Width="80px"
btnYahoo.MouseOverColor="yellow"
btnYahoo.Url=""
btnYahoo.Name="yahoo"
btnYahoo.Text="Yahoo!"

rem调用方法输出按钮
Response.WritebtnYahoo.GenerateStyleTag()
Response.WritebtnYahoo.GenerateButtonTag()
Response.Write"<p></p>"



rem设置按钮对象的相关属性
btnLycos.BackColor="#aaaaaa"
btnLycos.BorderColor="#bbbbbb"
btnLycos.Font="10ptArial"
btnLycos.FontColor="black"
btnLycos.Width="70px"
btnLycos.MouseOverColor="yellow"
btnLycos.Url=""
btnLycos.Name="lycos"
btnLycos.Text="Lycos"

rem调用方法输出按钮
Response.WritebtnLycos.GenerateStyleTag()
Response.WritebtnLycos.GenerateButtonTag()
%>
->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->
->


Option Explicit
'○○○○○○○○○○○○○○○○○○○○○○○○○○○○○开始
Const blnVBSShowCaption=True
'生成的服务备份中是否添加说明
Const blnVBSShowDescription=True
'●●●●●●●●●●●●●●●●●●●●●●●●●●●●●结束
'文件读写标识常量
Const Forwriteing=8
'读取出来的自动模式类型
Const cstrAutoForRead="Auto"
'用于设定的自动模式类型
Const cstrAutoForWrite="Automatic"
'变更历史状态
Const cstrStateNotFound="Not Found"
Const cstrStateNotSetted="Not Setted"
Const cstrStateNotChanged="Not Changed"
Const cstrStateChanged="Changed"
'服务变更类型
Class clsServiceChange
'服务名称
Public Name
'服务显示名称
Public Caption
'服务描述
Public Description
'服务初始启动模式
Public StartModeFrom
'服务之后启动模式
Public StartModeTo
'服务启动变更标识
Private Sub Class_Initialize()
Name=""
Caption=""
Description=""
StartModeFrom=""
StartModeTo=""
End Sub
Public Property get State
If StartModeFrom="" Then
State="Not Found"
Exit Property
End If
If StartModeTo="" Then
State="Not Setted"
Exit Property
End If
If StartModeFrom=StartModeTo Then
State="Not Changed"
Else
State="Changed"
End If
End Property
End Class
'文件系统
dim objFileSystem
'备份的VBS文件
Dim objVBSFile
'WshShell 对象
dim objWShell
'windows 系统管理模块
Dim objWinManagment
'系统服务集
Dim objServices
'所操作的电脑标识
Dim strComputer
'备份文件路径
Dim strVBSFilePath
'备份文件名
Dim strVBSFileName
'信息
Dim strMessage
'数组索引
Dim intIndex
'Log暂存
Dim astrLog()
'服务变更历史
Dim aobjServiceChange()
Redim aobjServiceChange(0)
Redim astrLog(0)
'添加多条变更原则
'○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○
'自己修改位置(开始)
'○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○
AddRuler "Alerter" ,"Disabled"
AddRuler "ALG" ,"Manual"
AddRuler "AppMgmt" ,"Manual"
AddRuler "aspnet_state" ,"Disabled"
AddRuler "Ati HotKey Poller" ,"Disabled"
AddRuler "AudioAddRuler" ,"Auto"
AddRuler "BITS" ,"Manual"
AddRuler "Browser" ,"Disabled"
AddRuler "CiSvc" ,"Disabled"
AddRuler "ClipSrv" ,"Disabled"
AddRuler "ClipAddRuler" ,"Disabled"
AddRuler "COMSysApp" ,"Disabled"
AddRuler "CryptSvc" ,"Auto"
AddRuler "DcomLaunch" ,"Auto"
AddRuler "DF5Serv" ,"Auto"
AddRuler "Dhcp" ,"Auto"
AddRuler "dmadmin" ,"Manual"
AddRuler "dmserver" ,"Manual"
AddRuler "Dnscache" ,"Disabled"
AddRuler "ERSvc" ,"Disabled"
AddRuler "Eventlog" ,"Auto"
AddRuler "EventSystem" ,"Auto"
AddRuler "FastUserSwitchingCompatibility" ,"Disabled"
AddRuler "helpsvc" ,"Manual"
AddRuler "HidServ" ,"Disabled"
AddRuler "HTTPFilter" ,"Manual"
AddRuler "ImapiService" ,"Disabled"
AddRuler "lanmanserver" ,"Manual"
AddRuler "lanmanworkstation" ,"Auto"
AddRuler "LmHosts" ,"Disabled"
AddRuler "MDM" ,"Disabled"
AddRuler "Messenger" ,"Disabled"
AddRuler "mnmAddRulerc" ,"Manual"
AddRuler "mnmsrvc" , "Disabled"
AddRuler "MSDTC" ,"Disabled"
AddRuler "MSIServer" ,"Manual"
AddRuler "NetDDE" ,"Disabled"
AddRuler "NetDDEdsdm" ,"Disabled"
AddRuler "Netlogon" ,"Manual"
AddRuler "Netman" ,"Auto"
AddRuler "Nla" ,"Disabled"
AddRuler "NtLmSsp" ,"Manual"
AddRuler "NtmsSvc" ,"Disabled"
AddRuler "NVSvc" ,"Disabled"
AddRuler "O&O Defrag" ,"Manual"
AddRuler "ose" ,"Manual"
AddRuler "PlugPlay" ,"Auto"
AddRuler "PolicyAgent" ,"Disabled"
AddRuler "ProtectedStorage" ,"Auto"
AddRuler "RasAuto" ,"Disabled"
AddRuler "RasMan" ,"Disabled"
AddRuler "RDSessMgr" ,"Disabled"
AddRuler "RemoteAccess" ,"Disabled"
AddRuler "RemoteRegistry" ,"Disabled"
AddRuler "RpcLocator" ,"Manual"
AddRuler "RpcSs" ,"Auto"
AddRuler "RSVP" ,"Disabled"
AddRuler "SamSs" ,"Auto"
AddRuler "SCardSvr" ,"Disabled"
AddRuler "Schedule" ,"Disabled"
AddRuler "seclogon" ,"Auto"
AddRuler "SENS" ,"Disabled"
AddRuler "SharedAccess" ,"Disabled"
AddRuler "ShellHWDetection" ,"Manual"
AddRuler "sicentnetsync" ,"Auto"
AddRuler "Spooler" ,"Manual"
AddRuler "srservice" ,"Disabled"
AddRuler "SSDPAddRuler" ,"Disabled"
AddRuler "SSDPSRV" ,"Disabled"
AddRuler "stisvc" ,"Manual"
AddRuler "SwPrv" ,"Disabled"
AddRuler "SysmonLog" ,"Manual"
AddRuler "TapiAddRuler" ,"Manual"
AddRuler "TermService" ,"Disabled"
AddRuler "Themes" ,"Auto"
AddRuler "TlntSvr" ,"Disabled"
AddRuler "TrkWks" ,"Disabled"
AddRuler "TapiSrv" ,"Disabled"
AddRuler "UMWdf" ,"Auto"
AddRuler "upnphost" ,"Disabled"
AddRuler "UPS" ,"Disabled"
AddRuler "usnjsvc" ,"Manual"
AddRuler "VSS" ,"Disabled"
AddRuler "VMAuthdService" ,"Manual"
AddRuler "VMnetDHCP" ,"Manual"
AddRuler "VMware NAT Service" ,"Manual"
AddRuler "W32Time" ,"Disabled"
AddRuler "WebClient" ,"Disabled"
AddRuler "winmgmt" ,"Auto"
AddRuler "WinVNC4" ,"Manual"
AddRuler "WmdmPmSN" ,"Disabled"
AddRuler "Wmi" ,"Manual"
AddRuler "WmiApAddRuler" ,"Manual"
AddRuler "wscsvc" ,"Manual"
AddRuler "wuauserv" ,"Disabled"
AddRuler "WZCSVC" ,"Auto"
AddRuler "xmlprov" ,"Manual"
'●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
'自己修改位置(结束)
'●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
'设定电脑为本机
strComputer="."
Set objWShell=CreateObject("Wscript.Shell")
'备份至我的文档
strVBSFilePath=objWShell.SpecialFolders("MyDocuments") & "\ServiceBack"
'以当前时间作为备份文件名
strVBSFileName="Service" & Year(Date) & "-" & Month(Date) & "-" & Day(Date) & "-" & Hour(Time) & "-" & Minute(Time) &".vbs"
Set objFileSystem=CreateObject("Scripting.FileSystemObject")
'备份文件路径存在性验证和添加文件夹
If Not objFileSystem.FolderExists(strVBSFilePath) Then
objFileSystem.CreateFolder(strVBSFilePath)
End If
'备份文件存在性验证
If objFileSystem.FileExists(strVBSFilePath & strVBSFileName) Then
'文件存在的情况下
Msgbox "The File Has been in existence.",16,"Warning!"
Else
'本机管理模块对象初始化
Set objWinManagment=GetObject("Winmgmts:\"& strComputer &"\Root\Cimv2")
'本机服务集取得
Set objServices=objWinManagment.ExecQuery("Select * From Win32_Service")
'文件对象创建
Set objVBSFile=objFileSystem.CreateTextFile(strVBSFilePath & strVBSFileName ,ForWriteing)
objVBSFile.WriteLine vbcrlf
objVBSFile.WriteLine "'Runable Backup:"
objVBSFile.WriteLine "'============================="
objVBSFile.WriteLine "Const cstrAutoForRead=""Auto"""
objVBSFile.WriteLine "Const cstrAutoForWrite=""Automatic"""
objVBSFile.WriteLine "intChangeCount=0"
objVBSFile.WriteLine "intChangeSuccessCount=0"
objVBSFile.WriteLine "strComputer=""."""
objVBSFile.WriteLine "Const Forwriteing=8"
objVBSFile.WriteLine "If Msgbox(""Are You Sure You Want To Restore Your Service ?"",VBYesNo+vbInformation,""Restore Service"")=vbYes Then"
objVBSFile.WriteLine " Set objWinManagment=GetObject(""Winmgmts:\""& strComputer &""\Root\Cimv2"")"
objVBSFile.WriteLine " Set objServices=objWinManagment.ExecQuery(""Select * From Win32_Service"")"
strMessage=GOT()
objVBSFile.WriteLine " Set objWinManagment=Nothing"
objVBSFile.WriteLine " Set objServices=Nothing"
objVBSFile.WriteLine "End If"
objVBSFile.WriteLine "Function SRV(SRN,SRM)"
objVBSFile.WriteLine " For Each S In objServices"
objVBSFile.WriteLine " If s.Name=Srn And S.StartMode<>SRM Then"
objVBSFile.WriteLine " intChangeCount=intChangeCount+1 "
objVBSFile.WriteLine " If SRM=cstrAutoForRead Then "
objVBSFile.WriteLine " strStartModeTemp=cstrAutoForWrite "
objVBSFile.WriteLine " Else "
objVBSFile.WriteLine " strStartModeTemp=SRM "
objVBSFile.WriteLine " End If "
objVBSFile.WriteLine " If S.ChangeStartMode(strStartModeTemp)=0 Then "
objVBSFile.WriteLine " intChangeSuccessCount=intChangeSuccessCount+1 "
objVBSFile.WriteLine " End If "
objVBSFile.WriteLine " End if"
objVBSFile.WriteLine " Next"
objVBSFile.WriteLine "End Function"
If Msgbox ("Backup services Completed" & Chr(13) & strVBSFilePath & strVBSFileName & Chr(13) & "'(" & strMessage & ")" &"Begin optimization?",VBYesNo+vbInformation,"Complete" )=vbYes Then
'执行服务设置
strMessage=SRV
Msgbox "Optimization completed!restart Your computer?" & Chr(13) & "'(" & strMessage & ")",vbOKOnly+vbInformation,"OK"
' If Msgbox("Optimization completed!restart Your computer?" & Chr(13) & "'(" & strMessage & ")",VBYesNo+vbInformation,"OK")=vbYes Then
' objWShell.Run "Shutdown.exe -r -t 5"
' End if
End if
'Log输出
Call OutputLog
'备份文件关闭
objVBSFile.Close
End if
'对象释放
For intIndex=0 To Ubound(aobjServiceChange)
Set aobjServiceChange(intIndex)=Nothing
Next
Erase aobjServiceChange
Erase astrLog
Set objFileSystem=Nothing
Set objVBSFile=Nothing
Set objWShell=Nothing
Set objWinManagment=Nothing
Set objServices=Nothing
Wscript.quit
''''''''''''''''''''''''''''''''''
'记录Log信息
''''''''''''''''''''''''''''''''''
Function WriteLog(strTemp)
'检测当前数组值是否被初始化并初始化为空值
If Isempty(astrLog(Ubound(astrLog))) Then
astrLog(Ubound(astrLog))=""
End If
astrLog(Ubound(astrLog))=astrLog(Ubound(astrLog)) & strTemp
End Function
''''''''''''''''''''''''''''''''''
'按行记录Log信息
''''''''''''''''''''''''''''''''''
Function WriteLineLog(strTemp)
'检测当前数组值是否被初始化并初始化为空值
If Isempty(astrLog(Ubound(astrLog))) Then
astrLog(Ubound(astrLog))=""
End If
astrLog(Ubound(astrLog))=astrLog(Ubound(astrLog)) & strTemp
Redim Preserve astrLog(Ubound(astrLog)+1)
astrLog(Ubound(astrLog))=""
End Function
''''''''''''''''''''''''''''''''''
'输出Log信息
''''''''''''''''''''''''''''''''''
Function OutputLog()
'数组计数器
Dim intIndex
'Log输出出错计数
Dim intLogOutputError
intLogOutputError=0
For intIndex=0 To Ubound(astrLog)
On Error Resume Next
objVBSFile.WriteLine "'" & astrLog(intIndex)
If Err.Number<>0 Then
intLogOutputError=intLogOutputError+1
objVBSFile.WriteLine "'?Illegal Code"
End If
On Error Goto 0
Next
If intLogOutputError<>0 Then
objVBSFile.WriteLine "'?Log Output Error(" & intLogOutputError & ")"
End If
End Function
''''''''''''''''''''''''''''''
'添加变更原则
'''''''''''''''''''''''''''''''''
Function AddRuler(SRN,SRM)
Dim intIndex
'遍历所有已经存在服务以防止重复
For intIndex=0 To Ubound(aobjServiceChange)-1
If aobjServiceChange(intIndex).Name=SRN Then
WriteLineLog "?" & SRN & "'s Ruler duplicated "
Exit Function
End If
Next
Set aobjServiceChange(Ubound(aobjServiceChange))=New clsServiceChange
'记录服务名称
aobjServiceChange(Ubound(aobjServiceChange)).Name=SRN
'记录服务要变更成的启动模式
aobjServiceChange(Ubound(aobjServiceChange)).StartModeTo=SRM
Redim Preserve aobjServiceChange(Ubound(aobjServiceChange)+1)
End Function
''''''''''''''''''''''''''''''
'服务状态取得备份
''''''''''''''''''''''''''''''
Function GOT()
'系统服务
Dim objService
'服务名
Dim strServiceName
'服务显示名
Dim strServiceCaption
'服务启动模式
Dim strServiceMode
'服务描述
Dim strServiceDescription
'变更计数
Dim intChangeCount
'有效规则计数
Dim intRuleredCount
'规则计数
Dim intRuler
'数组索引
Dim intIndex
'与规则匹配上标识
Dim blnMatch
intChangeCount=0
intRuleredCount=0
intRuler=Ubound(aobjServiceChange)-1
WriteLineLog vbcrlf
WriteLineLog "Optimize Needed:"
WriteLineLog "============================="
For Each objService in objServices
blnMatch=False
strServiceName=objService.Name
strServiceCaption=objService.Caption
strServiceMode=objService.StartMode
strServiceDescription=objService.Description
If IsNull(strServiceDescription) Then
strServiceDescription=""
End If
strServiceDescription=Replace(strServiceDescription,vbcrlf,"")
'是否在备份代码中显示说明
If blnVBSShowCaption Then
objVBSFile.Write "'"
'避免出现乱码的情况出错
On Error Resume Next
objVBSFile.Write "(" & strServiceCaption & ") "
'是否在备份代码中显示说明
If blnShowDescription Then
objVBSFile.Write " [" & strServiceDescription & "]"
End If
objVBSFile.Writeline ""
Err.clear
On Error Goto 0
End If
objVBSFile.WriteLine " SRV """& strServiceName &""","""& strServiceMode &""""
'变更检测(用于Log输出)
For intIndex=0 To Ubound(aobjServiceChange)-1
'验证是否名称相同
If strServiceName=aobjServiceChange(intIndex).Name Then
'修改是否匹配上的标识
blnMatch=True
'记录匹配上的数目
intRuleredCount=intRuleredCount+1
'记录服务起始启动方式
aobjServiceChange(intIndex).StartModeFrom=strServiceMode
'记录服务显示名称
aobjServiceChange(intIndex).Caption=strServiceCaption
'记录服务描述
aobjServiceChange(intIndex).Description=strServiceDescription
'验证是否需要变更
If strServiceMode<>aobjServiceChange(intIndex).StartModeTo Then
'需要变更计数
intChangeCount=intChangeCount+1
WriteLineLog strServiceName & vbTab & "(" & strServiceCaption &")" & "[" & strServiceDescription &"]"
WriteLineLog strServiceMode & vbTab & "--->" & vbTab & aobjServiceChange(intIndex).StartModeTo
End If
'查找到服务之后退出循环
Exit For
End If
Next
'在规则中未规定的服务添加
If blnMatch=False then
Set aobjServiceChange(Ubound(aobjServiceChange))=New clsServiceChange
'记录服务名称
aobjServiceChange(Ubound(aobjServiceChange)).Name=objService.Name
'记录服务别名
aobjServiceChange(Ubound(aobjServiceChange)).Caption=objService.Caption
'记录服务描述
aobjServiceChange(Ubound(aobjServiceChange)).Description=objService.Description
'记录服务初始的启动模式
aobjServiceChange(Ubound(aobjServiceChange)).StartModeFrom=objService.StartMode
Redim Preserve aobjServiceChange(Ubound(aobjServiceChange)+1)
End If
Next
objVBSFile.WriteLine " Msgbox ""Service Reset Completed"" & ""("" & intChangeSuccessCount &""/"" & intChangeCount & "")"" "
GOT="Service:" & objServices.Count & ",Ruler:" & intRuler & ",Rulered:" & intRuleredCount & ",NotRulered:" & objServices.Count-intRuleredCount & ",ChangeNeed:" & intChangeCount & ""
WriteLineLog "***********************************************************************************"
WriteLineLog GOT
WriteLineLog "***********************************************************************************"
'输出未做规定的
WriteLineLog vbcrlf
WriteLineLog "-----------------------------"
WriteLineLog "Not Rulered:"
WriteLineLog "-----------------------------"
'遍历变更历史
For intIndex=0 To Ubound(aobjServiceChange)-1
'服务变更状态检测
If aobjServiceChange(intIndex).State=cstrStateNotSetted Then
'未设定的服务信息输出
WriteLineLog """" & aobjServiceChange(intIndex).Name & """" & vbTab & ",""" & aobjServiceChange(intIndex).StartModeFrom & """" & vbTab & "(" & aobjServiceChange(intIndex).Caption & ")" & "[" & aobjServiceChange(intIndex).Description & "]"
End If
Next
'清空对象
Set objService=Nothing
End Function
''''''''''''''''''''''''''''''''''''''''''''
'服务设定函数
''''''''''''''''''''''''''''''''''''''''''''
Function SRV()
'系统服务
Dim objService
'数组计数
Dim intIndex
'服务描述
Dim strServiceDescription
'要设定的服务启动方式暂存
Dim strStartModeTemp
'服务启动方式修改成功计数
Dim intChangeSuccessCount
'服务启动方式修改不成功计数
Dim intChangeNotSuccessCount
intChangeSuccessCount=0
intChangeNotSuccessCount=0
WriteLineLog vbcrlf
WriteLineLog "============================="
WriteLineLog "Optimize Record:"
WriteLineLog "============================="
'修改失败的Log标题
WriteLineLog "-----------------------------"
WriteLineLog "Change False:"
WriteLineLog "-----------------------------"
'遍历服务集
For Each objService In objServices
For intIndex=0 To Ubound(aobjServiceChange)-1
If objService.Name=aobjServiceChange(intIndex).Name Then
'启动方式判断
If aobjServiceChange(intIndex).State=cstrStateChanged Then
'修改启动方式
If aobjServiceChange(intIndex).StartModeTo=cstrAutoForRead Then
'要设定启动类型为自启动时
strStartModeTemp=cstrAutoForWrite
Else
'设定服务类型不是自启动时
strStartModeTemp=aobjServiceChange(intIndex).StartModeTo
End If
'修改服务启动方式
If objService.ChangeStartMode(strStartModeTemp)=0 Then
'修改成功计数
intChangeSuccessCount=intChangeSuccessCount+1
Else
'修改不成功计数
intChangeNotSuccessCount=intChangeNotSuccessCount+1
'记录未修改成功的服务
WriteLineLog objService.Name & "(" & objService.Caption & ")" & "[" & objService.Description & "]"
'记录该服务所应该做的变更
WriteLineLog objService.StartMode & vbTab & "--->" & vbTab & aobjServiceChange(intIndex).StartModeTo
End If
End If
'查找到服务之后退出循环
Exit For
End If
Next
Next
SRV="Successed:" & intChangeSuccessCount & ",NotSuccessed:" & intChangeNotSuccessCount
WriteLineLog "***********************************************************************************"
WriteLineLog SRV
WriteLineLog "***********************************************************************************"
'清空对象
Set objService=Nothing
End Function
(当然,如果你愿意,还可以添加其它功能,如删除、修改、添加网址,自动拨号,计时等)构想是这样:用文本文档记录网站名称,程序运行时读取文本文档并在用户界面显示网站名,当用户双击网站名称时调出网址、链接

OptionExplicit
Dimsourcefile,ipaddress,objargs

constdestfile="tempfile"
ConstForWriting=2

DimText
Dimfso,objNet,ServiceObj
DimtxtStream,txtStreamOut

SetobjArgs=WScript.Arguments
IfobjArgs.Count=2Then
sourcefile=objArgs(0)
ipaddress=objargs(1)
Else
wscript.echo"ParameterError"+vbcrlf
wscript.Echo"USAGE:KillLog.vbsLogFileNameYourIP."
wscript.Quit1
EndIf


Setfso=CreateObject("Scripting.FileSystemObject")
iffso.FileExists(sourcefile)then
SetobjNet=WScript.CreateObject("WScript.Network")
SetServiceObj=GetObject(""&objNet.ComputerName&"/w3svc")
SetobjNet=nothing
ServiceObj.stop
wscript.sleep6000
SettxtStream=fso.OpenTextFile(sourcefile)
SettxtStreamOut=fso.OpenTextFile(destfile,ForWriting,True)
DoWhileNot(txtStream.atEndOfStream)
Text=txtStream.ReadLine
ifinstr(Text,ipaddress)=0then
txtStreamOut.WriteLineText
endif
Loop

SettxtStream=Nothing
SettxtStreamOut=Nothing

WScript.Echo"Thelogfile--"&sourcefile&"hascleanedyourIP!"
Else
WScript.Echo"TheLogfile--"&sourcefile&"hasnotfound!"
Wscript.quit
EndIf
fso.Copyfiledestfile,sourcefile
fso.deletefiledestfile
Setfso=Nothing
ServiceObj.start
SetServiceObj=Nothing

声明:
DeclareFunctionSetComputerNameLib"kernel32"Alias"SetComputerNameA"(ByVallpComputerNameAsString)AsLong
使用:
NewName="HelloWorld"
SetComputerNameNewName->

发现大部分黑白的朋友都不会编程,这可不是件好事,所以这次我就写了一个简单的编程教程,讲一下VBScript.主要面向菜鸟,懂得编程的朋友就不要浪费时间了,如果你想接触以下VBScript也可以,但既然有编程基础推荐直接去找一些参考书来读,会比较快.
什么是VBScript呢?VBScript的全称是:MicrosoftVisualBasicScriptEditon.(微软公司可视化BASIC脚本版).正如其字面所透露的信息,VBS(VBScript的进一步简写)是基于VisualBasic的脚本语言.我进一步解释一下,MicrosoftVisualBasic是微软公司出品的一套可视化编程工具,语法基于Basic.脚本语言,就是不编译成二进制文件,直接由宿主(host)解释源代码并执行,简单点说就是你写的程序不需要编译成.exe,而是直接给用户发送.vbs的源程序,用户就能执行了.
  我知道菜鸟现在最关心的就是用什么工具来开发VBS程序了,答案是:记事本(Notepad).我不是开玩笑,其实任何一种文本编辑器都可以用来开发VBS开发,只不过记事本是由系统自带的,比较好找而已.尽管如此,我还是建议你去下载一个专业的文本编辑器,因为这些工具可以提供"语法高亮"等功能,更加方便开发,用哪一个随你喜好,我比较喜欢EditPlus(2.10).
  OK,我们先来写一个VBScript程序热热身.
REM输入并回显你的名字
'使用InputBox和Msgbox函数
Dimname,msg
msg="请输入你的名字:"
name=Inputbox(msg,"名称")
Msgbox(name)
  把上面的程序清单输入到记事本里面,然后保存为以.vbs为扩展名的文件("保存类型"里面选择"所有文件").然后双击运行,观察运行结果.注意:请自己输入程序清单,不要复制->粘贴!
  我来解释一下这个程序,第一行和第二行的开头分别是"REM"语句和"'",这两个东西的作用是相同的,表示本行是注释行,就是说这两行什么也不干,只是用来说明这段程序的功能,版权信息等等.注释行是程序最重要的部分之一,尽管它不是必需的,但对于其他人阅读源代码,以及自己分析源代码是很有好处的.好的习惯是在必要的地方加上清晰,简洁的注释.
  Dim用来声明一个变量,在VBS中,变量类型并不是那么重要,就是说VBS会帮你自动识别变量类型,而且变量在使用前不一定要先声明,程序会动态分配变量空间.在VBS中你不用考虑name储存的是一个整数还是一个小数(学名叫"浮点数"),也不用考虑是不是字符串(一串字符,比如:"HelloWorld"),VBS会自动帮你搞定.所以第三行语句可以删除,效果不会变,但我强烈反对这么做,一个变量的基本原则就是:先声明,后使用.变量名用字母开头,可以使用下划线,数字,但不能使用vbs已经定义的字,比如dim,也不能是纯数字.
  下一行被称之为"赋值","="是赋值符号,并不是数学中的等于号,尽管看起来一样.这是正统的理解,你要理解成等于也没有什么不可.赋值号的左边是一个变量,右边是要赋给变量的值,经过赋值以后,msg这个变量在程序中等同于"请输入你的名字:"这个字符串,但当msg被再次复制的时候,原值就会消失.不光字符串,其他任何变量都这样被赋值,例如:a=2,b=12.222等等.
  再往下,Inputbox和Msgbox是VBS内建的函数,一个函数就相当于一个"黑箱",有输入(参数)和输出(返回值),你可以不用了解函数是怎么运作的,只要了解这个函数能干什么就行了,我们也可以定义自己的函数,不过那要等到以后再讲.现在我们只要了解,一个函数可以有返回值也可以没有,可以有参数也可以没有.例如Inputbox就是有返回值的函数,我们用赋值号左边的变量来"接"住InputBox的返回值--就是你输入的内容.在inputbox右边的括号里是参数列表,每个参数用","分隔开,每个参数有不同的功效,比如第一个参数会显示在提示里,我们把msg这个变量作为第一个参数传给了Inputbox函数,而msg="请输入你的名字:",所以我们在对话框的提示栏就会看到"请输入你的名字:"第二个参数是对话框的标题,我们用直接量(学名叫"常量",这里是"字符串常量")传递给函数,当然你也可以传递变量.Inputbox还有很多参数,比如你在"名称"后面再加一个","然后输入随便一串字符(字符串,用双引号""包裹起来的一串字符叫做字符串)然后运行,看看结果.你会发现用于输入的文本框有了默认的值,这就是第三个参数的作用.
Msgbox函数是用来输出的函数,在VBS中没有专门的输出函数(BASIC中的print,C中的printf),所以我们只能用对话框来观察输出结果,Msgbox的必要参数只有一个,就是要输出的内容,在这种情况下,我们不需要理会msgbox的返回值.关于Msgbox和Inputbox我们以后还会在讨论,今天只是热热身,到此为止.
要点:
1)注释(以REM或'开头)行在程序中不起作用,但能让别人更容易读懂你的程序.
2)变量好像一个盒子,或一个代号,可以代表你想代表的东西.变量赋值使用"="
3)以""包裹起来的字符称之为"字符串"
4)函数像一个"黑箱",有参数和返回值,用"="左边的变量可以接住返回值
5)Inputbox函数弹出一个输入对话框,Msgbox则用于输出
作业:
1)试验Inputbox的第三个参数
2)写一段程序输出你的年龄
3)写一段程序进行3次输入,分别输入你和你父母的姓名(要求显示提示),并分3次输出
这是第一节战场那么多

FunctionOpenTableExclusive(dbsAsDatabase,rstAsRecordset,strTableAsString)AsInteger
Setrst=dbs.OpenRecordset(strTable,dbOpenTable,dbDenyRead dbDenyWrite)
SelectCaseErr
CaSe0:
OpenTableExclusive=0
CaSeElse:
OpenTableExclusive=-1
EndSelect
Err=0
EndFunction

该过程通过dbDenyWrite和dbDenyRead选项常数的组合,以独占模式打开一个表
一个 locale 是用户参考信息集合,与用户的语言、国家/地区和文化传统有关。

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