该工具源于本人在超星上看一本电子书的时候想下载到本地观看,最后发现只能一张张图片另存到本地最后再组织成PDF文件,于是有了这个小工具,用于代替手工操作另存为的过程。
具体使用方法下载之后查看option.txt文件。该工具功能非常简单。
下载地址:http://dl.dbank.com/c02h6g1u92
![ContractedBlock.gif](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1
Public
Sub
DownLoadPicture()
2 Dim LoopTimes As Integer
3 Dim SaveAs As SaveAsFormWnd
4 Dim SaveFileName As String
5
6 If IsStop Then IsStop = False : Exit Sub
7
8 Page = Page + 1
9 With SaveAs
10 Do While .FormWnd = 0
11 LoopTimes = LoopTimes + 1
12 If LoopTimes > 20 Then LoopTimes = 0 : Exit Do
13 If IsStop Then IsStop = False : Exit Do : Exit Sub
14 Call SetCursorPos(OD.x, OD.y) ' 移动鼠标
15 Call mouse_event(MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTUP, 0 , 0 , 0 , 0 ) ' 点击鼠标右键
16 Call Delay( 1 )
17 If OD.key = " S " Then
18 Call MyKeyDown(VK_S)
19 Else
20 Call MyKeyDown(VK_V)
21 End If
22 Call Delay( 10 )
23 .FormWnd = FindWindow(vbNullString, OD.title) ' 根据标题查找窗口
24 Call Delay( 10 )
25 Loop
26 Do While .FileNameBox = 0
27 LoopTimes = LoopTimes + 1
28 If LoopTimes > 10 Then LoopTimes = 0 : Exit Do
29 If IsStop Then IsStop = False : Exit Do : Exit Sub
30 .FileNameBox = FindWindowEx(.FormWnd, 0 , " ComboBoxEx32 " , vbNullString)
31 Call Delay( 10 )
32 Loop
33 If Page = 1 Then
34 If Dir(App.Path & " \PIC " ) = "" Then MkDir (App.Path & " \PIC " )
35 SaveFileName = App.Path & " \PIC\ " & Page
36 Else
37 SaveFileName = CStr (Page)
38 End If
39 Call SendMessage(.FileNameBox, WM_SETFOCUS, 0 , 0 )
40 Call SendMessage(.FileNameBox, WM_SETTEXT, 0 , ByVal SaveFileName)
41 Call Delay( 5 )
42
43 Do While .SaveButton = 0
44 LoopTimes = LoopTimes + 1
45 If LoopTimes > 10 Then LoopTimes = 0 : Exit Do
46 If IsStop Then IsStop = False : Exit Do : Exit Sub
47 .SaveButton = FindWindowEx(.FormWnd, 0 , vbNullString, " 保存(&S) " )
48 Call Delay( 10 )
49 Loop
50 Call SendMessage(.SaveButton, WM_CLICK, 0 , 0 )
51 Call Delay( 10 )
52 End With
53
54 If Page = OD.pCount Then
55 MsgBox " 全部下载结束! "
56 Exit Sub
57 Else
58 Call mouse_event(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0 , 0 , 0 , 0 ) ' 点击鼠标左键
59 Call Delay( 20 )
60 Call DownLoadPicture
61 End If
62 End Sub
2 Dim LoopTimes As Integer
3 Dim SaveAs As SaveAsFormWnd
4 Dim SaveFileName As String
5
6 If IsStop Then IsStop = False : Exit Sub
7
8 Page = Page + 1
9 With SaveAs
10 Do While .FormWnd = 0
11 LoopTimes = LoopTimes + 1
12 If LoopTimes > 20 Then LoopTimes = 0 : Exit Do
13 If IsStop Then IsStop = False : Exit Do : Exit Sub
14 Call SetCursorPos(OD.x, OD.y) ' 移动鼠标
15 Call mouse_event(MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTUP, 0 , 0 , 0 , 0 ) ' 点击鼠标右键
16 Call Delay( 1 )
17 If OD.key = " S " Then
18 Call MyKeyDown(VK_S)
19 Else
20 Call MyKeyDown(VK_V)
21 End If
22 Call Delay( 10 )
23 .FormWnd = FindWindow(vbNullString, OD.title) ' 根据标题查找窗口
24 Call Delay( 10 )
25 Loop
26 Do While .FileNameBox = 0
27 LoopTimes = LoopTimes + 1
28 If LoopTimes > 10 Then LoopTimes = 0 : Exit Do
29 If IsStop Then IsStop = False : Exit Do : Exit Sub
30 .FileNameBox = FindWindowEx(.FormWnd, 0 , " ComboBoxEx32 " , vbNullString)
31 Call Delay( 10 )
32 Loop
33 If Page = 1 Then
34 If Dir(App.Path & " \PIC " ) = "" Then MkDir (App.Path & " \PIC " )
35 SaveFileName = App.Path & " \PIC\ " & Page
36 Else
37 SaveFileName = CStr (Page)
38 End If
39 Call SendMessage(.FileNameBox, WM_SETFOCUS, 0 , 0 )
40 Call SendMessage(.FileNameBox, WM_SETTEXT, 0 , ByVal SaveFileName)
41 Call Delay( 5 )
42
43 Do While .SaveButton = 0
44 LoopTimes = LoopTimes + 1
45 If LoopTimes > 10 Then LoopTimes = 0 : Exit Do
46 If IsStop Then IsStop = False : Exit Do : Exit Sub
47 .SaveButton = FindWindowEx(.FormWnd, 0 , vbNullString, " 保存(&S) " )
48 Call Delay( 10 )
49 Loop
50 Call SendMessage(.SaveButton, WM_CLICK, 0 , 0 )
51 Call Delay( 10 )
52 End With
53
54 If Page = OD.pCount Then
55 MsgBox " 全部下载结束! "
56 Exit Sub
57 Else
58 Call mouse_event(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0 , 0 , 0 , 0 ) ' 点击鼠标左键
59 Call Delay( 20 )
60 Call DownLoadPicture
61 End If
62 End Sub