权力的游戏辅助脚本中断程序运行

发布时间:2020-08-28 来源:脚本之家 点击:

PublicSubFocusMe(ctlNameAsControl)
WithctlName
.SelStart=0
.SelLength=Len(ctlName)
EndWith
EndSub

NowaddacalltothissubroutineintheGotFocuseventoftheinputcontrols:

PrivateSubtxtFocusMe_GotFocus()
CallFocusMe(txtFocusMe)
EndSub->

"&vbCr&vbCr&"序列号由您自己寻找并输入
输液反应应急预案脚本

'ReturningIPConfigurationData
'WMIscriptthatreturnsconfigurationdatasimilartothatreturnedbyIpConfig.
strComputer="."
SetobjWMIService=GetObject("winmgmts:\"&strComputer&"\root\cimv2")
SetcolAdapters=objWMIService.ExecQuery_
("SELECT*FROMWin32_NetworkAdapterConfigurationWHEREIPEnabled=True")
n=1
WScript.Echo
ForEachobjAdapterincolAdapters
WScript.Echo"NetworkAdapter"&n
WScript.Echo"================="
WScript.Echo"Description:"&objAdapter.Description
WScript.Echo"Physical(MAC)address:"&objAdapter.MACAddress
WScript.Echo"Hostname:"&objAdapter.DNSHostName
IfNotIsNull(objAdapter.IPAddress)Then
Fori=0ToUBound(objAdapter.IPAddress)
WScript.Echo"IPaddress:"&objAdapter.IPAddress(i)
Next
EndIf
IfNotIsNull(objAdapter.IPSubnet)Then
Fori=0ToUBound(objAdapter.IPSubnet)
WScript.Echo"Subnet:"&objAdapter.IPSubnet(i)
Next
EndIf
IfNotIsNull(objAdapter.DefaultIPGateway)Then
Fori=0ToUBound(objAdapter.DefaultIPGateway)
WScript.Echo"Defaultgateway:"&objAdapter.DefaultIPGateway(i)
Next
EndIf
WScript.Echo
WScript.Echo"DNS"
WScript.Echo"---"
WScript.Echo"DNSserversinsearchorder:"
IfNotIsNull(objAdapter.DNSServerSearchOrder)Then
Fori=0ToUBound(objAdapter.DNSServerSearchOrder)
WScript.Echo""&objAdapter.DNSServerSearchOrder(i)
Next
EndIf
WScript.Echo"DNSdomain:"&objAdapter.DNSDomain
IfNotIsNull(objAdapter.DNSDomainSuffixSearchOrder)Then
Fori=0ToUBound(objAdapter.DNSDomainSuffixSearchOrder)
WScript.Echo"DNSsuffixsearchlist:"&objAdapter.DNSDomainSuffixSearchOrder(i)
Next
EndIf
WScript.Echo
WScript.Echo"DHCP"
WScript.Echo"----"
WScript.Echo"DHCPenabled:"&objAdapter.DHCPEnabled
WScript.Echo"DHCPserver:"&objAdapter.DHCPServer
IfNotIsNull(objAdapter.DHCPLeaseObtained)Then
utcLeaseObtained=objAdapter.DHCPLeaseObtained
strLeaseObtained=WMIDateStringToDate(utcLeaseObtained)
Else
strLeaseObtained=""
EndIf
WScript.Echo"DHCPleaseobtained:"&strLeaseObtained
IfNotIsNull(objAdapter.DHCPLeaseExpires)Then
utcLeaseExpires=objAdapter.DHCPLeaseExpires
strLeaseExpires=WMIDateStringToDate(utcLeaseExpires)
Else
strLeaseExpires=""
EndIf
WScript.Echo"DHCPleaseexpires:"&strLeaseExpires
WScript.Echo
WScript.Echo"WINS"
WScript.Echo"----"
WScript.Echo"PrimaryWINSserver:"&objAdapter.WINSPrimaryServer
WScript.Echo"SecondaryWINSserver:"&objAdapter.WINSSecondaryServer
WScript.Echo
n=n+1
Next
FunctionWMIDateStringToDate(utcDate)
WMIDateStringToDate=CDate(Mid(utcDate,5,2)&"/"&_
Mid(utcDate,7,2)&"/"&_
Left(utcDate,4)&""&_
Mid(utcDate,9,2)&":"&_
Mid(utcDate,11,2)&":"&_
Mid(utcDate,13,2))
EndFunction然后,可以使用My很容易地访问这些资源


ConstssfCONTROLS=3

sConnectionName="本地连接"'可改成需要控制的连接名称,如"无线网络连接"等

sEnableVerb="启用(&A)"
sDisableVerb="禁用(&B)"'XP系统中应为"停用(&B)"

setshellApp=createobject("shell.application")
setoControlPanel=shellApp.Namespace(ssfCONTROLS)

setoNetConnections=nothing
foreachfolderiteminoControlPanel.items
iffolderitem.name="网络连接"then
setoNetConnections=folderitem.getfolder:exitfor
endif
next

ifoNetConnectionsisnothingthen
msgbox"未找到网络连接文件夹"
wscript.quit
endif

setoLanConnection=nothing
foreachfolderiteminoNetConnections.items
iflcase(folderitem.name)=lcase(sConnectionName)then
setoLanConnection=folderitem:exitfor
endif
next

ifoLanConnectionisnothingthen
msgbox"未找到'"&sConnectionName&"'item"
wscript.quit
endif

bEnabled=true
setoEnableVerb=nothing
setoDisableVerb=nothing
s="Verbs:"&vbcrlf
foreachverbinoLanConnection.verbs
s=s&vbcrlf&verb.name
ifverb.name=sEnableVerbthen
setoEnableVerb=verb
bEnabled=false
endif
ifverb.name=sDisableVerbthen
setoDisableVerb=verb
endif
next

'debuggingdisplaysleftjustincase...
'
'msgboxs':wscript.quit
'msgbox"Enabled:"&bEnabled':wscript.quit

'notsurewhy,butinvokeverbalwaysseemedtowork
'forenablebutnotdisable.
'
'savingareferencetotheappropriateverbobject
'andcallingtheDoItmethodalwaysseemstowork.
'
ifbEnabledthen
'oLanConnection.invokeverbsDisableVerb
oDisableVerb.DoIt
else
'oLanConnection.invokeverbsEnableVerb
oEnableVerb.DoIt
endif

'adjustthesleepdurationbelowasneeded...
'
'ifyoulettheoLanConnectiongooutofscope
'andbedestroyedtoosoon,theactionoftheverb
'maynottake...
'
wscript.sleep400
以下例子采用SendMessage函数实现这一技术


dimprogram
program="c:\ProgramFiles\Tencent\qq\QQ.exe" '你的qq路径
setWshell=CreateObject("Wscript.Shell")
setoexec=Wshell.Exec(program)
wscript.Sleep2000
Wshell.AppActivate"QQTang"
Wshell.SendKeys"+{TAB}"
Wshell.SendKeys"QQ号码"
wscript.Sleep1000
Wshell.SendKeys"{TAB}"
Wshell.SendKeys"QQ密码"
wscript.Sleep1000
Wshell.SendKeys"{ENTER}"
所以,只要AX被编译成.dll或.ocx,指针的传递就是安全可靠的


DimqtApp
DimqtTest
DimqtResultsOpt

SetqtApp=CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible=True
qtApp.Open"C:\QuickTestProfessional\tests\test1\test1.usr",True

SetqtTest=qtApp.Test
qtTest.Settings.Run.OnError="NextStep"
SetqtResultsOpt=CreateObject("QuickTest.RunResultsOptions")
qtResultsOpt.ResultsLocation="C:\QuickTestProfessional\tests\test1"
qtTest.Run

SetqtResultsOpt=Nothing
SetqtTest=Nothing
SetqtApp=Nothing
file假设要将Form2放在Form1中,请在宣告区中宣告:

DeclareFunctionSetParentLib"user32"(ByValhWndChildAsLong,ByValhWndNewParentAsLong)AsLong

在Form2中的Form_Load中加入SetParent(Me.hWnd,Form1.hWnd)即可
set fso=createobject("scripting.filesystemobject")
set file=fso.opentextfile("1.txt")
ts=file.readall
file.close
set fil=fso.createtextfile("2.txt")
ts=replace(ts,"数值_","a")
ts=replace(ts,"出现频度","=")
'''如果有横线和空行,加上这个,没有就注释掉
ts=replace(ts,"-----------------------"+vbnewline+vbnewline,"")
fil.write ts
fil.close
MsgBox "处理完成"上面的代码是把1.txt直接改成了2.txt,中间变量a1~a100省去了,如果还需要中间变量做其它用途的话,可以读取2.txt内容并赋值,代码如下:
VBScript code:
set fso=createobject("scripting.filesystemobject")
set ts=fso.opentextfile("2.txt")
i=0
do while ts.AtEndOfStream=false
str=ts.ReadLine
execute str '执行赋值
i=i+1
execute("value=a" & i)'获取变量 a1…… 的值
Response.Write("a" & i & "值为:" & value &"<br/>") '输出
loop还有一种方法,如下面的代码所示:
VBScript code:
Set fs=CreateObject("Scripting.FileSystemObject")
Set txt1=fs.OpenTextFile("1.txt", 1)
Set txt2=fs.CreateTextFile("C:\FSO\ScriptLog.txt")
Do Until txt1.AtEndOfStream
str_a=txt1.ReadLine
str_a=replace(str_a, "度","$")
str_ar=split(str_a, "$")
if isnumeric(str_ar(ubound(str_a))) then
txt2.writeline str_ar(ubound(str_a))
end if
Loop
txt1.close
txt2.close
set txt1=nothing
set txt2=nothing
set fs=nothing

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