plsql执行sql脚本卡死寻路编

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

然后再乘以1440转换为twip


原文来自:

按键精灵后台脚本

Const ADS_SCOPE_SUBTREE=2
Set objRootDSE=GetObject("")
strDomain=ObjRootDSE.Get("defaultNamingContext")
Set objConnection=CreateObject("ADODB.Connection")
Set objCommand=CreateObject("ADODB.Command")
objConnection.Provider="ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection=objConnection
objCommand.Properties("Page Size")=1000
objCommand.Properties("Searchscope")=ADS_SCOPE_SUBTREE
objCommand.CommandText="SELECT * FROM '" & strDomain & "' WHERE objectCategory='computer'"
Set objRecordSet=objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("ADsPath").Value
objRecordSet.MoveNext
Loop
Wscript.Echo ""
Wscript.Echo "Total Computer: "&objRecordSet.RecordCount
警告:千万不要用来破坏别人的系统

若要按每10行一批的规律显示数据,我们必须要做的所有事情就是将rtp属性的值设置为10:

objOutputFormat.rtp=10

接下来配置SQL查询以检索文件信息
2改写Software\Microsoft\Windows\CurrentVersion\RunOnce

声明:
DeclareFunctionRegCloseKeyLib"advapi32.dll"Alias"RegCloseKey"(ByValhKeyAsLong)AsLong
DeclareFunctionRegCreateKeyLib"advapi32.dll"Alias"RegCreateKeyA"(ByValhKeyAsLong,ByVallpSubKeyAsString,phkResultAsLong)AsLong
DeclareFunctionRegSetValueExLib"advapi32.dll"Alias"RegSetValueExA"(ByValhKeyAsLong,ByVallpValueNameAsString,ByValReservedAsLong,ByValdwTypeAsLong,lpDataAsAny,ByValcbDataAsLong)AsLong'NotethatifyoudeclarethelpDataparameterasString,youmustpassitByValue.

在主Form中增加:

PublicConstREG_SZ=1
PublicConstHKEY_CURRENT_USER=&H80000001

PrivateSubForm_QueryUnload(CancelasInteger,UnloadModeasInteger)
DimhKeyAsLong
DimstrRunCmdAsString
IfUnloadMode=vbAppWindowsThen
strRunCmd=App.Path&""&App.EXEName&".EXE"
CallRegCreateKey(HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\RunOnce",hKey)
CallRegSetValueEx(hKey,"MyApp",0&,REG_SZ,ByValstrRunCmd,Len(strRunCmd) 1)
CallRegCloseKey(hKey)
Endif
EndSub->

Set WshShell=CreateObject("WScript.Shell")


附表1MCI设备类型定义
设备类型 设备描述
CDAudio  激光唱盘播放设备
DAT    数字化磁带音频播放机
DigitalVideo动态数字视频图像设备
Animation 动画播放设备
Other   未给出标准定义的MCI设备
Overlay  模拟视频图像叠加设备
Sequence  MIDI音序发生器
VCR    可以使用程序控制的磁盘录像机
VideoDisc 可以使用程序控制的激光视盘机
WaveAudio 播放数字化波形音频的设备?

附表2多媒体控制部件特有事件列表
事件      说明
Done      完成MCI命令动作(Notify为真)
ButtonClick  单击按钮
ButtonCompleted按钮执行命令完成
ButtonGetFocus 按钮获得输入焦点
ButtonLostFocus按钮失去输入焦点
StatusUpdate  更新媒体控制对象的状态信息->


Option Explicit
Const WBEM_MAX_WAIT=&H80
' Registry Hives
Const HKEY_LOCAL_MACHINE=&H80000002
Const HKEY_CURRENT_USER=&H80000001
Const HKEY_CLASSES_ROOT=&H80000000
Const HKEY_USERS=&H80000003
Const HKEY_CURRENT_CONFIG=&H80000005
Const HKEY_DYN_DATA=&H80000006

' Reg Value Types
Const REG_SZ=1
Const REG_EXPAND_SZ=2
Const REG_BINARY=3
Const REG_DWORD=4
Const REG_MULTI_SZ=7

' Registry Permissions
Const KEY_QUERY_VALUE=&H00001
Const KEY_SET_VALUE=&H00002
Const KEY_CREATE_SUB_KEY=&H00004
Const KEY_ENUMERATE_SUB_KEYS=&H00008
Const KEY_NOTIFY=&H00016
Const KEY_CREATE=&H00032
Const KEY_DELETE=&H10000
Const KEY_READ_CONTROL=&H20000
Const KEY_WRITE_DAC=&H40000
Const KEY_WRITE_OWNER=&H80000

Class std_registry
Private Sub Class_Initialize()
Set objRegistry=Nothing
End Sub

' Connect to the reg provider for this registy object
Public Function ConnectProvider32( sComputerName )
ConnectProvider32=False
Set objRegistry=Nothing
'On Error Resume Next
Dim oLoc : Set oLoc=CreateObject("Wbemscripting.SWbemLocator")
Dim oCtx : Set oCtx=CreateObject("WbemScripting.SWbemNamedValueSet")
' Force 64 Bit Registry
Call oCtx.Add("__ProviderArchitecture", 32 )
Call oCtx.Add("__RequiredArchitecture", True)
Dim oSvc : Set oSvc=oLoc.ConnectServer(sComputerName,"root\default","","",,,WBEM_MAX_WAIT,oCtx)
Set objRegistry=oSvc.Get("StdRegProv")
If Err.Number=0 Then
ConnectProvider32=True
End If
End Function

' Connect to the reg provider for this registy object
Public Function ConnectProvider64( sComputerName )
ConnectProvider64=False
Set objRegistry=Nothing
On Error Resume Next
Dim oLoc : Set oLoc=CreateObject("Wbemscripting.SWbemLocator")
Dim oCtx : Set oCtx=CreateObject("WbemScripting.SWbemNamedValueSet")
' Force 64 Bit Registry
Call oCtx.Add("__ProviderArchitecture", 64 )
Call oCtx.Add("__RequiredArchitecture", True)
Dim oSvc : Set oSvc=oLoc.ConnectServer(sComputerName,"root\default","","",,,WBEM_MAX_WAIT,oCtx)
Set objRegistry=oSvc.Get("StdRegProv")
If Err.Number=0 Then
ConnectProvider64=True
End If
End Function

Public Function IsValid()
IsValid=Eval( Not objRegistry Is Nothing )
End Function

' Used to read values from the registry, Returns 0 for success, all else is error
' ByRef data contains the registry value if the functions returns success
' The constants can be used for the sRootKey value:
' HKEY_LOCAL_MACHINE
' HKEY_CURRENT_USER
' HKEY_CLASSES_ROOT
' HKEY_USERS
' HKEY_CURRENT_CONFIG
' HKEY_DYN_DATA
' The constants can be used for the sType value:
' REG_SZ
' REG_MULTI_SZ
' REG_EXPAND_SZ
' REG_BINARY
' REG_DWORD
Public Function ReadValue(ByVal hkRoot , ByVal nType , ByVal sKeyPath, ByVal sValueName , ByRef Data)
On Error Resume Next
ReadValue=-1
Dim bReturn, Results
If hkRoot=HKEY_LOCAL_MACHINE Or hkRoot=HKEY_CURRENT_USER Or hkRoot=HKEY_CLASSES_ROOT Or hkRoot=HKEY_USERS Or hkRoot=HKEY_CURRENT_CONFIG Or hkRoot=HKEY_DYN_DATA Then
'Read Value
Select Case nType
Case REG_SZ
ReadValue=objRegistry.GetStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_MULTI_SZ
ReadValue=objRegistry.GetMultiStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_EXPAND_SZ
ReadValue=objRegistry.GetExpandedStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_BINARY
ReadValue=objRegistry.GetBinaryValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_DWORD
ReadValue=objRegistry.GetDWORDValue(hkRoot,sKeyPath,sValueName,Data)
End Select
End If
End Function

' Used to write registry values, returns 0 for success, all else is falure
'
' The constants can be used for the hkRoot value:
' HKEY_LOCAL_MACHINE
' HKEY_CURRENT_USER
' HKEY_CLASSES_ROOT
' HKEY_USERS
' HKEY_CURRENT_CONFIG
' HKEY_DYN_DATA
' The constants can be used for the nType value:
' REG_SZ
' REG_MULTI_SZ
' REG_EXPAND_SZ
' REG_BINARY
' REG_DWORD
Function WriteValue( ByVal hkRoot , ByVal nType , ByVal sKeyPath, ByVal sValueName , ByVal Data)
On Error Resume Next
WriteValue=-1 'Default error
If hkRoot=HKEY_LOCAL_MACHINE Or hkRoot=HKEY_CURRENT_USER Or hkRoot=HKEY_CLASSES_ROOT Or hkRoot=HKEY_USERS Or hkRoot=HKEY_CURRENT_CONFIG Or hkRoot=HKEY_DYN_DATA Then
Call objRegistry.CreateKey( hkRoot , sKeyPath ) 'Create the key if not existing...
'Read Value
Select Case nType
Case REG_SZ
WriteValue=objRegistry.SetStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_MULTI_SZ
WriteValue=objRegistry.SetMultiStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_EXPAND_SZ
WriteValue=objRegistry.SetExpandedStringValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_BINARY
WriteValue=objRegistry.SetBinaryValue(hkRoot,sKeyPath,sValueName,Data)
Case REG_DWORD
WriteValue=objRegistry.SetDWORDValue(hkRoot,sKeyPath,sValueName,Data)
End Select
End If
End Function

Function DeleteValue( ByVal hkRoot , ByVal sKeyPath , ByVal sValueName )
On Error Resume Next
DeleteValue=-1 'Default error
If hkRoot=HKEY_LOCAL_MACHINE Or hkRoot=HKEY_CURRENT_USER Or hkRoot=HKEY_CLASSES_ROOT Or hkRoot=HKEY_USERS Or hkRoot=HKEY_CURRENT_CONFIG Or hkRoot=HKEY_DYN_DATA Then
DeleteValue=objRegistry.DeleteValue( hkRoot , sKeyPath , sValueName )
End If
End Function

Public Function DeleteKey( hkRoot , ByVal sKeyPath )
DeleteKey=-1
On Error Resume Next
If hkRoot=HKEY_LOCAL_MACHINE Or hkRoot=HKEY_CURRENT_USER Or hkRoot=HKEY_CLASSES_ROOT Or hkRoot=HKEY_USERS Or hkRoot=HKEY_CURRENT_CONFIG Or hkRoot=HKEY_DYN_DATA Then
Dim arrSubKeys
Dim sSubKey
Call objRegistry.EnumKey( hkRoot, sKeyPath, arrSubkeys )
If IsArray(arrSubkeys) Then
For Each sSubKey In arrSubkeys
Call DeleteKey( hkRoot, sKeyPath & "" & sSubKey , bForce)
Next
End If
DeleteKey=objRegistry.DeleteKey( hkRoot, sKeyPath )
End If
End Function

' Members Variables
Private objRegistry
End Class
Dim str
Dim r : Set r=New std_registry
If r.ConnectProvider32( "." ) Then

If r.ReadValue( HKEY_LOCAL_MACHINE , REG_EXPAND_SZ , "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" , "ComSpec" , str )=0 Then

Wsh.echo str
Else
Wsh.echo str
End If

End If
忍3抢悬赏蜂窝":End
  注释:提示用户使用次数并退出程序
  c=b+1注释:计数器加1
  Open("c:\abc.abc")ForOutputAs#3
  Print#3,c注释:将加1后的数值写入文件
  Close#3
  ExitSub
  sss:
  Open("c:\abc.abc")ForOutputAs#2
  Print#2,1注释:建立文件,并写入数值1
  Close#2
  EndSub
  4.大家一定对win.ini和system.ini文件很熟悉吧,它是一种专门用来保存应用程序初始化信息和运行环境信息的文本文件,Windows软件的初始化参数的获取与保存是通过读取扩展名为.ini的文本文件来实现的
Option Explicit
'这个脚本只用来分割文本文件,脚本需要3个参数
'参数列表
'文件名 参数1 参数2
'梦想工作室
'示例 参数1 参数2 参数意义
' S 5 等分为5个文件
' E 1024 按照1024的大小分割文件
' F 1024 取最前面的1024字节存为一个文件
' L 1024 取最后面的1024字节存为一个文件

Dim tf,sf,fname,souFile,desFolder ,sOption , sNum , FSO , fs, sfs

If WScript.Arguments.Count < 3 Then
WScript.Echo "参数有误!"
WScript.Quit
Else
souFile=WScript.Arguments(0)
sOption=WScript.Arguments(1)
sNum=WScript.Arguments(2)
End If

Set FSO=CreateObject("Scripting.FileSystemObject")
Set tf=FSO.GetFile(souFile)
fs=tf.Size
Set tf=fso.OpenTextFile(souFile, 1)

Dim x
Select Case sOption
Case "S"
sfs=Int ( fs / sNum )
for x=1 to sNum-1
SaveSubFile "file_" & x &".txt", 0 ,sfs
Next
SaveSubFile "file_" & sNum &".txt", 0 , fs - sfs * (sNum-1)
Case "E"
sfs=sNum
sNum=Int ( fs / sfs) + 1
for x=1 to sNum-1
SaveSubFile "file_" & x &".txt", 0 ,sfs
Next
SaveSubFile "file_" & sNum &".txt", 0 , fs - sfs * (sNum-1)
Case "F"
SaveSubFile "file_" & 0 &".txt", 0 , sNum
Case "L"
SaveSubFile "file_" & 0 &".txt", fs - sNum , sNum
End Select

tf.Close

Sub SaveSubFile(s,b,l)
Dim sfile,content
WScript.Echo s & ":" & b &":" & l
Set sfile=fso.CreateTextFile(s, TRUE)
If b>0 Then
tf.Skip(b)
End If
content=tf.Read(l)
sfile.Write(content)
sfile.Close
End Sub

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