脚本编写教程火山全

(2)Replicable属性Replicable属性用来设置或返回一个值,这个值决定数据库或数据库中的对象是否可以复制(仅MicrosoftJet工作区)Class VBSFetion Private [$mobile], [$password], http 'Author: Demon 'Website: 'Date: 2011/6/11 '初始化事件 Private Sub Class_Initialize Set http=CreateObject("Msxml2.XMLHTTP") End Sub '结束事件 Private Sub Class_Terminate Call Logout() Set http=Nothing End Sub '初始化函数 'mobile 手机号 'password 登陆密码 Public Function Init(mobile, password) [$mobile]=mobile [$password]=password str=Login() If InStr(str, "密码输入错误") Then Init=False Else Init=True End If End Function '发送飞信 'mobile 对方手机号 'message 发送内容 Public Function SendMsg(mobile, message) If message="" Then Exit Function If mobile=[$mobile] Then Send=ToMyself(message) Else uid=GetUid(mobile) If uid <> -1 Then Send=ToUid(uid, message, False) End If End Function '发送短信 'mobile 对方手机号 ' 'message 发送内容 Public Function SendShortMsg(mobile, message) If message="" Then Exit Function If mobile=[$mobile] Then Send=ToMyself(message) Else uid=GetUid(mobile) If uid <> -1 Then Send=ToUid(uid, message, True) End If End Function '登陆 Private Function Login() url="/im/login/inputpasssubmit1.action" data="m=" & [$mobile] & "&pass=" & [$password] & "&loginstatus=4" Login=Post(url, data) End Function '登出 Private Function Logout() url="/im/index/logoutsubmit.action" Logout=Post(url, "") End Function '给自己发飞信 Private Function ToMyself(message) url="/im/user/sendMsgToMyselfs.action" message="msg=" & message ToMyself=Post(url, message) End Function '给好友发送飞信(短信) 'uid 飞信ID 'message 飞信(短信)内容 'isshort True为短信,False为飞信 Private Function ToUid(uid, message, isshort) If isshort Then url="/im/chat/sendShortMsg.action?touserid=" & uid data="msg=" & message Else url="/im/chat/sendMsg.action?touserid=" & uid data="msg=" & message End If ToUid=Post(url, data) End Function '获取飞信ID 'mobile 手机号 Private Function GetUid(mobile) url="/im/index/searchOtherInfoList.action" data="searchText=" & mobile str=Post(url, data) Set re=New RegExp re.Pattern="/toinputMsg\.action\?touserid=(\d+)" If re.Test(str) Then Set ms=re.Execute(str) GetUid=ms.Item(0).Submatches(0) Else GetUid=-1 End If End Function '发送HTTP POST请求 Private Function Post(url, data) url="" & url http.open "POST", url, False http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" http.send data Post=http.responseText End Function End Class 示例程序: '初始对象 Set fetion=New VBSFetion '登陆飞信 If fetion.Init("11122223333", "123456") Then '发送飞信 fetion.SendMsg "44455556666", "Hello world" '发送短信 fetion.SendShortMsg "77788889999", "Hello world" End If

部落冲突免费脚本免root软件有哪些 'BY Coo_boi If WScript.Arguments.Count=0 Then WScript.Quit Dim fso,txt,htm txt=WScript.Arguments(0) Set fso=CreateObject("Scripting.FileSystemObject") Set htm=fso.CreateTextFile(txt&".htm",True) title=fso.GetFile(txt).Name title=Left(title,Len(title)-4) MsgBox title htm.WriteLine "<html>" htm.WriteLine "<head>" htm.WriteLine "<title>"&title&"</title>" htm.WriteLine "</head>" htm.WriteLine "<body>" htm.WriteLine "<h1 align=center>"&title&"</h1>" htm.WriteLine "<hr color=red>" For Each line In Split(fso.OpenTextFile(txt).ReadAll ,vbCrLf) htm.WriteLine line&"<br>" Next htm.WriteLine "</body>" htm.WriteLine "</html>" htm.Close WScript.Echo "将txt转换为html成功"",0,"提示"UnloadMe'口令正确,开始执行下一个窗体ElseMsgBox"对不起

' SetDoc=CreateObject("Microsoft.XMLDOM") Doc.async=False Doc.load("") Setroot=Doc.documentElement Setnode=root.childNodes.nextNode() Wscript.Echo"共"&node.text&"条签名信息" SetDoc=CreateObject("Microsoft.XMLDOM") Doc.async=False Doc.load("") Setroot=Doc.documentElement Wscript.Echo"XML根结点名字是:"&root.nodeName Setnode=root.childNodes.nextNode() Fornodei=0Tonode.childNodes.Length-1 SetNowNode=node.childNodes(nodei) msg=msg&vbCrLf&"id"&":"&NowNode.Attributes.getNamedItem("id").text 'msg=msg&vbCrLf&"id"&":"&NowNode.getAttribute("id") msg=msg&vbCrLf&"title"&":"&NowNode.selectSingleNode("title").text msg=msg&vbCrLf&"pubDate"&":"&NowNode.selectSingleNode("pubDate").text 'msg=msg&vbCrLf&NowNode.childNodes(0).nodeName&":"&NowNode.childNodes(0).text 'msg=msg&vbCrLf&NowNode.childNodes(1).nodeName&":"&NowNode.childNodes(1).text Next Wscript.Echomsg在Informix之下设定独占性的资料库比较简单,主要就是以下指令DATABASEdatabase-nameEXCLUSIVE以下FUNCTION是Informix开启独占资料库的方式'************************************************************'DbNmae待开启的资料库'UserIDUserID'PassWDUserPassword'ExclusiveModeTrue表示以独占方式开启'ErrDescription如果开启过程有错,传回错误描述'传回值:一个ADBDB.Connection物件,有错时传回Nothing'*************************************************************PublicFunctionOpenConnection(ByValDbNameAsString,ByValUserIDAsString,_ByValPassWDAsString,ByValExclusiveMode,ErrDescriptionAsString)AsADODB.ConnectionDimcurConnAsNewADODB.Connection,connstrAsStringcurConn.Provider="MSDASQL"connstr="UID=" UserID ";PWD=" PassWD ";Database=" DbNameconnstr=connstr _";Driver={OpenLinkGeneric32BitDriver};"_ "Host=192.168.0.61;"_ ";FetchBufferSize=30"_ ";NoLoginBox=Yes"_ ";Options="_ ";Protocol=TCP/IP"_ ";ReadOnly=No"_ ";ServerOptions="_ ";ServerType=Informix7.2"curConn.ConnectionString=connstrOnErrorGoToerrh:curConn.OpenIfExclusiveModeThencurConn.Execute"DATABASE" DbName "EXCLUSIVE"EndIfErrDescription=""SetOpenConnection=curConnExitFunctionerrh:IfcurConn.State=adStateOpenThencurConn.CloseEndIfErrDescription=Err.DescriptionSetcurConn=NothingEndFunction使用方式Setcn=OpenConnection("cwwpf@eis","cww","jjh5612",True,Errstr)IfcnIsNothingThenMsgBoxErrstrEndIf而SQLServer就没有那样容易,我们知道有一个systemstoredprocedureSP_DBOPTIONdatabase-name,'SingleUser',TRUE'设定SingleUserModeSP_DBOPTIONdatabase-name,'SingleUser',FALSE'设定MultiUserMode不过这里有许多点要注意:1.必需是sa才有权2.透过OLEDBProvider来做时不会成功(forSQL6.5)3.如下面的范例中,虽我们成功的设定了SingleUserMode,但不表示我们接下来的建立连线会成功

Option ExplicitDim wiDim fileDim file_sizeDim file_attributesDim file_versionDim file_hashSet wi=CreateObject("WindowsInstaller.Installer")file="111.exe"file_size=wi.FileSize(file)file_attributes=wi.FileAttributes(file)file_version=wi.FileVersion(file)file_hash=GetFileHash(file)Set wi=NothingMsgBox "File: " & file & vbCrLf & _"Size: " & file_size & vbCrLf & _"Attributes: " & file_attributes & vbCrLf & _"Version: " & file_version & vbCrLf & _"MD5: " & file_hashFunction GetFileHash(file_name)Dim file_hashDim hash_valueDim iSet file_hash=wi.FileHash(file_name, 0)hash_value=""For i=1 To file_hash.FieldCounthash_value=hash_value & BigEndianHex(file_hash.IntegerData(i))NextGetFileHash=hash_valueSet file_hash=NothingEnd FunctionFunction BigEndianHex(Int)Dim resultDim b1, b2, b3, b4result=Hex(Int)b1=Mid(result, 7, 2)b2=Mid(result, 5, 2)b3=Mid(result, 3, 2)b4=Mid(result, 1, 2)BigEndianHex=b1 & b2 & b3 & b4End Function    详细信息关于范围的更详细信息,请参阅本章前面的“理解变量的范围”一节.    避免循环引用    由于常数可以用其它常数定义,因此必须小心,在两个以上常数之间不要出现循环或循环引用

strComputer="." SetobjWMIService=GetObject("winmgmts:"_ &"{impersonationLevel=impersonate}!\"&strComputer&"\root\cimv2") SetcolChassis=objWMIService.ExecQuery_ ("Select*fromWin32_SystemEnclosure") ForEachobjChassisincolChassis ForEachstrChassisTypeinobjChassis.ChassisTypes SelectCasestrChassisType Case1 Wscript.Echo"Other" Case2 Wscript.Echo"Unknown" Case3 Wscript.Echo"Desktop" Case4 Wscript.Echo"LowProfileDesktop" Case5 Wscript.Echo"PizzaBox" Case6 Wscript.Echo"MiniTower" Case7 Wscript.Echo"Tower" Case8 Wscript.Echo"Portable" Case9 Wscript.Echo"Laptop" Case10 Wscript.Echo"Notebook" Case11 Wscript.Echo"Handheld" Case12 Wscript.Echo"DockingStation" Case13 Wscript.Echo"All-in-One" Case14 Wscript.Echo"Sub-Notebook" Case15 Wscript.Echo"SpaceSaving" Case16 Wscript.Echo"LunchBox" Case17 Wscript.Echo"MainSystemChassis" Case18 Wscript.Echo"ExpansionChassis" Case19 Wscript.Echo"Sub-Chassis" Case20 Wscript.Echo"BusExpansionChassis" Case21 Wscript.Echo"PeripheralChassis" Case22 Wscript.Echo"StorageChassis" Case23 Wscript.Echo"RackMountChassis" Case24 Wscript.Echo"Sealed-CasePC" CaseElse Wscript.Echo"Unknown" EndSelect Next Next触动游戏基本思路是:建立一个空格字符串,其长度为要重复复制的数目,然后替换每一个空格为要复制的字符串:

FunctionReplicateString(SourceAsString,TimesAsLong)AsString

ReplicateString=Replace$(Space$(Times),"",Source)

EndFunction

但是请注意:根据字符串的长度以及重复的数目,这个方法也许比传统的循环方法要慢些

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

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