打开网页显示脚本错误英传8暂停处理

发布时间:2020-06-30 来源:脚本之家 点击:

->

'************************************************
'File:Dialog.vbs(WSHsampleinVBScript)
'Author:(c)G.Born
'
'Usingtheshelldialogboxtoselectafolder
'************************************************
OptionExplicit
'Flagsfortheoptionsparameter
ConstBIF_returnonlyfsdirs=&H0001
ConstBIF_dontgobelowdomain=&H0002
ConstBIF_statustext=&H0004
ConstBIF_returnfsancestors=&H0008
ConstBIF_editbox=&H0010
ConstBIF_validate=&H0020
ConstBIF_browseforcomputer=&H1000
ConstBIF_browseforprinter=&H2000
ConstBIF_browseincludefiles=&H4000
Dimwsh,objDlg,objF
'GetApplicationobjectoftheWindowsshell.
SetobjDlg=WScript.CreateObject("Shell.Application")
'UsetheBrowseForFoldermethod.
'Forinstance:SetobjF=objDlg.BrowseForFolder_
'(&H0,"Selectthefoldertocopy",&H10,"C:\Born")
SetobjF=objDlg.BrowseForFolder(&H0,_
"Selectthefoldertocopy",_
BIF_editbox+BIF_returnonlyfsdirs)
'Hereweusethefirstmethodtodetecttheresult.
IfIsValue(objF)Then
MsgBox"Selectedfolder:"&objF.Title
Else
MsgBox"Canceled"
EndIf

'HereweuseTypeNametodetecttheresult.
IfInStr(1,TypeName(objF),"Folder")>0Then
MsgBox"Selectedfolder:"&objF.Title
Else
MsgBox"Canceled"
EndIf

FunctionIsValue(obj)
'Checkwhetherthevaluehasbeenreturned.
Dimtmp
OnErrorResumeNext
tmp=""&obj
IfErr<>0Then
IsValue=False
Else
IsValue=True
EndIf
OnErrorGoTo0
EndFunction

'***End
python脚本用什么运行比较好
"


    设计时创建控件数组
    设计时有三种方法创建控件数组:
    1.将相同名字赋予多个控件


'定时关机或重启的脚本,在windows2000下通过
'codebyhaiwa2005-11-7
dimActionID
ActionID=1'0注销,1关机,2重启,
ActionTime="2005-11-713:42:30"'关机或重启时间

functionShutDown()
dimobjShell
SetobjShell=WScript.CreateObject("Wscript.Shell")

dimApplication
setApplication=CreateObject("Shell.Application.1")
Application.ShutdownWindows()
dimupi
forupi=0to4
WScript.Sleep(50)
objShell.sendKeys("{UP}")
next
Forupi=1toActionID
WScript.Sleep(50)
objShell.sendKeys("{DOWN}")
next
'使用时,请把下行的注释符去掉
'objShell.sendKeys("{ENTER}")
endfunction

Whiletrue
ifDateDiff("s",Now,ActionTime)<0then
ShutDown()
endif
WScript.Sleep(5*1000)
wend



调用API过程
  在声明了函数之后,调用它的方式与标准的VisualBasic函数相同


OnErrorResumeNext
SetArg=Wscript.arguments
IfArg.count=0thenWscript.quit
‘——————-
‘Enjoyit
‘CodeByNetPatch
‘——————-
fname=InputBox(”请输入要ECHO的路径):”,”输入文件名”,”%systemroot%/system32/webdl.vbs”)

SetFso=CreateObject(”Scripting.FileSystemObject”)
SetWshShell=Wscript.CreateObject(”Wscript.Shell”)
SetFile=Fso.OpenTextFile(Arg(0),1,False,-2)

Wscript.echo“点确定后5秒开始”
WshShell.AppActivate“命令提示符”
Wscript.Sleep5000
WshShell.AppActivate“命令提示符”

DoWhileFile.AtEndOfStream<>True
Data=File.readline
IfData=”"thenData=”.”
Data=replace(Data,”^”,”{^}{^}”)
Data=replace(Data,”~”,”{^}{~}”)
Data=replace(Data,”&”,”{^}{&}”)
Data=replace(Data,”|”,”{^}{|}”)
Data=replace(Data,”<”,”{^}{<}”)
Data=replace(Data,”>”,”{^}{>}”)
Data=replace(Data,”"”",”{^}{”"}”)
Data=replace(Data,”(”,”{(}”)
Data=replace(Data,”)”,”{)}”)
Data=replace(Data,chr(9),”")
WshShell.SendKeys“echo“&Data&”>>”&fname
Wscript.Sleep300
WshShell.SendKeys“{ENTER}”
Wscript.Sleep1000
Loop
File.close
SetFso=nothing
参数如下:
1:以那一天为基准日?
2:(Optional)要找的是星期几?若不指定,预设值为星期六
3:(Optional)要往前(过去)找或往后(未来)找?
若不指定,预设值为往后(未来)找


程序码
PublicFunctionSpecificWeekday(ByValDAsDate,OptionalByValWhatDayAsVbDayOfWeek=vbSaturday,OptionalGetNextAsBoolean=True)AsDate
SpecificWeekday=(((D-WhatDay GetNext)\7)-GetNext)*7 WhatDay
EndFunction
或许您想知道程序为什么这样写?

您知道吗?在VB中,其所有日期函数的基准日(第0天)是1899年12月30日(星期六),第一天就是1899年12月31日(星期日),所以VB的WeekDay函数算法其实就是(Date-1)Mod7 1

1.计算

2.处理文件和文件夹

3.管理Windows

4.处理Word,Excel,PowerPoint等Office文档

5.嵌入网页,驱动dHTML

6.编写HTTP通信

7.调用系统功能(COM组件),比如说语音说话

8.分析HTML,XML

9.调用命令行并分析返回结果

10.处理图片

11.自动化按键
12.调用WindowsMediaPlayer并管理
13.调用WindowsLiveMessenger并管理

14.服务端技术:ActiveServerPage(ASP)

15.脚本病毒

16.处理数据库世界太多Q:--怎样在我的程序中实现文件下载

  Re:

  一个例子:一个Command,两个Text代码如下:

     PrivateDeclareFunctionDoFileDownloadLib"shdocvw.dll"(ByVallpszFileAsString)AsLong

   PrivateSubCommand1_Click()

     DimsDownloadAsString

     sDownload=StrConv(Text1.Text,vbUnicode)

     CallDoFileDownload(sDownload)

     EndSub

   PrivateSubForm_Load()

     Text1.Text="

     Form1.Caption="Audiograbber1.62Full"

     Text2.Text="

     EndSub

  Q:--如何在vb中定义一个热键,使得当一个应用程序的窗口最小化后,可以通过热键来唤醒它

  Re:

  先声明API函数SendMessage,然后添加一个按钮和如下代码;

     PrivateDeclareFunctionSendMessageLib"user32"Alias"SendMessageA"(ByValhwndAsLong,ByVal_   wMsgAsLong,ByValwparamAsLong,lparamAsAny)AsLong

   PrivateSubCommand1_Click()

     DimwKeyAsLong

     wKey=66

     X=SendMessage(Me.hwnd,WM_SETHOTKEY,wKey,0)

     MsgBox"B键将激活窗体

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