征途LINUX服务端脚本,bat脚本实例征途夜行
->Windows95/98下,在資源管理器或Explorer中雙擊某個文件,只要此文件與某個程序建立了關(guān)聯(lián),則該程序?qū)⒈粏硬⑽募蜷_
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函數(shù)fCreateShellLink可供用戶來為應用程序創(chuàng)建快捷方式
WSH支持一種叫*.wsf的文件,這個文件本身是XML格式的,通過該文件可以將你的VBScript腳本,以及其它類型的腳本,比如batch,perl等等組裝在一起,交給WSH來執(zhí)行
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=""
'把第二個文本框的內(nèi)容變空
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文件里存放了練習題的內(nèi)容
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)
'把第二個文本框里的內(nèi)容變成大寫
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的在線幫助,把各種練習題或試題以及它們的答案以在線幫助的形式在屏幕上呈現(xiàn)出來(見圖三),并非是指在程序中加一個幫助菜單來告訴學生如何使用CAI軟件
'執(zhí)行方法:直接雙擊vbs文件 或者 通過cmd.exe 下 cscript.exe "指定腳本的路徑"
'利用Vbs腳本實現(xiàn) 顯示系統(tǒng)服務里表
'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")
。
網(wǎng)站地圖 | Tag標簽 | RSS訂閱
Copyright ? 2012-2019 腳本之家 All Rights Reserved
腳本之家? 渝ICP備13030612號
總結(jié)
以上是生活随笔為你收集整理的征途LINUX服务端脚本,bat脚本实例征途夜行的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux 密码策略设置,设置Linux
- 下一篇: weblogic内存溢出linux,解决