-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGetNirSoft.ahk
152 lines (119 loc) · 3.58 KB
/
GetNirSoft.ahk
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#NoEnv
SetWorkingDir %A_ScriptDir%
#SingleInstance, Force
ViewMode := "Report"
Gui, Font, s9 q5, Segoe UI
Gui, Add, Button, x10 y10 Default Center h30 gGetNirUtilsList vGetButton, Download List of NirSoft Utilities
Gui, Add, Button, x200 y10 Center h30 gChangeViewMode, View Mode
Gui, Add, Button, x495 y10 Center h30 gDownload, Download Selected
Gui, Add, ListView, x10 y50 h450 w600 Checked vNirListView, |Name |Version |Last Updated
Gui, Show, , GetNirSoft
Return
GetNirUtilsList:
GuiControl, , GetButton, Please Wait...
TimeStamp := A_Now
URLDownLoadToFile, http://nirsoft.net/panel/, getnirsoft_panel_%TimeStamp%.tmp
FileRead, NirPanelData, getnirsoft_panel_%TimeStamp%.tmp
FileDelete, getnirsoft_panel_%TimeStamp%.tmp
If Not RegexMatch(NirPanelData, "NirSoft\sUtilities\sPanel")
{
MsgBox, Error getting NirSoft utilities list. `nMaybe you are not connected to the internet?
GuiControl, , GetButton, Download List of Nirstoft Utilities
Return
}
LV_Delete()
SILID := IL_Create(1, 1, 0)
LILID := IL_Create(1, 1, 1)
LV_SetImageList(SILID)
IcoNumber = 0
Loop
{
If RegexMatch(NirPanelData, "iU)<area\shref")
{
RegExMatch(NirPanelData, "siU)<area\shref=.(.*)\.exe.\salt=.(.*)\sv(\d*\.\d*).\sLast\sUpdated\sOn\s(\d+/\d+/\d+).\stitle", NirAppVar)
NirPanelData := RegExReplace(NirPanelData, "siU)<area\shref", "", "", 1)
IcoNumber++
IconFile := "images\" . NirAppVar1 . ".png"
ExeFile%IcoNumber% := NirAppVar1 . ".exe"
IfExist, %IconFile%
{
IL_Add(SILID, IconFile, 0xF8F8F8, 1)
IL_Add(LILID, IconFile, 0xF8F8F8, 1)
LV_Add("Icon" . IcoNumber, "", NirAppVar2, NirAppVar3, ConvDate(NirAppVar4))
}
IfNotExist, %IconFile%
{
IfExist, extend.ini
{
;IniRead,
IconFile := ""
IL_Add(SILID, IconFile, 1, 1)
IL_Add(LILID, IconFile, 1, 1)
LV_Add("Icon" . IcoNumber, "", NirAppVar2, NirAppVar3, ConvDate(NirAppVar4))
}
IfNotExist, extend.ini
{
IconFile := "shell32.dll"
IL_Add(SILID, IconFile, 1, 1)
IL_Add(LILID, IconFile, 1, 1)
LV_Add("Icon" . IcoNumber, "", NirAppVar2, NirAppVar3, ConvDate(NirAppVar4))
}
}
}
Else
break
LV_ModifyCol()
}
NirPanelData =
GuiControl, , GetButton, Update List of Nirstoft Utilities
Return
ChangeViewMode:
If ViewMode = Report
{
GuiControl, -List +Icon, NirListView
LV_SetImageList(LILID)
ViewMode := "Icon"
}
Else If ViewMode = Icon
{
GuiControl, -Icon +Report, NirListView
LV_SetImageList(SILID)
ViewMode := "Report"
}
Return
Download:
Gui, Submit, NoHide
Gui, 2:+owner1
Gui, 2:Font, s9 q5, Segoe UI
Gui, 2:Add, Text, , Downloading selected programs...
Gui, 2:Add, Edit, h100 w180 vProgram ReadOnly,
Gui, 2:Show, h155 w200, Download Progress
RowNumber = 0 ; This causes the first loop iteration to start the search at the top of the list.
Loop
{
RowNumber := LV_GetNext(RowNumber, "Checked") ; Resume the search at the row after that found by the previous iteration.
If Not RowNumber ; The above returned zero, so there are no more selected rows.
{
Gui, 2:Add, Text, , All downloads complete!
break
}
File := ExeFile%RowNumber%
GetFile := "http://nirsoft.net/panel/" . File
LV_GetText(GetProgram, RowNumber, 2)
UrlDownloadToFile, %GetFile%, %File%
Program := Program . GetProgram . "... Done.`n"
GuiControl, 2:, Program, %Program%
}
Return
2GuiClose:
Gui, 2:Destroy
Return
GuiClose:
ExitApp
Return
ConvDate(Date) { ;Convert date from DD/MM/YYYY to YYYY-MM-DD format for easy listview sorting.
RegExMatch(Date, "../../(....)", Year)
RegExMatch(Date, "../(..)/....", Month)
RegExMatch(Date, "(..)/../....", Day)
Return, Year1 . "-" . Month1 . "-" . Day1
}