-
Notifications
You must be signed in to change notification settings - Fork 1
/
LaunchQ-v2.5E06.ahk
719 lines (661 loc) · 18.9 KB
/
LaunchQ-v2.5E06.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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
/*
##########################################################
LAUNCHQ - MINIMALIST APPLICATION LAUNCHER
v2.5
##########################################################
Copyright 2013 Avi Aryan
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
;Thanks to Datalife, Ken for their ideas and support
;Thanks to Majniketor for ColorDlg
#NoEnv
#SingleInstance, force
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
Page = http://www.avi-win-tips.blogspot.com/2013/05/launchq.html
version := 2.5 , color := "CB2322" , textcolor := "Black" , transparency := 180
sizey := 500 , sizex := 350
;-------------+
;INITIALIZE |
;-------------+
;1 - Clips, 2- version, 3 - hotkey ,4 - size, 5 - color , 6 - textcolor , 7 -transparemcy
FileReadLine,oldversion,q-settings/settings.ini,2
If !(FileExist("q-settings/settings.ini"))
{
FileCreateDir,Q-settings
FileAppend,13`n%version%`n+Z`n100`n%color%`n%textcolor%`n%transparency%,q-settings/settings.ini ;appending
FileDelete,q-settings/paths.lq
FileDelete,q-settings/names.lq
FileAppend,Notepad`nPaint`nWordpad`nWindows Explorer`nInternet Explorer`nWindows Media Player`nCalculator`nProgram Files`nSystem32 Dir`nMy Documents`nFacebook`nGoogle`nLaunchQ online,Q-settings/names.lq
FileAppend,notepad.exe`nmspaint.exe`nwordpad.exe`nexplorer.exe`niexplore.exe`nwmplayer.exe`ncalc.exe`n%A_programfiles%`n%A_WinDir%\system32`n%A_MyDocuments%`nhttp://www.facebook.com`nhttp://www.google.com`n%Page%,q-settings/paths.lq
Arrange()
}
else if (version > oldversion)
{
Fileatline("q-settings/settings.ini", version, 2) ;version
Fileatline("q-settings/settings.ini", color, 5) ;color
Fileatline("q-settings/settings.ini", textcolor, 6) ;textcolor
Fileatline("q-settings/settings.ini", transparency, 7) ;trans
}
FileReadLine,curhot,q-settings/settings.ini,3
Hotkey,%curhot%,ShowGui,On
;Size
FileReadLine,sizefactor,q-settings/settings.ini,4
sizex := sizefactor / 100 * sizex , sizey := sizefactor / 100 * sizey
;Text Size = sizey / 40 ||| Text Sep = sizey / 20
sizetext := Floor(sizey / 40) , septext := Floor(sizey / 20) , hiettext := Floor(sizey / 11.5) ;ht used in AddtoGUI label
FileReadLine,color,q-settings/settings.ini,5
FileReadLine,textcolor,q-settings/settings.ini,6
FileReadLine,transparency,q-settings/settings.ini,7
;---------+
;GUI |
;---------+
Gui, -Caption +ToolWindow +AlwaysOnTop
Gui, Color,% color
Gui, Font, S14 CBlue bold, Consolas
Gui, Add, Text, x0 y0 w%sizex% h30 +Center gabout, LaunchQ
Gui, Font, S%sizetext% C%textcolor%
AddtoGUI()
Gui, Font, CYellow S12
Gui, Add, Text,% "x0 y" sizey-25 " w" sizex " h" septext " +Center gwebsite", Add Web-Site
;GUI 2 - Add item
Gui, 2: +ToolWindow
Gui, 2:Font, S14 CDefault, Consolas
Gui, 2:Add, Text, x2 y10 w210 h20 , Shortcut Name
Gui, 2:Font, S12 CDefault, Consolas
Gui, 2:Add, Edit, x282 y10 w180 h22 vsname gsnamechange,
Gui, 2:Font, S14 CDefault, Consolas
Gui, 2:Add, Text, x2 y60 w130 h20 , Shortcut(s)
Gui, 2:Font, S8 CDefault, Consolas
Gui, 2:Add, Edit, x2 y80 w470 h70 vshorts +ReadOnly,
Gui, 2:Font, S12 CDefault, Consolas
Gui, 2:Add, Button, x2 y160 w160 h20 vproceed, Proceed
Gui, 2:Add, Button, x352 y160 w110 h20 , Cancel
Gui, 2:Font, S10 CBlue Italic, Consolas
Gui, 2:Add, Text, x2 y30 w210 h20 vavlblty,
;GUI 3 - About
Gui, 3:Font, S16 CRed, Consolas
Gui, 3:Color, 0xefe6a3
Gui, 3:Add, Text, x2 y0 w590 h30 +Center gpage, LaunchQ v%version% : by Avi Aryan
Gui, 3:Font, S14 CBlue, Consolas
Gui, 3:Add, Text, x2 y30 w590 h20 +Center gblog, More Tools
Gui, 3:Font, S14 CGreen, Consolas
Gui, 3:Add, Text, x2 y70 w220 h20 , Main Shortcut
Gui, 3:Add, Text, x2 y110 w220 h20 , Size
Gui, 3:Add, Text, xp+0 yp+40 w220 h20 , Background Color
Gui, 3:Add, Text, xp+0 yp+40 w220 h20 , Text Color
Gui, 3:Add, Text, xp+0 yp+40 w220 h20 , Transparency
Gui, 3:Add, Text, xp+0 yp+40 w590 h20 +Center gupdate, Check for Updates ;290
Gui, 3:Font, S12 CBlack, Consolas
Gui, 3:Add, Hotkey, x342 y70 w170 h25 ghotkeychange vhotkey,
Gui, 3:Add, Edit, x342 y110 w170 h25 gsize vsizefactor, %sizefactor%
Gui, 3:Add, Text, xp+0 yp+40 w170 h25 gbackcolor c%color%, Click to Select
Gui, 3:Add, Text, xp+0 yp+40 w170 h25 gtxtcolor c%textcolor%, Click to Select
Gui, 3:Add, slider, xp-5 yp+40 w170 h25 gtrans vtransparency cBlack Range1-255, %transparency%
Gui, 3:Add, edit, x1000 y1000 w1 h1 vtofool,
;-------+
;TRAY |
;-------+
Menu, Tray, NoStandard
Menu, Tray, Icon, %A_ScriptDir%\tool-icon-8075-Windows.ico
Menu, Tray, Tip, LaunchQ by Avi Aryan
Menu, Tray, Add, Show GUI, ShowGUI ; Add this line
Menu, Tray, Add,
Menu, Tray, Add, Show GUIm, ShowGUIm ; Add this line
Menu, Tray, Add,
Menu, Tray, Add, LaunchQ, about
Menu, Tray, Add,
Menu, Tray, Add, Online Help, help
Menu, Tray, Add, Run at Startup, startup
Menu, Tray, Add
Menu, Tray, Add, Quit, quit
Menu, Tray, Default, Show GUIm ; Set "Show GUI" as the default double-click action
;Menu, Tray, Default, LaunchQ
;OTHERS
IfExist,%a_startup%/LaunchQ.lnk
{
FileDelete,%a_startup%/LaunchQ.lnk
FileCreateShortcut,%A_ScriptFullPath%,%A_Startup%/LaunchQ.lnk
Menu,Tray,Check,Run At Startup
}
global ontop
ontop := 1
EmptyMem()
return
;###############################################################################
;END OF AUTO-EXCEUTE : FUNCS AND SUBS
;###############################################################################
Scroll(y, x, sizex, sizey){
IfInString,y,-
{
ToolTip
IfNotEqual,ontop,1
{
StringTrimLeft,y,y,1
y := sizey - 200 - y ;500 - 200 in older versions of Lq
IfLess,y,20
y := 20
ontop-=1
loop,10
{
FileReadLine,pname,Q-settings/names.lq,% (ontop + A_index - 1)
GuiControl,,item%a_index%,%pname%
}
sleep, %y%
}
}
;End of Up scroll
else IfGreater,y,%sizey%
{
ToolTip
FileReadLine,index,q-settings/settings.ini,1
IfLess,ontop,% (index - 9)
{
y := sizey + 300 - y ;500 + 300 in default
if instr(y, "-")
y := 20
ontop+=1
loop,10
{
FileReadLine,pname,Q-settings/names.lq,% (ontop + A_index - 1)
GuiControl,,item%a_index%,%pname%
}
sleep, %y%
}
}
;End of down scroll
else
{
IfLess,x,%sizex%
if !(Instr(x, "-"))
{
MouseGetPos,,,,classnn
StringTrimLeft,classnn,classnn,6 ;Staticx where x from 2 to 11
If (classnn > 1 and 12 > classnn) ;so that te required 10 show up
{
FileReadLine,path,q-settings/paths.lq,% (ontop - 1 + classnn - 1)
StringReplace,path,path,|,`n,All
Tooltip, %path%
}
else if classnn = 1
Tooltip, LaunchQ - Click to open Settings
else if classnn = 12
ToolTip, Add web link to LaunchQ
else
ToolTip
}
;Mouseget
}
;Show Mouse Data
}
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AddtoGUI(){
global
FileReadLine,pname,Q-settings/names.lq,1
Gui, Add, Text, x10 y50 w%sizey% h%septext% vitem1 glaunch,%pname%
loop,9
{
FileReadLine,pname,Q-settings/names.lq,% (A_index + 1)
if Errorlevel = 1
pname =
item := "item" . (A_Index + 1)
Gui, Add, Text, xp+0 yp+%hiettext% w%sizey% h%septext% glaunch v%item%,%pname%
}
}
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
UpdateGUI(){
ontop := 0
loop, 10
GuiControl,1:,item%a_index%
;;Blanking
loop, 10
{
FileReadLine,pname,Q-settings/names.lq,% (A_index)
if Errorlevel = 1
break
GuiControl,1:,item%a_index%,%pname%
ontop := 1
}
EmptyMem()
}
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Deleter(sizex, sizey){
BlockInput, MouseMove
MouseGetPos,,,Hwnd
WinGetTitle, title, ahk_id %Hwnd%
if (Winactive("LaunchQ ahk_class AutoHotkeyGUI") AND title == "LaunchQ")
{
MouseGetPos,,,,classnn
BlockInput,MouseMoveOff
KeyWait,Lbutton
MouseGetPos,fx,fy
if (fx < 0 or fx > sizex or fy < 0 or fy > sizey)
{
If (classnn != "")
{
StringTrimLeft,classnn,classnn,6 ;Staticx where x from 2 to 11
FileReadLine,name,q-settings/names.lq,% (ontop - 1 + classnn - 1)
Tooltip, %name% Deleted !
RemoveApp(ontop - 1 + classnn - 1)
UpdateGUI()
Sleep, 1000
ToolTip
}
}
else{
Send, {Lbutton Down}
KeyWait, Lbutton
Send, {Lbutton Up}
}
}
else{
;Out of window click event
BlockInput, MouseMoveOff
Send, {Lbutton Down}
KeyWait, Lbutton
Send, {Lbutton Up}
DisableGUI()
}
}
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
GuiDropFiles:
ToolTip
if (ontop)
ontop := 1
loop,parse,A_guievent,`n
{
IfInString,a_loopfield,.lnk
{
FileGetShortcut,%A_LoopField%,file
allfile .= file . "|"
}
else
allfile .= A_LoopField . "|"
if A_index = 1
tempshortname := Substr(A_loopfield, Instr(A_LoopField,"\",false,0) + 1)
}
StringTrimRight,allfile,allfile,1
Gui, 1:Hide
;;
StringReplace,allfilex,allfile,|,`n,All
GuiControl,2:,shorts,%allfilex%
allfilex =
;;
Gui, 2:Show, w480 h191, Choose a Name
SetTimer,mousecheck,Off
GuiControl,2:Disable,proceed
GuiControl,2:,sname,%tempshortname%
gosub, snamechange
return
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
launch:
DisableGUI()
Stringtrimleft,linetolaunch,A_guicontrol,4
FileReadLine,path,q-settings/paths.lq,% (linetolaunch + ontop - 1)
loop,parse,path,|
{
; Check if the path is a hotkey trigger command
if (substr(A_LoopField, 1, 6) = "Send, ")
{
Send, % substr(A_LoopField, 7)
}
else
{
try{
If (Instr(A_LoopField,"http://") or Instr(A_LoopField,"https://") or Instr(A_loopfield,"ftp://"))
BrowserRun(A_LoopField)
else
run, %A_loopfield%
}catch{
MsgBox, 16, WARNING, The path`n%A_loopfield%`nis invalid . Please re-check the path or re-add the shortcut.
}
}
}
EmptyMem()
return
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2buttonproceed:
Gui, 2:submit, hide
FileReadLine,index,q-settings/settings.ini,1
strength := index + 1
FileAtline("q-settings/settings.ini", strength, 1)
if (index != "0")
sname := "`n" sname , allfile := "`n" allfile
FileAppend,%sname%,q-settings/names.lq
FileAppend,%allfile%,q-settings/paths.lq
Arrange()
UpdateGUI()
file := "" , strength := "" , index := "" , allfile := "" , sname := ""
gosub, ShowGUI
return
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
snamechange:
Gui, 2:submit, nohide
GuiControl,2:,avlblty,Available
GuiControl,2:Enable,proceed
loop,read,q-settings/names.lq
{
IfEqual,A_loopreadline,%sname%
{
GuiControl,2:,avlblty,Unavailable
GuiControl,2:Disable,proceed
break
}
}
return
;#############################################################
;OTHER IMPORTNANT FUNCS AND SUBS
;#############################################################
ShowGUI:
IfWinNotExist, LaunchQ ahk_class AutoHotkeyGUI
{
CoordMode,Mouse,Screen
MouseGetPos,xax,yax
if (xax > (A_screenwidth - (0.5 * sizex)))
xax := A_ScreenWidth - sizex
else if ( (sizex / 2) > xax )
xax := 0
else xax := xax - (sizex / 2)
if ((0.5 * sizey) > yax)
yax := 10 ;to enable scrolling up
else if (yax > (A_ScreenHeight - (0.5 * sizey)))
yax := A_ScreenHeight - sizey
else yax := yax - (sizey / 2)
Coordmode,Mouse,Window
Gui, 1:Show, x%xax% y%yax% w%sizex% h%sizey%, LaunchQ
WinSet, Region, 0-0 W%sizex% H%sizey% R40-40, LaunchQ ahk_class AutoHotkeyGUI
Winset, Transparent, %transparency%, LaunchQ ahk_class AutoHotkeyGUI
WinActivate,LaunchQ
SetTimer,Mousecheck,100
Hotkey,$Lbutton,LeftMouse,On
}
else
DisableGUI()
return
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ShowGUIm:
IfWinNotExist, LaunchQ ahk_class AutoHotkeyGUI
{
; Calculate the center of the screen
xax := (A_ScreenWidth / 2) - (sizex / 2)
yax := (A_ScreenHeight / 2) - (sizey / 2)
Gui, 1:Show, x%xax% y%yax% w%sizex% h%sizey%, LaunchQ
WinSet, Region, 0-0 W%sizex% H%sizey% R40-40, LaunchQ ahk_class AutoHotkeyGUI
Winset, Transparent, %transparency%, LaunchQ ahk_class AutoHotkeyGUI
WinActivate,LaunchQ
SetTimer,Mousecheck,100
Hotkey,$Lbutton,LeftMouse,On
}
else
DisableGUI()
return
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DisableGUI(){
Gui, 1:Hide
Tooltip
SetTimer,Mousecheck,Off
Hotkey,$Lbutton,LeftMouse,Off
EmptyMem()
}
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2GuiDropFiles:
Gui,2:submit,nohide
GuiControl,2:,shorts,% shorts . "`n" . A_GuiEvent
StringReplace,shorts,A_GuiEvent,`n,|,All
allfile .= "|" . shorts
return
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
website:
DisableGUI()
InputBox,allfile,URL,Write here the URL of the web-link,,300,200,,,,,https://www.avi-win-tips.blogspot.in
If Errorlevel = 0
If (allfile != "")
{
If !(Instr(allfile, "http://") or InStr(allfile, "https://") or InStr(allfile, "ftp://"))
allfile := "http://" . allfile
if (ontop)
ontop := 1
GuiControl,2:,shorts,%allfile%
Gui, 2:Show, w480 h191, Choose a Name
GuiControl,2:Disable,proceed
tempshortname := Substr(allfile, Instr(allfile, "//") + 2)
Guicontrol,2:,sname,%tempshortname%
gosub, snamechange
}
return
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Arrange(){
FileRead,paths,q-settings/paths.lq
FileRead,names,q-settings/names.lq
StringReplace,names,names,`r`n,`n,All
Sort, names
loop, parse, names, `n
{
name := A_LoopField
loop, read, q-settings/names.lq
{
IfEqual,name,%A_loopreadline%
{
FileReadLine,path,q-settings/paths.lq,%a_index%
break
}
}
newpath .= path . "`n"
}
StringTrimRight,newpath,newpath,1
FileDelete,q-settings/paths.lq
FileDelete,q-settings/names.lq
FileAppend,%names%,q-settings/names.lq
FileAppend,%newpath%,q-settings/paths.lq
EmptyMem()
}
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
RemoveApp(Linenumber){
loop,% (linenumber - 1)
{
FileReadLine,name,q-settings/names.lq,%A_index%
FileReadLine,path,q-settings/paths.lq,%A_Index%
if Errorlevel = 1 ;make firstname and secondname empty. This will only happen when linenumber = 1
break
firstname .= name . "`n"
firstpath .= path . "`n"
}
loop,
{
FileReadLine,name,q-settings/names.lq,% (A_index + Linenumber)
FileReadLine,path,q-settings/paths.lq,% (A_index + Linenumber)
if Errorlevel = 1
break
secondname .= name . "`n"
secondpath .= path . "`n"
}
name := Rtrim(firstname . secondname , "`n")
path := Rtrim(firstpath . secondpath , "`n")
FileDelete,q-settings/paths.lq
FileDelete,q-settings/names.lq
FileAppend,%name%,q-settings/names.lq
FileAppend,%path%,q-settings/paths.lq
;;Ini
FileReadLine,index,q-settings/settings.ini,1
strength := index - 1
FileAtline("q-settings/settings.ini", strength, 1)
}
;#############################################################
;NONE OF BUSINESS (CONSTANT) FUNCTIONS AND SUBS
;#############################################################
MouseCheck:
;Critical
MouseGetPos,x,y
Scroll(y, x, sizex, sizey)
return
LeftMouse:
Deleter(sizex, sizey)
return
3GuiClose:
Reload
return
backcolor:
CmnDlg_Color( color := color )
Fileatline("q-settings/settings.ini", color, 5) ;color
gui, 1:color, %color%
return
txtcolor:
CmnDlg_Color( textcolor := textcolor )
Fileatline("q-settings/settings.ini", textcolor, 6) ;textcolor
Reload
return
trans:
Gui, 3:Submit, nohide
Fileatline("q-settings/settings.ini", transparency, 7) ;trans
return
2guiclose:
2buttoncancel:
Gui, 2:hide
Gui, 1:Show
SetTimer,mousecheck,100
allfile =
GuiControl,2:,sname
return
EmptyMem(){
dllcall("psapi.dll\EmptyWorkingSet", "UInt", -1)
}
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Fileatline(file, what, linenum){
loop
{
FileReadLine,readline,%file%,%A_index%
if Errorlevel = 1
lineended := true , readline := ""
if !(A_index == linenum)
filedata .= readline . "`r`n"
else
filedata .= what . "`r`n"
if (A_index >= linenum)
if (lineended)
break
}
StringTrimRight,filedata,filedata,2
FileDelete, %file%
FileAppend, %filedata%, %file%
}
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
BrowserRun(site){
RegRead, OutputVar, HKEY_CLASSES_ROOT, http\shell\open\command
IfNotEqual, Outputvar
{
StringReplace, OutputVar, OutputVar,"
SplitPath, OutputVar,,OutDir,,OutNameNoExt, OutDrive
run,% OutDir . "\" . OutNameNoExt . ".exe" . " """ . site . """"
}
else
run,% "iexplore.exe" . " """ . site . """" ;internet explorer
}
;###############################################################
;TRAY AND GUI OFF SUBS
;###############################################################
startup:
Menu,Tray,Togglecheck,Run At Startup
IfExist, %a_startup%/LaunchQ.lnk
FileDelete,%a_startup%/LaunchQ.lnk
else
FileCreateShortcut,%A_ScriptFullPath%,%A_Startup%/LaunchQ.lnk
return
about:
DisableGUI()
GuiControl,3:,hotkey,%curhot%
Gui, 3:Show, w595 h310, LaunchQ by Avi
return
help:
BrowserRun("http://www.avi-win-tips.blogspot.com/2013/05/lqguide.html")
return
blog:
BrowserRun("http://avi-win-tips.blogspot.in/p/my-autohotkey.html")
return
page:
BrowserRun(page)
return
hotkeychange:
Gui, 3:Submit, Nohide
IfNotEqual, hotkey
{
Fileatline("q-settings/settings.ini", hotkey, 3)
Hotkey,%curhot%,ShowGUI, Off
Hotkey,%hotkey%,ShowGUI, On
curhot := hotkey
}
return
size:
Gui, 3:Submit, Nohide
If (sizefactor == 0 or sizefactor == "")
sizefactor := 100
Fileatline("q-settings/settings.ini", sizefactor, 4)
return
update:
URLDownloadToFile,https://dl.dropboxusercontent.com/u/116215806/Products/LaunchQ/version.txt,q-settings/latest.txt
FileRead,latest,q-settings/latest.txt
if (latest > version)
MsgBox, 48, Updates Available, Your version %version%`nCurrent version %latest%
else
MsgBox, 64, Hello, No updates available
return
quit:
ExitApp
;###################################################################
#IfWinActive, LaunchQ by Avi
{
!space::
GuiControl,3:,hotkey,!space
gosub, hotkeychange
GuiControl,3:focus,tofool
return
}
#IfWinActive, LaunchQ
{
~WheelDown::Scroll(30+sizey, 0, sizex, sizey)
~WheelUp::Scroll(-30, 0 ,sizex, sizey)
}
#IfWinNotActive, LaunchQ by Avi
{
Hotkey,%curhot%,ShowGUI,On
}
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;Majniketors ColorDlg
CmnDlg_Color(ByRef pColor, hGui=0)
{
;covert from rgb
clr := ((pColor & 0xFF) << 16) + (pColor & 0xFF00) + ((pColor >> 16) & 0xFF)
VarSetCapacity(sCHOOSECOLOR, 0x24, 0)
VarSetCapacity(aChooseColor, 64, 0)
NumPut(0x24, sCHOOSECOLOR, 0) ; DWORD lStructSize
NumPut(hGui, sCHOOSECOLOR, 4) ; HWND hwndOwner (makes dialog "modal").
NumPut(clr, sCHOOSECOLOR, 12) ; clr.rgbResult
NumPut(&aChooseColor,sCHOOSECOLOR, 16) ; COLORREF *lpCustColors
NumPut(0x00000103, sCHOOSECOLOR, 20) ; Flag: CC_ANYCOLOR || CC_RGBINIT
nRC := DllCall("comdlg32\ChooseColorA", str, sCHOOSECOLOR) ; Display the dialog.
if (errorlevel <> 0) || (nRC = 0)
Return false
clr := NumGet(sCHOOSECOLOR, 12)
oldFormat := A_FormatInteger
SetFormat, integer, hex ; Show RGB color extracted below in hex format.
;convert to rgb
pColor := (clr & 0xff00) + ((clr & 0xff0000) >> 16) + ((clr & 0xff) << 16)
StringTrimLeft, pColor, pColor, 2
loop, % 6-strlen(pColor)
pColor=0%pColor%
pColor=0x%pColor%
SetFormat, integer, %oldFormat%
Return true
}
#IfWinActive, LaunchQ
{
Esc::Gui, 1:Hide
}
#If