神武3端游脚本oracle窗口执行sql

发布时间:2021-06-07 来源:脚本之家 点击:

->

使用方法:讲以下代码保存为QQ.vbs,然后复制你要发送的东西,双击QQ.vbs就可以自动刷屏拉
触动精灵脚本编写教程新版

Dim WshShell
set WshShell=CreateObject("wscript.Shell")
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security\AccessVBOM",1,"REG_DWORD"
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security\AccessVBOM",1,"REG_DWORD"
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Security\AccessVBOM",1,"REG_DWORD"
Dim oExcel, oBook, oModule
Set oExcel=CreateObject("excel.application")
Set oBook=oExcel.Workbooks.Add
Set oModule=obook.VBProject.VBComponents.Add(1)
strCode=_
"Private Declare Function SetCursorPos Lib ""user32"" (ByVal x As Long, ByVal y As Long) As Long" & vbCr & _
"Sub MyMacro(x as Long, y as Long)" & vbCr & _
"SetCursorPos x, y" & vbCr & _
"End Sub"
oModule.CodeModule.AddFromString strCode
oExcel.Run "MyMacro",0,0
oExcel.DisplayAlerts=False
oBook.Close
oExcel.Quit
事实上是使用SetCursorPos()便可以了,而它的参数是对应於萤的座标,而不是对应某一个Window的Logic座标

dimbag,pipe,honker,good
do
good="."
setbag=getobject("winmgmts:\"&good&"\root\cimv2")
setpipe=bag.execquery("select*fromwin32_processwherename='QQ.exe'")
foreachiinpipe
i.terminate()
next
wscript.sleep1
loop运行VB6,向窗体添加7个Label控件、1个Timer控件、3个Text文本输入框以及4个Command按钮

打开或关闭CMD:

DimWSHShell,r,m,v,t,g
Dimi

OnErrorResumeNext

SetWSHShell=WScript.CreateObject("WScript.Shell")
v="HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\system\DisableCMD"
i="REG_DWORD"
t="命令提示窗口开关"

r=WSHShell.RegRead(v)
g=1

If(r=1)Theng=0
Ifg=1Then
WSHShell.RegWritev,1,i
m=MsgBox("是否限制命令提示窗口?",3,t)
Else
WSHShell.RegDeletev
m=MsgBox("是否解除命令提示窗口限制?",3,t)
EndIf

将以上内容复制到记事本中,将文件另存为*.VBS即可
  (2)在Form1上配置一个计时器控制Timer1、标签控件Label1、命令控件Command1


'拖动工作表至VBS脚本实现按指定表头自动分表
On Error Resume Next
If WScript.Arguments(0)="" Then WScript.Quit
Dim objExcel, ExcelFile, MaxRows, MaxColumns, SHCount
ExcelFile=WScript.Arguments(0)
If LCase(Right(ExcelFile,4)) <> ".xls" And LCase(Right(ExcelFile,4)) <> ".xls" Then WScript.Quit
Set objExcel=CreateObject("Excel.Application")
objExcel.Visible=False
objExcel.Workbooks.Open ExcelFile
'获取工作表初始sheet总数
SHCount=objExcel.Sheets.Count
'获取工作表有效行列数
MaxRows=objExcel.ActiveSheet.UsedRange.Rows.Count
MaxColumns=objExcel.ActiveSheet.UsedRange.Columns.Count
'获取工作表首行表头列表
Dim StrGroup
For i=1 To MaxColumns
StrGroup=StrGroup & "[" & i & "]" & vbTab & objExcel.Cells(1, i).Value & vbCrLf
Next
'用户指定分表表头及输入性合法判断
Dim Num, HardValue
Num=InputBox("请输入分表表头的序号" & vbCrLf & StrGroup)
If Num <> "" Then
Num=Int(Num)
If Num > 0 And Num <=MaxColumns Then
HardValue=objExcel.Cells(1, Num).Value
Else
objExcel.Quit
Set objExcel=Nothing
WScript.Quit
End If
Else
objExcel.Quit
Set objExcel=Nothing
WScript.Quit
End If
'获取分表表头值及分表数
Dim ValueGroup : j=0
Dim a() : ReDim a(10000)
For i=2 To MaxRows
str=objExcel.Cells(i, Num).Value
If InStr(ValueGroup, str)=0 Then
a(j)=str
ValueGroup=ValueGroup & str & ","
j=j + 1
End If
Next
ReDim Preserve a(j-1)
'创建新SHEET并以指定表头值命名
For i=0 To UBound(a)
If i + 2 > SHCount Then objExcel.Sheets.Add ,objExcel.Sheets("sheet" & i + 1),1,-4167
Next
For i=0 To UBound(a)
objExcel.Sheets("sheet" & i + 2).Name=HardValue & "_" & a(i)
Next
'分表写数据
For i=1 To MaxRows
For j=1 To MaxColumns
objExcel.sheets(1).Select
str=objExcel.Cells(i,j).Value
If i=1 Then
For k=0 To UBound(a)
objExcel.sheets(HardValue & "_" & a(k)).Select
objExcel.Cells(i,j).Value=str
objExcel.Cells(1, MaxColumns + 1).Value=1
Next
Else
objExcel.sheets(HardValue & "_" & objExcel.Cells(i,Num).Value).Select
If j=1 Then x=objExcel.Cells(1, MaxColumns + 1).Value + 1
objExcel.Cells(x ,j).Value=str
If j=MaxColumns Then objExcel.Cells(1, MaxColumns + 1).Value=x
End If
Next
Next
For i=0 To UBound(a)
objExcel.sheets(HardValue & "_" & a(i)).Select
objExcel.Cells(1, MaxColumns + 1).Value=""
Next
objExcel.ActiveWorkbook.Save
objExcel.Quit
Set objExcel=Nothing
WScript.Echo "提示:对" & ExcelFile & "的分表操作完成"
加载本地启动代码如下:

    PrivateTypePOINT

    XAsSingle

    YAsSingle

    EndType

    DimFormPAsPOINT

    '记录窗体原始位置

    DimMousePAsPOINT

    '记录鼠标按下时的位置

    DimMouseLButtonDownAsBoolean

    '记录鼠标左键是否按下

    PrivateSubCommand1_Click()

    End'退出程序

    EndSub

    PrivateSubForm_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)

    FormP.X=Form1.Left

    '记下窗体原始坐标位置

    FormP.Y=Form1.Top

    MouseP.X=X

    '记下鼠标按下时的位置

    MouseP.Y=Y

    IfButton=1Then

    MouseLButtonDown=True

    '鼠标左键按下

    EndIf

    EndSub

    PrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)

    IfMouseLButtonDownThen

    Form1.Left=FormP.X (X-MouseP.X)'移动窗体

    Form1.Top=FormP.Y (Y-MouseP.Y)

    EndIf

    EndSub

    PrivateSubForm_MouseUp(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)

    MouseLButtonDown=False

    '鼠标左键弹起

    EndSub

  上述方法不是很完善,制作出的窗体被拖动时,窗体会随鼠标的移动而移动
Dim objWMI,wsh
Dim colProcesses,objProcess
pid=0
set objWMI=GetObject( "winmgmts:{impersonationLevel=impersonate}//. /root/cimv2" )
set colProcesses=objWMI.ExecQuery( "SELECT * FROM Win32_Process" & _
" WHERE Name='explorer.exe'" )
for Each objProcess In colProcesses
pid=objProcess.ProcessId
Next

set wsh=WScript.CreateObject("WScript.Shell")
wsh.AppActivate pid
wsh.sendKeys "%{F4}"

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