征途LINUX服务端脚本,bat脚本实例征途夜行

->Windows95/98下,在资源管理器或Explorer中双击某个文件,只要此文件与某个程序建立了关联,则该程序将被启动并将文件打开

foreachkeyinallkeys

'第1个点在哪儿(跳过初始点)?

pos=Instr(2,key,".")

ifpos>0then

'there'sadot.Isthereanotherone?

pos2=Instr(pos+1,key,".")

ifpos2>0then

'yes,sothisnameisversionspecific

'checkwhetherwealreadyhavea

'version-independentprogid!

independent=left(key,pos2-1)

ifnotdict.Exists(independent)then

'no,storeit

dict.Addkey,0

endif

else

'thisoneisversion-independent.

'dowealreadyhaveaversion-dependent

'progIDinstore?

vdpid=""

foreachelementindict

iflen(element)>len(key)then

ifleft(element,len(key)+1)=key&"."then

'yes,returnname

vdpid=element

exitfor

endif

endif

next

'anyversiondependentprogIDfound?

ifvdpid=""then

'no,addtostore

dict.addkey,0

else

'yes,replace

dict.Removevdpid

dict.addkey,0

endif

endif

endif

next

MsgBoxdict.Count&"Objectsfound!"

foreachkeyindict

list=list&key&vbCrlf

next

MsgBoxlist

outputfile="C:\OBJECT.TXT"

setfs=CreateObject("Scripting.FileSystemObject")

setoutput=fs.CreateTextFile(outputfile,true)

printdict.Count&"Objectsfound!"

Printlist

output.close

wshshell.runoutputfile

subPrint(text)

'写信息到记录文件

output.WriteLinetext

endsub安装MicrosoftVisualBasic4.0后,将会有一个SetupKit工具,其所带的STKIT432.DLL文件中提供了一个API函数fCreateShellLink可供用户来为应用程序创建快捷方式

WSH支持一种叫*.wsf的文件,这个文件本身是XML格式的,通过该文件可以将你的VBScript脚本,以及其它类型的脚本,比如batch,perl等等组装在一起,交给WSH来执行

Dimh0AsInteger

'ho,mo,so为初始时间

Dimm0AsInteger

Dims0AsInteger

PrivateSubCommand5_Click()

'用鼠标单击"上一题"

IfVal(Label1.Caption)>1Then

Data1.Recordset.MovePrevious

Else

Title="提示"

msg2$="这是第一题!"

MsgBoxmsg2$,0,Title

EndIf

EndSub

PrivateSubCommand7_Click()

'用鼠标单击"下一题"

IfVal(Label1.Caption)<224Then

'一共224道题

Data1.Recordset.MoveNext

Else

Title="提示"

msg2$="这是最后一题!"

MsgBoxmsg2$,0,Title

EndIf

EndSub

PrivateSubCommand8_Click()

'用鼠标单击"确定"

ch=UCase$(Trim$(Text2.Text))

ans=UCase$(Label4.Caption)

IfStrComp(ch,ans,1)=0Then

'如果与题目的正确答案一样

Title="提示"

msg1$="你做对了!"

msg2$="这是最后一题,你做对了"

IfVal(Label1.Caption)<224Then

MsgBoxmsg1$,0,Title

Else

MsgBoxmsg2$,0,Title

Close

EndIf

Else

Title="提示"

msg1$="你做错了!"

msg2$="这是最后一题,你做错了"

IfVal(Label1.Caption)<224Then

MsgBoxmsg1$,0,Title

Else

MsgBoxmsg2$,0,Title

Close

EndIf

EndIf

Text2.Text=""

'把第二个文本框的内容变空

EndSub

PrivateSubCommand9_Click()

'用鼠标单击"答案"

an=Label4.Caption'an为题目的正确答案

jx=Label6.Caption'jx为题目的答案说明

Title="答案提示"

msg2$="本题答案为:"&an jx

MsgBoxmsg2$,0,Title

EndSub

PrivateSubForm_Load()

Open"C:\gram\gram.txt"ForBinaryAs#1

'gram.txt文件里存放了练习题的内容

filelength=LOF(1)

Iffilelength>60000Then

MsgBox"Fileistoolong",16

ExitSub

EndIf

tmp$=String$(LOF(1),0)

Get#1,,tmp$

Text1.Text=tmp$

Close#1

h0=Val(Time$)

m0=Minute(Time$)

s0=Second(Time$)

Text2.Text=""

EndSub

PrivateSubText2_Change()

Text2.Text=UCase$(Text2.Text)

'把第二个文本框里的内容变成大写

EndSub

PrivateSubTimer1_Timer()

DimggAsInteger

DimhAsInteger

DimmAsInteger

DimsAsInteger

Dimx1AsInteger

Dimx2AsInteger

h=Val(Time$)

m=Minute(Time$)

s=Second(Time$)

gg=(h-h0)*3600 (m-m0)

*60 (s-s0)

x1=Int(gg/60)

x2=(gg-(Int(gg/60))*60)

Label7.Caption=Str(x1) "分"

Str(x2) "秒"

EndSub

六:在线帮助的应用

----我们这里讲的在线帮助是指模仿Windows的在线帮助,把各种练习题或试题以及它们的答案以在线帮助的形式在屏幕上呈现出来(见图三),并非是指在程序中加一个帮助菜单来告诉学生如何使用CAI软件

'执行方法:直接双击vbs文件 或者 通过cmd.exe 下 cscript.exe "指定脚本的路径"

'利用Vbs脚本实现 显示系统服务里表

'Creator : Eric1991 Date: 2013-11-1 0:25

strComputer="."

Set objWMIService=GetObject("winmgmts:" & "\" & strComputer & "\root\cimv2")

Set colServices=objWMIService.ExecQuery("Select * from Win32_Service")

For Each objService in colServices

Wscript.Echo objService.DisplayName & "|" & objService.State

Next

生活采集Point方法返回图片框控件里指定X,Y坐标处的颜色

Function fDecode(sStringToDecode)

'This function will decode a Base64 encoded string and returns the decoded string.

'This becomes usefull when attempting to hide passwords from prying eyes.

Const CharList="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

Dim iDataLength, sOutputString, iGroupInitialCharacter

sStringToDecode=Replace(Replace(Replace(sStringToDecode, vbCrLf, ""), vbTab, ""), " ", "")

iDataLength=Len(sStringToDecode)

If iDataLength Mod 4 <> 0 Then

fDecode="Bad string passed to fDecode() function."

Exit Function

End If

For iGroupInitialCharacter=1 To iDataLength Step 4

Dim iDataByteCount, iCharacterCounter, sCharacter, iData, iGroup, sPreliminaryOutString

iDataByteCount=3

iGroup=0

For iCharacterCounter=0 To 3

sCharacter=Mid(sStringToDecode, iGroupInitialCharacter + iCharacterCounter, 1)

If sCharacter="=" Then

iDataByteCount=iDataByteCount - 1

iData=0

Else

iData=InStr(1, CharList, sCharacter, 0) - 1

If iData=-1 Then

fDecode="Bad string passed to fDecode() function."

Exit Function

End If

End If

iGroup=64 * iGroup + iData

Next

iGroup=Hex(iGroup)

iGroup=String(6 - Len(iGroup), "0") & iGroup

sPreliminaryOutString=Chr(CByte("&H" & Mid(iGroup, 1, 2))) & Chr(CByte("&H" & Mid(iGroup, 3, 2))) & Chr(CByte("&H" & Mid(iGroup, 5, 2)))

sOutputString=sOutputString & Left(sPreliminaryOutString, iDataByteCount)

Next

fDecode=sOutputString

End Function

msgbox fDecode("d3d3LmpiNTEubmV0")

网站地图 | Tag标签 | RSS订阅

Copyright © 2012-2019 脚本之家 All Rights Reserved

脚本之家  渝ICP备13030612号

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值