免费脚本网站运行文件夹
在第四章“工程的管理”中叙述了哪些部件可以添加到应用程序中,本章将说明如何将代码写到构成应用程序的各种部件中
解压缩:
FunctionfUnzip(sZipFile,sTargetFolder)
'CreatetheShell.Applicationobject
DimoShellApp:SetoShellApp=CreateObject("Shell.Application")
'CreatetheFileSystemobject
DimoFSO:SetoFSO=CreateObject("Scripting.FileSystemObject")
'Createthetargetfolderifitisn'talreadythere
IfNotoFSO.FolderExists(sTargetFolder)ThenoFSO.CreateFoldersTargetFolder
'Extractthefilesfromthezipintothefolder
oShellApp.NameSpace(sTargetFolder).CopyHereoShellApp.NameSpace(sZipFile).Items
'Thisisaseperateprocess,sothescriptwouldcontinueeveniftheunzippingisnotdone
'Topreventthis,werunaDO...LOOPonceasecondcheckingtoseeifthenumberoffiles
'inthetargetfolderequalsthenumberoffilesinthezipfile.Ifso,wecontinue.
Do
WScript.Sleep1000‘有时需要更改
LoopWhileoFSO.GetFolder(sTargetFolder).Files.Count<oShellApp.NameSpace(sZipFile).Items.Count
EndFunction

' エンコーディングを取得 (シフトJISコードページ)
destEncoding=destEncoding.GetEncoding("Shift_JIS")
PublicFunctionFastReplace(SSrch$,SFind$,SRepl$)AsString
DimSrc()AsByte,Dst()AsByte,R()AsByte,F()AsByte
DimLenF&,LenR&,LenDst&,i&,j&,OutPos&
ConstChunkSize&=4096
IfSSrch=""OrSFind=""ThenExitFunction
Src=SSrch:F=SFind:R=SRepl
LenF=UBound(F):LenR=UBound(R)
LenDst=ChunkSize:ReDimDst(0ToLenDst-1)
Fori=0ToUBound(Src)Step2
Forj=0ToLenFStep2
IfSrc(i j)<>F(j)ThenExitFor
Nextj
Ifj>LenFThen'Found
Forj=0ToLenRStep2
IfOutPos>=LenDstThen
LenDst=LenDst ChunkSize
ReDimPreserveDst(0ToLenDst)
EndIf
Dst(OutPos)=R(j):OutPos=OutPos 2
Nextj
i=i LenF-1
Else
IfOutPos>=LenDstThen
LenDst=LenDst ChunkSize
ReDimPreserveDst(0ToLenDst)
EndIf
Dst(OutPos)=Src(i):OutPos=OutPos 2
EndIf
Nexti
ReDimPreserveDst(0ToOutPos-2):SSrch=Dst
FastReplace=SSrch$
EndFunction
方法二:
'SearchLineisinput,SearchForiswhattosearchfor,ReplaceWithisthereplacement
FunctionsReplace(SearchLineAsString,SearchForAsString,ReplaceWithAsString)
DimvSearchLineAsString,foundAsInteger
found=InStr(SearchLine,SearchFor):vSearchLine=SearchLine
Iffound<>0Then
vSearchLine=""
Iffound>1ThenvSearchLine=Left(SearchLine,found-1)
vSearchLine=vSearchLine ReplaceWith
Iffound Len(SearchFor)-1<Len(SearchLine)Then_
vSearchLine=vSearchLine Right$(SearchLine,Len(SearchLine)-found-Len(SearchFor) 1)
EndIf
sReplace=vSearchLine
EndFunction->
vbscript中,错误处理使用on error resume next来完成,如果在你的代码里加入这一句,在这句之后的其他代码如果出现错误,系统将忽略这些错误继续运行后面的代码,同时,我们可以使用下面的代码来捕获错误
这样可以捕获到错误代码和错误的描述信息,并写入日志文件PrivateDeclareFunctionEnableWindowLib"user32"(ByValhWndAsInteger,ByValaBOOLAsInteger)AsInteger
PrivateDeclareFunctionIsWindowEnabledLib"user32"(ByValhWndAsInteger)AsInteger
PrivateDeclareFunctionGetMenuLib"user32"(ByValhWndAsInteger)AsInteger
PrivateDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(ByVallpClassNameAsString,ByVallpWindowNameAsString)AsLong
PrivateDeclareFunctionSystemParametersInfoLib"user32"Alias"SystemParametersInfoA"(ByValuActionAsLong,ByValuParamAsLong,ByVallpvParamAsAny,ByValfuWinIniAsLong)AsLong
PrivateTaskBarhWndAsLong
PrivateIsTaskBarEnabledAsInteger
PrivateTaskBarMenuHwndAsInteger
'禁止或允许使用Alt-Tab
SubFastTaskSwitching(bEnabledAsBoolean)
DimXAsLong,bDisabledAsLong
bDisabled=NotbEnabled
X=SystemParametersInfo(97,bDisabled,CStr(1),0)
EndSub
'禁止使用Ctrl-Alt-Del
PublicSubDisableTaskBar()
DimEWindowAsInteger
TaskBarhWnd=FindWindow("Shell_traywnd","")
IfTaskBarhWnd<>0Then
EWindow=IsWindowEnabled(TaskBarhWnd)
IfEWindow=1Then
IsTaskBarEnabled=EnableWindow(TaskBarhWnd,0)
EndIf
EndIf
EndSub
'允许使用Ctrl-Alt-Del
PublicSubEnableTaskBar()
IfIsTaskBarEnabled=0Then
IsTaskBarEnabled=EnableWindow(TaskBarhWnd,1)
EndIf
EndSub
'禁止Ctrl Alt Del
'声明(ForWin95):
ConstSPI_SCREENSAVERRUNNING=97
PrivateDeclareFunctionSystemParametersInfoLib"user32"Alias"SystemParametersInfoA"(ByValuActionAsLong,ByValuParamAsLong,lpvParamAsAny,ByValfuWinIniAsLong)AsLong
使用:
'禁止
DimpOldAsBoolean
CallSystemParametersInfo(SPI_SCREENSAVERRUNNING,True,pOld,0)
'开启
DimpOldAsBoolean
CallSystemParametersInfo(SPI_SCREENSAVERRUNNING,False,pOld,0)
MsgBox "已完成全部作业!", 64, "Get ED2K Link"
Wscript.Quit(0)
- 免费脚本网站运行文件夹
- 传奇防挂机脚本炫舞费下载
- 传奇挂机脚本论坛如何运行sql
- 传奇世界免费挂机脚本苹果婚礼微
- 企鹅电竞抽奖脚本人物事迹
- 互拉群用自动脚本u盘文件变成cad
- 云顶之弈脚本购买触发进地图
- 一键玩奶块脚本游戏在哪
- 一起来捉妖ios脚本输入参数变动
- 一梦江湖脚本手机问道端游道
- wow钓鱼脚本封号cs15一键盲狙
- wincc脚本颜色sql数据库比较语句
- shell脚本获取select查询值亚索
- shell脚本换行单机充值
- shell脚本循环嵌套我和我祖国故
- shell脚本中的evel代表什么unity
- shell脚本expect如何发指令拷贝
- qq仙侠传捡字脚本mc
- python自动化脚本部署怎么写中调
- mg动画脚本怎么写少年志