-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmerge.vba
56 lines (43 loc) · 1.9 KB
/
merge.vba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal wClassName As Any, ByVal wWindowName As String) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hWND As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
Public BM_CLICK
Sub Start()
Dim wd
BM_CLICK = &HF5&
For Each wd In CreateObject("Shell.Application").Windows
'MsgBox wd.LocationName
If InStr(CStr(wd.LocationName), "PestPac") > 0 Then
'MsgBox wd.document.Title + "lol"
'SendKeys "%(s)"
If Not wd.document.getElementsByName("butUpdate")(0) Is Nothing Then
AppActivate wd
SendKeys "%(u)"
Sleep 1000
SendKeys "y"
MsgBox wd.document.Title + "lol"
'AppActivate wd
'SendKeys "y"
'SendKeys "y"
'wd.document.getElementsByName("butUpdate")(0).Click
'MsgBox wd.document.Title + "lol"
Dim hWND As Long, childHWND As Long
While wd.Busy Or wd.readyState <> READYSTATE_COMPLETE
DoEvents
If wd.Busy Then
DoEvents
hWND = FindWindow(vbNullString, "POPPP!!")
If hWND <> 0 Then childHWND = FindWindowEx(hWND, ByVal 0&, "Button", "OK")
If childHWND <> 0 Then SendMessage childHWND, BM_CLICK, 0, 0
MsgBox wd.document.Title + "lol"
End If
Wend
End If
End If
Next wd
End Sub