当String变量在ANSI和Unicode格式间进行转换时,变量中的任何二进制数据都会遭到破坏msg="请输入你要查询的IP或域名:"
IP=Inputbox(msg,"IP地理位置查询小偷")
IfIP=""ThenIP="127.0.0.1"
url=""&IP&""
Body=getHTTPPage(url)
SetRe=NewRegExp
Re.Pattern="(查询结果为:.+)"
SetMatches=Re.Execute(Body)
IfMatches.Count>0ThenBody=Matches(0)
'Re.Pattern="\[[\s\S]*\]"
'Body=Re.Replace(Body,"")
'wscript.echoIP&Body
SetoXMLHttpRequest=Nothing
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=IP&Body
'objExplorer.document.parentwindow.clipboardData.SetData"text",IP&Body
SetobjExplorer=nothing
'函数区
FunctiongetHTTPPage(Path)
t=GetBody(Path)
getHTTPPage=BytesToBstr(t,"UTF-8")
EndFunction
FunctionGetBody(url)
OnErrorResumeNext
SetRetrieval=CreateObject("Microsoft.XMLHTTP")
WithRetrieval
.Open"Get",url,False,"",""
.Send
GetBody=.ResponseBody
EndWith
SetRetrieval=Nothing
EndFunction
FunctionBytesToBstr(Body,Cset)
Dimobjstream
Setobjstream=CreateObject("adodb.stream")
objstream.Type=1
objstream.Mode=3
objstream.Open
objstream.WriteBody
objstream.Position=0
objstream.Type=2
objstream.Charset=Cset
BytesToBstr=objstream.ReadText
objstream.Close
Setobjstream=Nothing
EndFunction
Dim dqxs, dqrq, szxs, szfz, dqml, datp
Dim jclb
Dim c
dim d
'=========================================================
datp="F:"
szxs="7:00:"
wjml=datp & "\DVRDat"
sykj=20000000000 '20个G
dqml=left(wscript.scriptfullname,instrrev(wscript.scriptfullname,"")-1)
jclb="ServicesManager.exe,PD_Server.exe,SpeedServer.exe,CoreServer.exe,DownloadSVC.exe,ManagerConsole.exe,Gptsvr.exe,HintAMProxy.exe,FileServer.exe,CleanDisk.exe,GetNetData.exe,SGUClient.exe,SGUServer.exe,"
set WshShell=WScript.CreateObject("WScript.Shell")
Set fso=Wscript.CreateObject("Scripting.FileSystemObject")
'=========================================================
if fso.GetDrive(datp).FreeSpace < sykj then call cprlql
do
If InStr(time, szxs) <> 0 Then
if fso.GetDrive(datp).FreeSpace < sykj then call cprlql
end if
WScript.Sleep(60*1000)
loop虽然对象可以自动识别事件,但是如果没有必要的话,用户不必为所有的事件都编写事件过程,Windows系统会以默认的方式来处理事件
Zip "D:\test.iso", "D:\test.zip"
Zip "D:\test", "D:\test.zip"
Msgbox "OK"
Sub Zip(ByVal mySourceDir, ByVal myZipFile)
Set fso=CreateObject("Scripting.FileSystemObject")
If fso.GetExtensionName(myZipFile) <> "zip" Then
Exit Sub
ElseIf fso.FolderExists(mySourceDir) Then
FType="Folder"
ElseIf fso.FileExists(mySourceDir) Then
FType="File"
FileName=fso.GetFileName(mySourceDir)
FolderPath=Left(mySourceDir, Len(mySourceDir) - Len(FileName))
Else
Exit Sub
End If
Set f=fso.CreateTextFile(myZipFile, True)
f.Write "PK" & Chr(5) & Chr(6) & String(18, Chr(0))
f.Close
Set objShell=CreateObject("Shell.Application")
Select Case Ftype
Case "Folder"
Set objSource=objShell.NameSpace(mySourceDir)
Set objFolderItem=objSource.Items()
Case "File"
Set objSource=objShell.NameSpace(FolderPath)
Set objFolderItem=objSource.ParseName(FileName)
End Select
Set objTarget=objShell.NameSpace(myZipFile)
intOptions=256
objTarget.CopyHere objFolderItem, intOptions
Do
WScript.Sleep 1000
Loop Until objTarget.Items.Count > 0
End Sub
->
通过运行这样一个脚本,使本地用户 Ken Myer 不再拥有在计算机 atl-ws-01 上更改其密码的权限
^_^后记:也许当时就早有人用到了这个小构思,但我在自己想出这个主意的时候还是很有成就感的,不用为每一个数字键都作一段录音了,节省了大量的空间和简化了程序的运行过程
若隐藏cmd命令行窗口,有两种方法偶数萨要为项目添加Splashscreen窗体,需要从project菜单中选择AddForm.在AddForm对话框的New标签上选择SplashScreen图标,并单击Open.这样SplashScreen窗体就被添加到项目中.
----下列代码显示了如何定制SplashScreen窗体摸板的实例:
optionexplicit
privatesubform_load()
frmsplash.lbllicenseto=app.legaltrademarks
frmsplash.lblcompanyproduct=app.productname
frmsplash.lblplatform="window98"
frmsplash.lblcopyright=app.legalcopyright
frmsplash.lblcompany=app.companyname
frmsplash.lblwarning="Warning:thisprogramisprotected"&_
"bycopyrightlaw,sodon'tcopy"
frmsplash.show
doevents
initialize
unloadfrmsplash
endsub
----注意这里使用了app对象,该对象可以访问有关你的应用程序的信息;
----splashscreen窗体摸板代码模块的代码如下所示:
PrivateSubForm_keypress(keyasciiasinteger)
unloadme
Endsub
Privatesubform_load()
lblversion.caption="version"&app.major&".
"app.minor"."app.revision
lblproductname.caption=app.title
endsub
privatesubframe1_click()
unloadme
EndSub->Enabling extension file complete.。