-
Notifications
You must be signed in to change notification settings - Fork 64
/
files.ahk
407 lines (364 loc) · 15.1 KB
/
files.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
;GridMove
;By jgpaiva
;date: May 2006
;function: Adjusts windows to a predefined or user-defined desktop grid.
;************************************************************************ini i/o
ReadIni:
IfExist,%A_AppData%/DonationCoder/GridMove/%A_ScriptName%.ini
ScriptDir=%A_AppData%/DonationCoder/GridMove/%A_ScriptName%.ini
else
IfExist,%A_ScriptDir%\%A_ScriptName%.ini
{
filecopy,%A_ScriptDir%\%A_ScriptName%.ini,%A_AppData%/DonationCoder/GridMove/%A_ScriptName%.ini
ScriptDir=%A_AppData%/DonationCoder/GridMove/%A_ScriptName%.ini
}
else
{
ScriptDir=%A_AppData%/DonationCoder/GridMove/%A_ScriptName%.ini
}
IfExist,%ScriptDir%
IniRead,isFirstRun ,%ScriptDir%,IniSettings,IniVersion,false
IniVersion=15
IfExist,%ScriptDir%
{
IniRead,IniVersion ,%ScriptDir%,IniSettings,IniVersion,1
If IniVersion = 0
Iniversion = 1
If IniVersion = 1
{
IniWrite,%GridOrder% ,%ScriptDir%,GridSettings,GridOrder
IniVersion = 2
IniWrite,%IniVersion% ,%ScriptDir%,IniSettings,Iniversion
}
If IniVersion = 2
{
IniWrite,%UseCommand% ,%ScriptDir%,ProgramSettings,UseCommand
IniWrite,%CommandHotkey% ,%ScriptDir%,ProgramSettings,CommandHotkey
IniWrite,%UseFastMove% ,%ScriptDir%,ProgramSettings,UseFastMove
IniWrite,%FastMoveModifiers%,%ScriptDir%,ProgramSettings,FastMoveModifiers
IniVersion = 3
IniWrite, %IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if IniVersion = 3
{
IniWrite,%TitleLeft% ,%ScriptDir%,ProgramSettings,TitleLeft
IniVersion = 4
IniWrite, %IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if IniVersion = 4
{
IniWrite,%ShowNumbersFlag% ,%ScriptDir%,OtherSettings,ShowNumbersFlag
IniVersion = 5
IniWrite,%IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if IniVersion = 5
{
IniWrite,%MButtonTimeout% ,%ScriptDir%,InterfaceSettings,MButtonTimeout
IniWrite,%Transparency% ,%ScriptDir%,InterfaceSettings,Transparency
IniVersion = 6
IniWrite,%IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if IniVersion = 6
{
IniWrite,%FastMoveMeta% ,%ScriptDir%,ProgramSettings,FastMoveMeta
IniVersion = 7
IniWrite,%IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if IniVersion = 7
{
IniWrite,%Exceptions% ,%ScriptDir%,ProgramSettings,Exceptions
IniVersion = 8
IniWrite,%IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if IniVersion = 8
{
IniWrite,%SafeMode% ,%ScriptDir%,ProgramSettings,SafeMode
IniVersion = 9
IniWrite,%IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if IniVersion = 9
{
IniWrite,%SequentialMove% ,%ScriptDir%,ProgramSettings,SequentialMove
IniVersion = 10
IniWrite,%IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if IniVersion = 10
{
IniWrite,%DebugMode% ,%ScriptDir%,ProgramSettings,DebugMode
IniVersion = 11
IniWrite,%IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if IniVersion = 11
{
IniWrite,%GridOrder% ,%ScriptDir%,GridSettings,GridOrder
IniWrite,%GridName% ,%ScriptDir%,GridSettings,GridName
IniVersion = 12
IniWrite,%IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if IniVersion = 12
{
IniWrite,%DisableTitleButtonsDetection%,%ScriptDir%,OtherSettings,DisableTitleButtonsDetection
IniVersion = 13
IniWrite,%IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if Iniversion = 13
{
IniWrite,%ColorTheme% ,%ScriptDir%,OtherSettings,ColorTheme
IniWrite,%Language% ,%ScriptDir%,OtherSettings,Language
IniWrite,%NoTrayIcon% ,%ScriptDir%,InterfaceSettings,NoTrayIcon
IniVersion = 14
IniWrite,%IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
if IniVersion = 14
{
IniWrite,%FirstRun% ,%ScriptDir%, IniSettings,FirstRun
IniVersion = 15
IniWrite,%IniVersion% ,%ScriptDir%, IniSettings,Iniversion
}
IniRead,GridName ,%ScriptDir%,GridSettings ,GridName,Error
IniRead,LButtonDrag ,%ScriptDir%,InterfaceSettings,LButtonDrag,Error
IniRead,MButtonDrag ,%ScriptDir%,InterfaceSettings,MButtonDrag,Error
IniRead,EdgeDrag ,%ScriptDir%,InterfaceSettings,EdgeDrag,Error
IniRead,EdgeTime ,%ScriptDir%,OtherSettings ,EdgeTime,Error
IniRead,ShowGroupsFlag ,%ScriptDir%,OtherSettings ,ShowGroupsFlag,Error
IniRead,ShowNumbersFlag ,%ScriptDir%,OtherSettings ,ShowNumbersFlag,Error
IniRead,TitleSize ,%ScriptDir%,OtherSettings ,TitleSize,Error
IniRead,GridOrder ,%ScriptDir%,GridSettings ,GridOrder,Error
IniRead,UseCommand ,%ScriptDir%,Programsettings ,UseCommand,Error
IniRead,CommandHotkey ,%ScriptDir%,Programsettings ,CommandHotkey,Error
IniRead,UseFastMove ,%ScriptDir%,Programsettings ,UseFastMove,Error
IniRead,FastMoveModifiers,%ScriptDir%,Programsettings ,FastMoveModifiers,Error
IniRead,FastMoveMeta ,%ScriptDir%,Programsettings ,FastMoveMeta,Error
IniRead,TitleLeft ,%ScriptDir%,ProgramSettings ,TitleLeft,Error
IniRead,MButtonTimeout ,%ScriptDir%,InterfaceSettings,MButtonTimeout,Error
IniRead,Transparency ,%ScriptDir%,InterfaceSettings,Transparency,Error
IniRead,Exceptions ,%ScriptDir%,ProgramSettings ,Exceptions,Error
IniRead,SafeMode ,%ScriptDir%,ProgramSettings ,SafeMode,Error
IniRead,SequentialMove ,%ScriptDir%,ProgramSettings ,SequentialMove,Error
IniRead,DebugMode ,%ScriptDir%,ProgramSettings ,DebugMode,Error
IniRead,DisableTitleButtonsDetection,%ScriptDir%,OtherSettings,DisableTitleButtonsDetection,Error
IniRead,ColorTheme ,%ScriptDir%,OtherSettings ,ColorTheme,Error
IniRead,Language ,%ScriptDir%,OtherSettings ,Language,Error
IniRead,Registered ,%ScriptDir%,OtherSettings ,Registered,Error
IniRead,NoTrayIcon ,%ScriptDir%,InterfaceSettings,NoTrayIcon,Error
IniRead,FirstRun ,%ScriptDir%,IniSettings ,FirstRun,Error
If(Registered = "Error")
Registered =
If (GridName = "Error" OR LButtonDrag = "Error" OR MButtonDrag = "Error"
OR EdgeDrag = "Error" OR EdgeTime = "Error" OR ShowGroupsFlag = "Error"
OR TitleSize = "Error" OR ShowGroupsFlag = "Error" OR ShowNumbersFlag = "Error"
OR TitleSize = "Error" OR GridOrder = "Error" OR UseCommand = "Error"
OR CommandHotkey = "Error" OR UseFastMove = "Error" OR FastMoveModifiers = "Error"
OR FastMoveMeta = "Error" OR TitleLeft = "Error" OR MButtonTimeout = "Error"
OR Transparency = "Error" OR Exceptions = "Error" OR SafeMode = "Error"
OR SequentialMove = "Error" OR DebugMode = "Error" OR NoTrayIcon = "Error"
OR FirstRun = "ERROR"
OR DisableTitleButtonsDetection = "Error")
{
MsgBox,%error_inifile%
FileDelete,%ScriptDir%
Reload
sleep 20000
}
If(FirstRun){
GoSub,firstRun
}
}
else
{
gosub,firstRun
}
return
firstRun:
FirstRun:=false
GoSub,setlanguage
GoSub,AboutHelp
GoSub,WriteIni
msgbox,64,%info_firstrun_title%,%info_firstrun%
settimer, helper,100
WriteIni:
IfNotExist,%ScriptDir%
{
FileCreateDir,%A_AppData%/DonationCoder/
if(ErrorLevel <> 0)
{
ScriptDir=%A_ScriptDir%\%A_ScriptName%.ini
}
else
FileCreateDir,%A_AppData%/DonationCoder/GridMove/
if(ErrorLevel <> 0)
{
ScriptDir=%A_ScriptDir%\%A_ScriptName%.ini
}
FileAppend, ,%ScriptDir%
}
IniWrite,%GridName% ,%ScriptDir%,GridSettings ,GridName
IniWrite,%LButtonDrag% ,%ScriptDir%,InterfaceSettings,LButtonDrag
IniWrite,%MButtonDrag% ,%ScriptDir%,InterfaceSettings,MButtonDrag
IniWrite,%EdgeDrag% ,%ScriptDir%,InterfaceSettings,EdgeDrag
IniWrite,%EdgeTime% ,%ScriptDir%,OtherSettings ,EdgeTime
IniWrite,%ShowGroupsFlag% ,%ScriptDir%,OtherSettings ,ShowGroupsFlag
IniWrite,%ShowNumbersFlag% ,%ScriptDir%,OtherSettings ,ShowNumbersFlag
IniWrite,%TitleSize% ,%ScriptDir%,OtherSettings ,TitleSize
IniWrite,%GridOrder% ,%ScriptDir%,GridSettings ,GridOrder
IniWrite,%UseCommand% ,%ScriptDir%,ProgramSettings ,UseCommand
IniWrite,%CommandHotkey% ,%ScriptDir%,ProgramSettings ,CommandHotkey
IniWrite,%UseFastMove% ,%ScriptDir%,ProgramSettings ,UseFastMove
IniWrite,%FastMoveModifiers%,%ScriptDir%,ProgramSettings ,FastMoveModifiers
IniWrite,%FastMoveMeta% ,%ScriptDir%,ProgramSettings ,FastMoveMeta
IniWrite,%SafeMode% ,%ScriptDir%,ProgramSettings ,SafeMode
IniWrite,%TitleLeft% ,%ScriptDir%,ProgramSettings ,TitleLeft
IniWrite,%MButtonTimeout% ,%ScriptDir%,InterfaceSettings,MButtonTimeout
IniWrite,%Transparency% ,%ScriptDir%,InterfaceSettings,Transparency
IniWrite,%Exceptions% ,%ScriptDir%,ProgramSettings,Exceptions
IniWrite,%SequentialMove% ,%ScriptDir%,ProgramSettings,SequentialMove
IniWrite,%DebugMode% ,%ScriptDir%,ProgramSettings,DebugMode
IniWrite,%DisableTitleButtonsDetection%,%ScriptDir%,OtherSettings,DisableTitleButtonsDetection
IniWrite,%ColorTheme% ,%ScriptDir%,OtherSettings ,ColorTheme
IniWrite,%IniVersion% ,%ScriptDir%,IniSettings ,iniversion
IniWrite,%Language% ,%ScriptDir%,OtherSettings ,Language
IniWrite,%NoTrayIcon% ,%ScriptDir%,InterfaceSettings,NoTrayIcon
IniWrite,%FirstRun% ,%ScriptDir%,IniSettings ,FirstRun
Return
;***************************************************************About / help GUI
AboutHelp:
if mutex
return
mutex:=true
gui, 3: Add, Tab, x6 y5 w440 h420, About|Help
;**************About
gui, 3: Tab, 1
IfExist %A_ScriptDir%\gridmove.ico
gui, 3:Add , Picture, x15 y35,%A_ScriptDir%\gridmove.ico
else
IfExist %A_ScriptDir%\gridmove.exe
gui, 3:Add , Picture, x15 y35,%A_ScriptDir%\gridmove.exe
gui, 3:Font,Bold s10
if(Registered="quebec")
gui, 3:Add ,Text,x70 y45,GridMove V%ScriptVersion% by João Paiva`n
else
gui, 3:Add ,Text,x70 y45,GridMove V%ScriptVersion% by jgpaiva`n
gui, 3:Font,
gui, 3:Font, s10
gui, 3:Add ,Text,x15 y95 w420 ,%About_Main%
gui, 3:Add ,Text,X15 Y220,%About_Suggest%
gui, 3:Font,CBlue Underline
gui, 3:Add ,Text,X15 Y255 GPost,http://www.donationcoder.com/Forums/bb/index.php?topic=3824
gui, 3:Font
gui, 3:Font, s10
gui, 3:Add ,Text, y280 X15,`n%About_visit%
gui, 3:Font,CBlue Underline s10
gui, 3:Add ,Text, y313 X15 GMainSite,http://www.donationcoder.com/
gui, 3:Font
if(Registered="quebec"){
IfExist,%A_SCRIPTDIR%/Images/CLP_LOGO.png
Gui, 3:Add ,Picture, Y290 X235,%A_SCRIPTDIR%/Images/CLP_LOGO.png
}else{
ifexist,%a_scriptdir%/images/cody.png
gui, 3:add ,picture, y290 x280,%a_scriptdir%/images/cody.png
}
if(Registered<>"quebec")
gui, 3:Add ,Button,y350 x15 gdonateAuthor w116 h30,Donate
if(Registered="quebec"){
gui, 3:Font, s10
gui, 3:add, Text,y380 x15 h10,%about_license_quebec%
}else{
gui, 3:Font, s9
gui, 3:Add ,Text,y400 x15 h10,If you like this program please make a donation to help further development.
}
gui, 3:Font, s9
;**************HELP
gui, 3:Tab, 2
gui, 3:Font,
Gui, 3:Add, Edit, w413 R29 vMyEdit ReadOnly
if(Language = "FR"){
IfExist, %A_ScriptDir%\GridMoveHelp_FR.txt
FileRead, FileContents,%A_ScriptDir%\GridMoveHelp_FR.txt
}else{
IfExist, %A_ScriptDir%\GridMoveHelp_EN.txt
FileRead, FileContents,%A_ScriptDir%\GridMoveHelp_EN.txt
}
GuiControl,3:, MyEdit, %FileContents%
;gui, 3:default
;gui, tab,3
;
;gui, add, groupbox, ,How to activate GridMove
;
;Gui, add, checkbox, ,By dragging a window by its title
;Gui, add, checkbox, ,By dragging a window while pressing middle mouse button
;Gui, add, checkbox, ,By dragging a window to the edge of the screen
;**************General + complementary functions
gui, 3:tab
if(Registered="quebec")
Gui, 3:show,,GridMove V%ScriptVersion% by João Paiva
else
Gui, 3:show,,GridMove V%ScriptVersion% by jgpaiva
return
Post:
Run,http://www.donationcoder.com/Forums/bb/index.php?topic=3824
GoSub,3GuiCLOSE
return
MainSite:
Run,http://www.donationcoder.com/
GoSub,3Guiclose
return
DonateSite:
Run,http://www.donationcoder.com/Donate/index.html
GoSub,3Guiclose
return
DonateAuthor:
Run,https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=jgpaiva`%40gmail`%2ecom&item_name`=donate`%20to`%20jgpaiva&item_number`=donationcoder`%2ecom&no_shipping=1&cn=Please`%20drop`%20me`%20a`%20line`%20`%3aD&tax`=0¤cy_code=EUR&bn=PP`%2dDonationsBF&charset=UTF`%2d8
GoSub,3Guiclose
return
3GuiEscape:
3GuiClose:
buttonok:
gui,3:destroy
mutex:=false
return
;*********************************************************************Templates
Template-3part:
Menu,Templates,DeleteAll
CreateTemplatesMenu()
SysGet, MonitorCount, MonitorCount
Count := 0
loop, %MonitorCount%
{
SysGet, Monitor, MonitorWorkArea,%A_index%
MonitorWidth := MonitorRight - MonitorLeft
MonitorHeight := MonitorBottom - MonitorTop
Count+=1
%Count%TriggerTop := MonitorTop
%Count%TriggerRight := MonitorRight
%Count%TriggerBottom := MonitorBottom
%Count%TriggerLeft := MonitorLeft + Round(MonitorWidth / 3)
%Count%GridTop := %Count%TriggerTop
%Count%GridRight := %Count%TriggerRight
%Count%GridBottom := %Count%TriggerBottom
%Count%GridLeft := %Count%TriggerLeft
Count+=1
%Count%TriggerTop := MonitorTop
%Count%TriggerRight := MonitorLeft + Round(MonitorWidth / 3)
%Count%TriggerBottom := MonitorTop + Round(MonitorHeight / 2)
%Count%TriggerLeft := MonitorLeft
%Count%GridTop := %Count%TriggerTop
%Count%GridRight := %Count%TriggerRight
%Count%GridBottom := %Count%TriggerBottom
%Count%GridLeft := %Count%TriggerLeft
Count+=1
temp := count - 1
%Count%TriggerTop := %Temp%TriggerBottom +0.01
%Count%TriggerRight := MonitorLeft + Round(MonitorWidth / 3)
%Count%TriggerBottom := MonitorBottom
%Count%TriggerLeft := MonitorLeft
%Count%GridTop := %Count%TriggerTop
%Count%GridRight := %Count%TriggerRight
%Count%GridBottom := %Count%TriggerBottom
%Count%GridLeft := %Count%TriggerLeft
}
NGroups := MonitorCount * 3
Gui,Destroy
GoSub, CreateGroups
GridName = 3Part
GoSub, WriteIni
return