输液应急预案演练脚本window执行

发布时间:2021-08-18 来源:脚本之家 点击:



  有了上述功能还不够,因为学习者不一定一步一步进行到底,有可能需要返回到上一步,或是跳过某一步Ture 覆盖, False 跳过
'*
'* Output: 返回复制的文件个数
'*
'********************************************************************
Function XCopy(fso, source, destination, overwrite)
Dim s, d, f, l, CopyCount
Set s=fso.GetFolder(source)

If Not fso.FolderExists(destination) Then
fso.CreateFolder destination
End If
Set d=fso.GetFolder(destination)

CopyCount=0
For Each f In s.Files
l=d.Path & "" & f.Name
If Not fso.FileExists(l) Or overwrite Then
If fso.FileExists(l) Then
fso.DeleteFile l, True
End If
f.Copy l, True
CopyCount=CopyCount + 1
End If
Next

For Each f In s.SubFolders
CopyCount=CopyCount + XCopy(fso, f.Path, d.Path & "" & f.Name, overwrite)
Next

XCopy=CopyCount
End Function

键盘鼠标脚本

Option Explicit

Dim WshShell
Dim oExcel, oBook, oModule
Dim strRegKey, strCode, x, y
Set oExcel=CreateObject("Excel.Application") '创建 Excel 对象

set WshShell=CreateObject("wscript.Shell")

strRegKey="HKEY_CURRENT_USER\Software\Microsoft\Office\$\Excel\Security\AccessVBOM"
strRegKey=Replace(strRegKey, "$", oExcel.Version)

WshShell.RegWrite strRegKey, 1, "REG_DWORD"

Set oBook=oExcel.Workbooks.Add '添加工作簿
Set oModule=obook.VBProject.VBComponents.Add(1) '添加模块
strCode=_

"'Author: Demon" & vbCrLf & _
"'Website: " & vbCrLf & _
"'Date: 2011/5/10" & vbCrLf & _

"Private Type POINTAPI : X As Long : Y As Long : End Type" & vbCrLf & _
"Private Declare Function SetCursorPos Lib ""user32"" (ByVal x As Long, ByVal y As Long) As Long" & vbCrLf & _

"Private Declare Function GetCursorPos Lib ""user32"" (lpPoint As POINTAPI) As Long" & vbCrLf & _
"Private Declare Sub mouse_event Lib ""user32"" Alias ""mouse_event"" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)" & vbCrLf & _

"Public Function GetXCursorPos() As Long" & vbCrLf & _
"Dim pt As POINTAPI : GetCursorPos pt : GetXCursorPos=pt.X" & vbCrLf & _
"End Function" & vbCrLf & _

"Public Function GetYCursorPos() As Long" & vbCrLf & _
"Dim pt As POINTAPI: GetCursorPos pt : GetYCursorPos=pt.Y" & vbCrLf & _
"End Function"

oModule.CodeModule.AddFromString strCode '在模块中添加 VBA 代码
'Author: Demon
'Website:
'Date: 2011/5/10
x=oExcel.Run("GetXCursorPos") '获取鼠标 X 坐标
y=oExcel.Run("GetYCursorPos") '获取鼠标 Y 坐标

WScript.Echo x, y
oExcel.Run "SetCursorPos", 30, 30 '设置鼠标 X Y 坐标
Const MOUSEEVENTF_MOVE=&H1
Const MOUSEEVENTF_LEFTDOWN=&H2

Const MOUSEEVENTF_LEFTUP=&H4
Const MOUSEEVENTF_RIGHTDOWN=&H8
Const MOUSEEVENTF_RIGHTUP=&H10
Const MOUSEEVENTF_MIDDLEDOWN=&H20
Const MOUSEEVENTF_MIDDLEUP=&H40

Const MOUSEEVENTF_ABSOLUTE=&H8000
'模拟鼠标左键单击
oExcel.Run "mouse_event", MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 0, 0, 0, 0

'模拟鼠标左键双击(即快速的两次单击)
oExcel.Run "mouse_event", MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
oExcel.Run "mouse_event", MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 0, 0, 0, 0

'模拟鼠标右键单击
oExcel.Run "mouse_event", MOUSEEVENTF_RIGHTDOWN + MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
'模拟鼠标中键单击
oExcel.Run "mouse_event", MOUSEEVENTF_MIDDLEDOWN + MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0

'关闭 Excel
oExcel.DisplayAlerts=False
oBook.Close
oExcel.Quit
->


FunctionfDecode(sStringToDecode)
'ThisfunctionwilldecodeaBase64encodedstringandreturnsthedecodedstring.
'Thisbecomesusefullwhenattemptingtohidepasswordsfrompryingeyes.
ConstCharList="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
DimiDataLength,sOutputString,iGroupInitialCharacter
sStringToDecode=Replace(Replace(Replace(sStringToDecode,vbCrLf,""),vbTab,""),"","")
iDataLength=Len(sStringToDecode)
IfiDataLengthMod4<>0Then
fDecode="BadstringpassedtofDecode()function."
ExitFunction
EndIf
ForiGroupInitialCharacter=1ToiDataLengthStep4
DimiDataByteCount,iCharacterCounter,sCharacter,iData,iGroup,sPreliminaryOutString
iDataByteCount=3
iGroup=0
ForiCharacterCounter=0To3
sCharacter=Mid(sStringToDecode,iGroupInitialCharacter+iCharacterCounter,1)
IfsCharacter="="Then
iDataByteCount=iDataByteCount-1
iData=0
Else
iData=InStr(1,CharList,sCharacter,0)-1
IfiData=-1Then
fDecode="BadstringpassedtofDecode()function."
ExitFunction
EndIf
EndIf
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
EndFunction
格式选项中的有效值如表所列


strComputer="."
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_DesktopMonitor",,48)

For Each objItem in colItems
WScript.Echo "ScreenHeight: " & objItem.ScreenHeight
WScript.Echo "ScreenWidth: " & objItem.ScreenWidth
Next
所需的信息都准备完毕,可以建立数据库了(注:下面的""&Chr(34)&""就是一个"""双引号,这样处理后,才能满足语法要求;数据库为20M,则dbSize=512*20)
sql="DISKINITNAME="&Chr(34)&""
&dbName&""&Chr(34)&",PHYSNAME="
&Chr(34)&""&serverpath&""&dbName
&".dat"&Chr(34)&",VDEVNO="&vdevno
&",SIZE="&dbSize&""
Setrs=conn.Execute(sql)'初始化设备
sql="CREATEDATABASE"&dbName&"
on"&dbName&"="&dbSize&""
'注:
第一个dbName是数据库名,
第二个dbName是设备名
Setrs=conn.Execute(sql)'
在设备dbName上建立数据库dbName
MsgBox"数据库""&dbName&""建在服务器上
""&serverpath&""&dbName&".dat",
建立成功

"
endif

iferr<>0then
Wscript.echo"修改失败鼠标模拟器封号例如MciSendString()函数,用来向MCI接口传送MCI指令字符串;又如MciGetErrorString()函数,用来返回MCI错误代码的含义",,"成功"

'vbs代码结束----------------------------------------------

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