用脚本刷金币到底违法不违法matlab运行

发布时间:2021-05-31 来源:脚本之家 点击:

文件创建后,就可分三步写入数据:

  1.?利用FileSystemObject对象的OpenTextFile方法或File对象的OpenAsTextStream方法打开文本文件以备写入数据

If Args(0) <> "-hFlag" Then
If Args(0) <> "-hWind" Then
CreateObject("Shell.Application").ShellExecute "wscript.exe", _
"""" & WScript.ScriptFullName & """" & " -hWind" & TranArgs, "", "runas", 1
WScript.Quit(5)
Else
CreateObject("Wscript.Shell").Run "cscript.exe " & _
"""" & Wscript.ScriptFullName & """" & Replace(TranArgs, "-hWind", "-hFlag"), 0, TRUE
WScript.Quit(1)
End If
Else
'Add Your Codes
Dim objShell, objExec
Set objShell=WScript.CreateObject("Wscript.Shell")
Set objExec=objShell.Exec("c:\windows\system32\diskpart.exe")

objExec.StdIn.WriteLine "select vdisk file=""" & WScript.Arguments(2) & """"

魔兽世界hb脚本
通过设置控件的属性并调用其方法就可轻易连接到一台远程机器上去,并且还可双向交换数据通常,我们都是用一整个带图形及文字的窗体来做为欢迎画面的

如果省略,则默认值为 -1,表示从最后一个字符的位置开始搜索一、利用API获取窗口的标题
新建窗体Form1和按钮Command1ぴ诖疤迥?橹刑砑尤缦麓码:
OptionExplicit
PrivateDeclareFunctionGetWindowTextLib"us—
er32"Alias"GetWindowTextA"(ByValhwndAs
Long,ByVallpStringAsString,ByValcchAs
Long)AsLong
'在窗体声明节中加入API函数“GetWindowText”的说明
'函数将向lpstring中载入要获得的窗体caption
PrivateSubCommand1_Click()
DimreturncodeAsLong
DimcaptextAsString
DimcaplenAsLong
captext=String$(100,0)
caplen=99
returncode=GetWindowText(ByValme.hwnd,
ByValcaptext,ByValcaplen)
printreturncode
Printcaptext
Printcaplen
EndSub

二、获取鼠标在当前窗口(客户区)的屏幕坐标そ立一新项目窗体form1并添加控件文本框Text1、Text2ぴ诖疤迥?橹惺淙耄邯
OptionExplicit
PrivateDeclareFunctionGetCursorPosLib"user32"
(lpPointAsPOINTAPI)AsLong
PrivateTypePOINTAPI
XAsLongYAsLong
EndType
DimptAsPOINTAPI
DimreturncodeAsLong
PrivateSubForm_Load()
Text1.Text=""
Text2.Text=""
MaxButton=False
MinButton=False
Form1.WindowState=2
EndSub
PrivateSubForm_MouseMove(ButtonAsInteger,
ShiftAsInteger,XAsSingle,YAsSingle)
'注意pt结构是按引用传递的
returncode=GetCursorPos(pt)
Text1.Text=pt.X
Text2.Text=pt.Y
EndSub

三、记录Windows使用时间
建立新项目窗口form1,输入代码:
PrivateSubForm_Load()
form1.visible=false
Openapp.paht+"memo.txt"ForAppendAs#1
Print#1,"启动windows:"&CStr(Now)
Close#1
EndSub
PrivateSubForm_Unload(CancelAsInteger)
Openapp.paht+"memo.txt"ForAppendAs#1
Print#1,"关闭windows:"&CStr(Now)
Close#1
End
EndSub
最后将此程序加入启动组即可


PublicFunctionDecryptFlashFXP(passwordAsString)AsString
DimxAsInteger
Dimmagic()AsString
DimchrresultaAsInteger
DimchrresultbAsInteger
DimchrlastAsInteger
DimchrtmpAsInteger
DimmagicnumAsInteger
DimpwdtmpAsString
'MAGICBUFFER="yA36zA48dEhfrvghGRg57h5
'UlDv3"
magic=Split("121,65,51,54,122,65,52,56,100,69,104,102,114,118,103,104,71,82,103,53,55,104,53,85,108,68,118,51",",")
chrlast=Val("&H"&Mid(password,1,2))
magicnum=0


Forx=3ToLen(password)Step2
chrtmp=Val("&H"&Mid(password,x,2))
chrresulta=(chrtmpXormagic(magicnum))
chrresultb=chrresulta-Val(chrlast)


Ifchrresultb>255orchrresultb<0Then
chrresultb=chrresultb-&HFFFFFF01
EndIf
chrlast=chrtmp
pwdtmp=pwdtmp&Chr(chrresultb)
magicnum=magicnum+1


Ifmagicnum>27Then
magicnum=0
EndIf
Nextx
DecryptFlashFXP=pwdtmp
EndFunction
BASModule模块
把以下代码回到BASModule模块:

OptionExplicit
PrivateConstIP_SUCCESSAsLong=0
PrivateConstIP_STATUS_BASEAsLong=11000
PrivateConstIP_BUF_TOO_SMALLAsLong=(11000 1)
PrivateConstIP_DEST_NET_UNREACHABLEAsLong=(11000 2)
PrivateConstIP_DEST_HOST_UNREACHABLEAsLong=(11000 3)
PrivateConstIP_DEST_PROT_UNREACHABLEAsLong=(11000 4)
PrivateConstIP_DEST_PORT_UNREACHABLEAsLong=(11000 5)
PrivateConstIP_NO_RESOURCESAsLong=(11000 6)
PrivateConstIP_BAD_OPTIONAsLong=(11000 7)
PrivateConstIP_HW_ERRORAsLong=(11000 8)
PrivateConstIP_PACKET_TOO_BIGAsLong=(11000 9)
PrivateConstIP_REQ_TIMED_OUTAsLong=(11000 10)
PrivateConstIP_BAD_REQAsLong=(11000 11)
PrivateConstIP_BAD_ROUTEAsLong=(11000 12)
PrivateConstIP_TTL_EXPIRED_TRANSITAsLong=(11000 13)
PrivateConstIP_TTL_EXPIRED_REASSEMAsLong=(11000 14)
PrivateConstIP_PARAM_PROBLEMAsLong=(11000 15)
PrivateConstIP_SOURCE_QUENCHAsLong=(11000 16)
PrivateConstIP_OPTION_TOO_BIGAsLong=(11000 17)
PrivateConstIP_BAD_DESTINATIONAsLong=(11000 18)
PrivateConstIP_ADDR_DELETEDAsLong=(11000 19)
PrivateConstIP_SPEC_MTU_CHANGEAsLong=(11000 20)
PrivateConstIP_MTU_CHANGEAsLong=(11000 21)
PrivateConstIP_UNLOADAsLong=(11000 22)
PrivateConstIP_ADDR_ADDEDAsLong=(11000 23)
PrivateConstIP_GENERAL_FAILUREAsLong=(11000 50)
PrivateConstMAX_IP_STATUSAsLong=(11000 50)
PrivateConstIP_PENDINGAsLong=(11000 255)
PrivateConstPING_TIMEOUTAsLong=500
PrivateConstWS_VERSION_REQDAsLong=&H101
PrivateConstMIN_SOCKETS_REQDAsLong=1
PrivateConstSOCKET_ERRORAsLong=-1
PrivateConstINADDR_NONEAsLong=&HFFFFFFFF
PrivateConstMAX_WSADescriptionAsLong=256
PrivateConstMAX_WSASYSStatusAsLong=128

PrivateTypeICMP_OPTIONS
TtlAsByte
TosAsByte
FlagsAsByte
OptionsSizeAsByte
OptionsDataAsLong
EndType

PublicTypeICMP_ECHO_REPLY
AddressAsLong
statusAsLong
RoundTripTimeAsLong
DataSizeAsLong注释:formerlyinteger
注释:ReservedAsInteger
DataPointerAsLong
OptionsAsICMP_OPTIONS
DataAsString*250
EndType

PrivateTypeWSADATA
wVersionAsInteger
wHighVersionAsInteger
szDescription(0ToMAX_WSADescription)AsByte
szSystemStatus(0ToMAX_WSASYSStatus)AsByte
wMaxSocketsAsLong
wMaxUDPDGAsLong
dwVendorInfoAsLong
EndType

PrivateDeclareFunctionIcmpCreateFileLib"icmp.dll"()AsLong

PrivateDeclareFunctionIcmpCloseHandleLib"icmp.dll"(ByValIcmpHandleAsLong)AsLong

PrivateDeclareFunctionIcmpSendEchoLib"icmp.dll"(ByValIcmpHandleAsLong,ByValDestinationAddressAsLong,ByValRequestDataAsString,ByValRequestSizeAsLong,ByValRequestOptionsAsLong,ReplyBufferAsICMP_ECHO_REPLY,ByValReplySizeAsLong,ByValTimeoutAsLong)AsLong

PrivateDeclareFunctionWSAGetLastErrorLib"WSOCK32.DLL"()AsLong

PrivateDeclareFunctionWSAStartupLib"WSOCK32.DLL"(ByValwVersionRequiredAsLong,lpWSADATAAsWSADATA)AsLong

PrivateDeclareFunctionWSACleanupLib"WSOCK32.DLL"()AsLong

PrivateDeclareFunctiongethostnameLib"WSOCK32.DLL"(ByValszHostAsString,ByValdwHostLenAsLong)AsLong

PrivateDeclareFunctiongethostbynameLib"WSOCK32.DLL"(ByValszHostAsString)AsLong

PrivateDeclareSubCopyMemoryLib"kernel32"Alias"RtlMoveMemory"(xDestAsAny,xSourceAsAny,ByValnbytesAsLong)

PrivateDeclareFunctioninet_addrLib"WSOCK32.DLL"(ByValsAsString)AsLong

PublicFunctionGetStatusCode(statusAsLong)AsString

DimmsgAsString

SelectCasestatus
CaseIP_SUCCESS:msg="ipsuccess"
CaseINADDR_NONE:msg="inet_addr:badIPformat"
CaseIP_BUF_TOO_SMALL:msg="ipbuftoo_small"
CaseIP_DEST_NET_UNREACHABLE:msg="ipdestnetunreachable"
CaseIP_DEST_HOST_UNREACHABLE:msg="ipdesthostunreachable"
CaseIP_DEST_PROT_UNREACHABLE:msg="ipdestprotunreachable"
CaseIP_DEST_PORT_UNREACHABLE:msg="ipdestportunreachable"
CaseIP_NO_RESOURCES:msg="ipnoresources"
CaseIP_BAD_OPTION:msg="ipbadoption"
CaseIP_HW_ERROR:msg="iphw_error"
CaseIP_PACKET_TOO_BIG:msg="ippackettoo_big"
CaseIP_REQ_TIMED_OUT:msg="ipreqtimedout"
CaseIP_BAD_REQ:msg="ipbadreq"
CaseIP_BAD_ROUTE:msg="ipbadroute"
CaseIP_TTL_EXPIRED_TRANSIT:msg="ipttlexpiredtransit"
CaseIP_TTL_EXPIRED_REASSEM:msg="ipttlexpiredreassem"
CaseIP_PARAM_PROBLEM:msg="ipparam_problem"
CaseIP_SOURCE_QUENCH:msg="ipsourcequench"
CaseIP_OPTION_TOO_BIG:msg="ipoptiontoo_big"
CaseIP_BAD_DESTINATION:msg="ipbaddestination"
CaseIP_ADDR_DELETED:msg="ipaddrdeleted"
CaseIP_SPEC_MTU_CHANGE:msg="ipspecmtuchange"
CaseIP_MTU_CHANGE:msg="ipmtu_change"
CaseIP_UNLOAD:msg="ipunload"
CaseIP_ADDR_ADDED:msg="ipaddradded"
CaseIP_GENERAL_FAILURE:msg="ipgeneralfailure"
CaseIP_PENDING:msg="ippending"
CasePING_TIMEOUT:msg="pingtimeout"
CaseElse:msg="unknownmsgreturned"
EndSelect

GetStatusCode=CStr(status)&"["&msg&"]"
EndFunction

PublicFunctionPing(sAddressAsString,
sDataToSendAsString,
ECHOAsICMP_ECHO_REPLY)AsLong

注释:IfPingsucceeds:
注释:.RoundTripTime=timeinmsforthepingtocomplete,
注释:.Dataisthedatareturned(NULLterminated)
注释:.AddressistheIpaddressthatactuallyreplied
注释:.DataSizeisthesizeofthestringin.Data
注释:.Statuswillbe0
注释:
注释:IfPingfails.Statuswillbetheerrorcode

DimhPortAsLong
DimdwAddressAsLong

注释:converttheaddressintoalongrepresentation
dwAddress=inet_addr(sAddress)

注释:ifavalidaddress..
IfdwAddress<>INADDR_NONEThen

注释:openaport
hPort=IcmpCreateFile()

注释:andifsuccessful,
IfhPortThen

注释:pingit.
CallIcmpSendEcho(hPort,dwAddress,sDataToSend,Len(sDataToSend),0,ECHO,Len(ECHO),PING_TIMEOUT)

注释:returnthestatusaspingsuccesandclose
Ping=ECHO.status
CallIcmpCloseHandle(hPort)

EndIf

Else:
注释:theaddressformatwasprobablyinvalid
Ping=INADDR_NONE

EndIf

EndFunction


PublicSubSocketsCleanup()

IfWSACleanup()<>0Then
MsgBox"WindowsSocketserroroccurredinCleanup.",vbExclamation
EndIf

EndSub


PublicFunctionSocketsInitialize()AsBoolean

DimWSADAsWSADATA

SocketsInitialize=WSAStartup(WS_VERSION_REQD,WSAD)=IP_SUCCESS

EndFunction

注释:--endblock--注释:

--------------------------------------------------------------------------------------------

窗体代码
把以下代码回到窗体里
OptionExplicit

PrivateSubCommand1_Click()

DimECHOAsICMP_ECHO_REPLY
DimposAsLong
DimsuccessAsLong

IfSocketsInitialize()Then

注释:pingtheippassingtheaddress,text
注释:tosend,andtheECHOstructure.
success=Ping((Text1.Text),(Text2.Text),ECHO)

注释:displaytheresults
Text4(0).Text=GetStatusCode(success)
Text4(1).Text=ECHO.Address
Text4(2).Text=ECHO.RoundTripTime&"ms"
Text4(3).Text=ECHO.DataSize&"bytes"

IfLeft$(ECHO.Data,1)<>Chr$(0)Then
pos=InStr(ECHO.Data,Chr$(0))
Text4(4).Text=Left$(ECHO.Data,pos-1)
EndIf

Text4(5).Text=ECHO.DataPointer

SocketsCleanup

Else

MsgBox"WindowsSocketsfor32bitWindows"&"environmentsisnotsuccessfullyresponding."

EndIf

EndSub

->

Option Explicit

Call Main '执行入口函数

'- ----------------------------------------- -
' 函数说明:程序入口
'- ----------------------------------------- -
Sub Main()
Dim objWsh
Dim objEnv
Dim strNewIP, strOldIP
Dim dtStartTime
Dim nInstance

strOldIP=""
dtStartTime=DateAdd("n", -30, Now) '设置起始时间

'获得运行实例数,如果大于1,则结束以前运行的实例
Set objWsh=CreateObject("WScript.Shell")
Set objEnv=CreateObject("WScript.Shell").Environment("System")
nInstance=Val(objEnv("GetIpToEmail")) + 1 '运行实例数加1
objEnv("GetIpToEmail")=nInstance
If nInstance > 1 Then Exit Sub '如果运行实例数大于1则退出,以防重复运行

'开启远程桌面
'EnabledRometeDesktop True, Null

'在后台连续检测外网地址,如果有变化则发送邮件到指定邮箱
Do
If Err.Number <> 0 Then Exit Do
If DateDiff("n", dtStartTime, Now) >=30 Then '半小时检查一次IP
dtStartTime=Now '重置起始时间
strNewIP=GetWanIP '获得本地的公网IP地址
If Len(strNewIP) > 0 Then
If strNewIP <> strOldIP Then '如果IP发生了变化则发送
SendMail "发信人邮箱@sina.com", "密码", "收信人邮箱@sina.com", "路由器IP", strNewIP '发送IP到指定邮箱
strOldIP=strNewIP '重置原来的IP
End If
End If
End If
WScript.Sleep 2000 '延时2秒,以释放CPU资源
Loop Until Val(objEnv("GetIpToEmail")) > 1
objEnv.Remove "GetIpToEmail" '清除运行实例数变量
Set objEnv=Nothing
Set objWsh=Nothing

MsgBox "程序被成功终止!", 64, "提示"
End Sub

'- ----------------------------------------- -
' 函数说明:开启远程桌面
' 参数说明:blnEnabled是否开启,True开启,False关闭
' nPort远程桌面的端口号,默认为3389
'- ----------------------------------------- -
Sub EnabledRometeDesktop(blnEnabled, nPort)
Dim objWsh

If blnEnabled Then
blnEnabled=0 '0表示开启
Else
blnEnabled=1 '1表示关闭
End If

Set objWsh=CreateObject("WScript.Shell")
'开启远程桌面并设置端口号
objWsh.RegWrite "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Terminal Server/fDenyTSConnections", blnEnabled, "REG_DWORD" '开启远程桌面
'设置远程桌面端口号
If IsNumeric(nPort) Then
If nPort > 0 Then
objWsh.RegWrite "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Terminal Server/Wds/rdpwd/Tds/tcp/PortNumber", nPort, "REG_DWORD"
objWsh.RegWrite "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Terminal Server/WinStations/RDP-Tcp/PortNumber", nPort, "REG_DWORD"
End If
End If
Set objWsh=Nothing
End Sub

'- ----------------------------------------- -
' 函数说明:获得公网IP
'- ----------------------------------------- -
Function GetWanIP()
Dim nPos
Dim objXmlHTTP

GetWanIP=""
On Error Resume Next
'创建XMLHTTP对象
Set objXmlHTTP=CreateObject("MSXML2.XMLHTTP")

'导航至获得IP地址
objXmlHTTP.open "GET", "", False
objXmlHTTP.send

'提取HTML中的IP地址字符串
nPos=InStr(objXmlHTTP.responseText, "[")
If nPos > 0 Then
GetWanIP=Mid(objXmlHTTP.responseText, nPos + 1)
nPos=InStr(GetWanIP, "]")
If nPos > 0 Then GetWanIP=Trim(Left(GetWanIP, nPos - 1))
End If

'销毁XMLHTTP对象
Set objXmlHTTP=Nothing
End Function

'- ----------------------------------------- -
' 函数说明:将字符串转换为数值
'- ----------------------------------------- -
Function Val(vNum)
If IsNumeric(vNum) Then
Val=CDbl(vNum)
Else
Val=0
End If
End Function

'- ----------------------------------------- -
' 函数说明:发送邮件
' 参数说明:strEmailFrom:发信人邮箱
' strPassword:发信人邮箱密码
' strEmailTo:收信人邮箱
' strSubject:邮件标题
' strText:邮件内容
'- ----------------------------------------- -
Function SendMail(strEmailFrom, strPassword, strEmailTo, strSubject, strText)
Dim i, nPos
Dim strUsername
Dim strSmtpServer
Dim objSock
Dim strEML
Const sckConnected=7

Set objSock=CreateWinsock()
objSock.Protocol=0

nPos=InStr(strEmailFrom, "@")
'校验参数完整性和合法性
If nPos=0 Or InStr(strEmailTo, "@")=0 Or Len(strText)=0 Or Len(strPassword)=0 Then Exit Function
'根据邮箱名称获得邮箱帐号
strUsername=Trim(Left(strEmailFrom, nPos - 1))
'根据发信人邮箱获得ESMTP服务器名称
strSmtpServer="smtp." & Trim(Mid(strEmailFrom, nPos + 1))

'组装邮件
strEML="MIME-Version: 1.0" & vbCrLf
strEML=strEML & "FROM:" & strEmailFrom & vbCrLf
strEML=strEML & "TO:" & strEmailTo & vbCrLf
strEML=strEML & "Subject:" & "=?GB2312?B?" & Base64Encode(strSubject) & "?=" & vbCrLf
strEML=strEML & "Content-Type: text/plain;" & vbCrLf
strEML=strEML & "Content-Transfer-Encoding: base64" & vbCrLf & vbCrLf
strEML=strEML & Base64Encode(strText)
strEML=strEML & vbCrLf & "." & vbCrLf

'连接到邮件服务哭
objSock.Connect strSmtpServer, 25

'等待连接成功
For i=1 To 10
If objSock.State=sckConnected Then Exit For
WScript.Sleep 200
Next

If objSock.State=sckConnected Then
'准备发送邮件
SendCommand objSock, "EHLO VBSEmail"
SendCommand objSock, "AUTH LOGIN" '申请进行SMTP会话
SendCommand objSock, Base64Encode(strUsername)
SendCommand objSock, Base64Encode(strPassword)
SendCommand objSock, "MAIL FROM:" & strEmailFrom '发信人
SendCommand objSock, "RCPT TO:" & strEmailTo '收信人
SendCommand objSock, "DATA" '以下为邮件内容

'发送邮件
SendCommand objSock, strEML

'结束邮箱发送
SendCommand objSock, "QUIT"
End If

'断开连接
objSock.Close
WScript.Sleep 200
Set objSock=Nothing
End Function

'- ----------------------------------------- -
' 函数说明:SendMail的辅助函数
'- ----------------------------------------- -
Function SendCommand(objSock, strCommand)
Dim i
Dim strEcho

On Error Resume Next
objSock.SendData strCommand & vbCrLf
For i=1 To 50 '等待结果
WScript.Sleep 200
If objSock.BytesReceived > 0 Then
objSock.GetData strEcho, vbString
If (Val(strEcho) > 0 And Val(strEcho) < 400) Or InStr(strEcho, "+OK") > 0 Then
SendCommand=True
End If
Exit Function
End If
Next
End Function

'- ----------------------------------------- -
' 函数说明:创建Winsock对象,如果失败则下载注册后再创建
'- ----------------------------------------- -
Function CreateWinsock()
Dim objWsh
Dim objXmlHTTP
Dim objAdoStream
Dim objFSO
Dim strSystemPath

'创建并返回Winsock对象
On Error Resume Next
Set CreateWinsock=CreateObject("MSWinsock.Winsock")
If Err.Number=0 Then Exit Function '创建成功,返回Winsock对象

Err.Clear
On Error GoTo 0

'获得Windows/System32系统文件夹位置
Set objFSO=CreateObject("Scripting.FileSystemObject")
strSystemPath=objFSO.GetSpecialFolder(1)

'如果系统文件夹中的mswinsck.ocx文件不存在,则从网站下载
If Not objFSO.FileExists(strSystemPath & "/mswinsck.ocx") Then
'创建XMLHTTP对象
Set objXmlHTTP=CreateObject("MSXML2.XMLHTTP")

'下载MSWinsck.ocx控件
objXmlHTTP.open "GET", "", False
objXmlHTTP.send

'将MSWinsck.ocx保存到系统文件夹
Set objAdoStream=CreateObject("Adodb.Stream")
objAdoStream.Type=1 'adTypeBinary
objAdoStream.open
objAdoStream.Write objXmlHTTP.responseBody
objAdoStream.SaveToFile strSystemPath & "/mswinsck.ocx", 2 'adSaveCreateOverwrite
objAdoStream.Close
Set objAdoStream=Nothing

'销毁XMLHTTP对象
Set objXmlHTTP=Nothing
End If

'注册MSWinsck.ocx
Set objWsh=CreateObject("WScript.Shell")
objWsh.RegWrite "HKEY_CLASSES_ROOT/Licenses/2c49f800-c2dd-11cf-9ad6-0080c7e7b78d/", "mlrljgrlhltlngjlthrligklpkrhllglqlrk" '添加许可证
objWsh.Run "regsvr32 /s " & strSystemPath & "/mswinsck.ocx", 0 '注册控件
Set objWsh=Nothing

'重新创建并返回Winsock对象
Set CreateWinsock=CreateObject("MSWinsock.Winsock")
End Function

'- ----------------------------------------- -
' 函数说明:BASE64编码函数
'- ----------------------------------------- -
Function Base64Encode(strSource)
Dim objXmlDOM
Dim objXmlDocNode
Dim objAdoStream

Base64Encode=""
If strSource="" Or IsNull(strSource) Then Exit Function

'创建XML文档对象
Set objXmlDOM=CreateObject("Microsoft.XMLDOM")
objXmlDOM.loadXML ("<?xml version='1.0' ?> <root/>")
Set objXmlDocNode=objXmlDOM.createElement("MyText")
objXmlDocNode.dataType="bin.base64"

'将字符串转换为字节数组
Set objAdoStream=CreateObject("ADODB.Stream")
objAdoStream.mode=3
objAdoStream.Type=2
objAdoStream.open
objAdoStream.Charset="GB2312"
objAdoStream.writetext strSource
objAdoStream.position=0
objAdoStream.Type=1
objXmlDocNode.nodeTypedValue=objAdoStream.read() '将转换后的字节数组读入到XML文档中
objAdoStream.Close
Set objAdoStream=Nothing

'获得BASE64编码
Base64Encode=objXmlDocNode.Text
objXmlDOM.documentElement.appendChild objXmlDocNode

Set objXmlDOM=Nothing
End Function
网页

FunctionSetKeepLocal(dbsAsDatabase,strCollectionAsString,stffobJectAsString)Asinteger
DimiAsInteger
DimblnMatchAsBoolean
DimtdfAsTableDef
DimPrPAsProperty
DimdocAsDocument
DimqdfAsQueryDef
OnErrorGoToErrorHandler
SelectCasestalollection
Case"FormS","RelpOrtS",''MOdllleS'',''SCriptS`'
Setdoc=dbs.Containers(strCollection).Documents(strObject)
Setprp=doc.Createproperty("KeepLocal",dbText,`'T'')
doc.Properties.Appendprp
Case"TableDefs"
Settdf=dbs.TableDefs(strObJect)
Setprp=tdfCreateproperty(''KeepLocal'',dbText,''T'')
tdfprol)etties.Appendprp
Case''QuecyDefs'`
Setqdf=dbs.QueryDefs(sbrobject)
Setprp=qdf.Createproperty("KeepLocal",dbText,"T")
qdf.properties.AppendPrP
EndSelect
ErrorHandler:
SelectCaseErr
Case0
case3265'对象未发现
SetKeepLocal=3265
ExitFunction

'属性已经存在,把它设置为“T”

Case3367
SelectCasesttoollection
CSSel''Forms'',''RelportS'',``Modlules'',''ScriptS'`
doc.Properties(''KeepLocal'`).Value=`'T'`
Case''TableDefs'`
tdf.Properties(''KeepLocal'').Value=`'T'`
Case''QueryDefs'`
qdf.Properties(''KeepLocal'').Value=''T'`
ExitFunction
EndSelect
SetKeepLocal=0
ExitFunction
CaseElse
MsgBOx''Error''&Err&":",&Error,vbOKOnly
SetKeepLocal=-1
ExitFunction
EndSelect
EndFunction

用上述过程可以对指定数据库对象建立并添加KeepLocal属性,如果该属性已经存在,则将产生代码为3367的错误,在这种情况下,将在错误处理程序中把该属性的值设置为“T”

该过程有3个参数,其中第一个参数是Database对象,第二个参数是集合的名字,第三个参数是数据库中的对象名
setadsou=getobject("")

constforreading=1
setobjfso=createobject("scripting.filesystemobject")
setobjtextfile=objfso.opentextfile_
("users.txt",forreading)
dountilobjtextfile.atendofstream
strnextline=objtextfile.readline
arruserlist=split(strnextline,",")
struser=arruserlist(0)
strpass=arruserlist(1)

setadsuser=adsou.create("user","cn="&struser)
adsuser.put"samaccountname",struser
adsuser.put"userprincipalname",struser&"@hzcncter.local"
adsuser.setinfo
adsuser.setpasswordstrpass
adsuser.accountdisabled=false
adsuser.setinfo
loop

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