|
发表于 2013-10-30 17:12:00
|
显示全部楼层
Sub ShutdownExcel
VBSBegin
Set obj = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set List = obj.ExecQuery ("Select * from Win32_Process Where Name = 'EXCEL.EXE'")
For Each objProcess in List
objProcess.Terminate()
Next
VBSEnd
End Sub
Sub OnScriptExit()
ShutdownExcel
End Sub
ShutdownExcel
sIniFile="C:\Users\Administrator\Desktop\Book1.ini"
UserVar iDelay=DropList{"0.5秒":"500"|"1秒":"1000"|"1.5秒":"1500"|"2秒":"2000"|"3秒":"3000"|"5秒":"5000"}=1000 "设置延时"
Set xlApp = CreateObject("Excel.Application")
xlApp.visible = true
Set xlBook = xlApp.Workbooks.Open("C:\Users\Administrator\Desktop\Book1.xls")
Set xlSheet = xlBook.sheets("Sheet1")
nEndLine = xlsheet.UsedRange.SpecialCells(11).Row
nStartLine = InputBox("请输入起始行号:","" , 2)
nEndLine = InputBox("请输入结束行号:", "", xlSheet.UsedRange.SpecialCells(11).Row)
xlApp.Visible = False
Delay 1000
For i = nStartLine To nEndLine
未发现运行环境,请安装微软拼音2.0以上版本!= xlsheet.Range("A" & i).Value
未发现运行环境,请安装微软拼音2.0以上版本!= xlsheet.Range("B" & i).Value
flag = xlsheet.Range("C" & i).Value
If flag <> "ok" Then
Call Plugin.Msg.ShowScrTXT(0, 0, 1024, 768, "第" & i & "行正在处理。", "0000FF")
DoSomeWorks
Call Plugin.Msg.ShowScrTXT(0, 0, 1024, 768, "第" & i & "行已处理。", "0000FF")
xlsheet.Range("C" & i).Value = "ok"
xlsheet.Range("D" & i).Value = now
xlBook.Save
End If
Next
xlApp.Quit
ExitScript
Sub DoSomeWorks
If GetPoint("ssd",sIniFile) Then
LockMouse
//输入位置 [ssd] 的操作
LeftClick 1
Delay 200
SayString 未发现运行环境,请安装微软拼音2.0以上版本!
UnlockMouse
Delay iDelay
End If
If GetPoint("fdfg",sIniFile) Then
LockMouse
//输入位置 [fdfg] 的操作
LeftClick 1
Delay 200
SayString 未发现运行环境,请安装微软拼音2.0以上版本!
UnlockMouse
Delay iDelay
End If
End Sub
Function GetPoint(sPointName,sIniFile)
GetPoint =false
sRegion=Plugin.File.ReadINI(sPointName, "点位置", sIniFile)
If sRegion="" then
MsgBox "设置""" & sPointName & """点位置", vbInformation Or vbSystemModal, "提示"
Delay 500
sTemp = Plugin.QM_GetPoint.GetPoint()
sRegion = sTemp
Plugin.File.WriteINI sPointName, "点位置", sTemp, sIniFile
sArrayRegion = Split(sTemp, "|")
Plugin.File.WriteINI sPointName, "RegionX", sArrayRegion(0), sIniFile
Plugin.File.WriteINI sPointName, "RegionY", sArrayRegion(1), sIniFile
End if
If sRegion<>"" then
x=Cint(Plugin.File.ReadINI(sPointName, "RegionX", sIniFile))
y=Cint(Plugin.File.ReadINI(sPointName, "RegionY", sIniFile))
MoveTo x,y
Delay 100
GetPoint=true
Else
MsgBox "没有设置要找的""" &sPointName & """点位置"
End if
End Function
Function WaitMyPic(sPicName,sIniFile,nDelay)
WaitMyPic=true
wait=0
Do While Not FindMyPic(sPicName, sIniFile )
Wait = Wait + 1
If Wait > 20 Then
WaitMyPic=False
Exit Do
End If
Delay nDelay
Loop
End Function
Function FindMyPic(sPicName, sIniFile)
FindMyPic = False
sPic = Plugin.File.ReadINI(sPicName, "图片", sIniFile)
If sPic = "" Then
MsgBox "设置""" & sPicName & """图片", vbInformation Or vbSystemModal, "提示"
Delay 500
sPic = Plugin.QM_SetFindPic.GetFindPic()
If sPic <> "" Then
Plugin.File.WriteINI sPicName, "图片", sPic, sIniFile
'//图片尺寸
Delay 500
sTemp = Plugin.QM_SetFindPic.GetPicSize(sPic)
sArraySize = Split(sTemp, "|")
Plugin.File.WriteINI sPicName, "PicWidth", sArraySize(0), sIniFile
Plugin.File.WriteINI sPicName, "PicHeight", sArraySize(1), sIniFile
Plugin.File.WriteINI sPicName, "RegionX1", "0", sIniFile
Plugin.File.WriteINI sPicName, "RegionY1", "0", sIniFile
Plugin.File.WriteINI sPicName, "RegionX2","0", sIniFile
Plugin.File.WriteINI sPicName, "RegionY2", "0", sIniFile
End If
End If
If sPic <> "" Then
x1 = CInt(Plugin.File.ReadINI(sPicName, "RegionX1", sIniFile))
y1 = CInt(Plugin.File.ReadINI(sPicName, "RegionY1", sIniFile))
x2 = CInt(Plugin.File.ReadINI(sPicName, "RegionX2", sIniFile))
y2 = CInt(Plugin.File.ReadINI(sPicName, "RegionY2", sIniFile))
If x1 = x2 and y1 = y1 Then
MsgBox "设置""" & sPicName & """图片查找区域", vbInformation Or vbSystemModal, "提示"
'//查找图片的区域
Delay 500
sTemp = Plugin.QM_SetFindPic.GetFindRegion()
If sTemp <> "" Then
sArrayRegion = Split(sTemp, "|")
Plugin.File.WriteINI sPicName, "RegionX1", sArrayRegion(0), sIniFile
Plugin.File.WriteINI sPicName, "RegionY1", sArrayRegion(1), sIniFile
Plugin.File.WriteINI sPicName, "RegionX2", sArrayRegion(2), sIniFile
Plugin.File.WriteINI sPicName, "RegionY2", sArrayRegion(3), sIniFile
x1 = CInt(sArrayRegion(0))
y1 = CInt(sArrayRegion(1))
x2 = CInt(sArrayRegion(2))
y2 = CInt(sArrayRegion(3))
End If
End If
If x1 <> x2 OR y1 <> y2 Then
Width = CInt(Plugin.File.ReadINI(sPicName, "PicWidth", sIniFile))
Height = CInt(Plugin.File.ReadINI(sPicName, "Picheight", sIniFile))
FindPic x1, y1, x2, y2, sPic, 0.9, intX, intY
If intX > 0 And intY > 0 Then
MoveTo intX + Width / 2, intY + Height / 2
Delay 500
FindMyPic = True
End If
Else
MsgBox "没有设置图片的查找区域", vbInformation Or vbSystemModal, "提示"
End If
Else
MsgBox "没有设置要找的""" & sPicName & """图片", vbInformation Or vbSystemModal, "提示"
End If
End Function
|
|