-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
8,928 additions
and
5,885 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
; Link: | ||
; Author: | ||
; Date: | ||
; for: AHK_L | ||
|
||
/* | ||
*/ | ||
|
||
A_DefaultGui(wParam := "") { | ||
; majkinetor : A_DefaultGui() -> www.autohotkey.com/board/topic/24532-function-a-defaultgui/ | ||
; Lexikos : GetDefaultGui() -> www.autohotkey.com/board/topic/84414-ahk-l-get-the-current-default-gui-name/ | ||
|
||
Static Msg := 0 ; has to be 0, otherwise If (wParam = Msg) is true | ||
Static DefaultGui | ||
static first_call := true | ||
|
||
If (wParam = Msg) { ; called by OnMessage | ||
DefaultGui := A_Gui | ||
Return 0 | ||
} | ||
|
||
if(first_call) { | ||
first_call := false | ||
if(OnMessage(msg) != "") ; safety check that the script doesn't already | ||
return, "", ErrorLevel := 1 ; monitor the msg through some other function | ||
try DllCall("User32.dll\RegisterWindowMessage", "Str", "GetDefaultGui", "UInt") | ||
catch | ||
return, "", ErrorLevel := 2 ; and that RegisterWindowMessage worked | ||
} | ||
|
||
LastFoundWindow := WinExist() ; save the Last Found Window, if any | ||
|
||
Gui, +LastFoundExist ; check if the default Gui exists, | ||
If !WinExist() ; if not, it has to be created | ||
;Gui, New, +LastFound +hwndHDESTROY | ||
; sets the new default gui window, we don't want that | ||
; | ||
Gui, +LastFound +hwndHDESTROY | ||
|
||
OnMessage(Msg, A_ThisFunc) ; get the current default Gui | ||
try DllCall("User32.dll\SendMessage", "Ptr", WinExist(), "UInt", Msg, "Ptr", Msg, "Ptr", 0) | ||
catch | ||
return, "", ErrorLevel := 3 | ||
|
||
OnMessage(Msg, "") | ||
|
||
If (HDESTROY) ; if the dummy Gui has been created, destroy it | ||
Gui, %HDESTROY%: Destroy | ||
|
||
If (LastFoundWindow) { ; if the Last Found Window had been set, restore it ... | ||
A_DetectHiddenWindowsOld := A_DetectHiddenWindows | ||
DetectHiddenWindows, On ; precaution: window to be restored can be hidden | ||
WinExist("ahk_id" LastFoundWindow) | ||
DetectHiddenWindows, % A_DetectHiddenWindowsOld | ||
} | ||
Else ; ... otherwise clear it | ||
Gui, %A_ThisFunc%_NonexistentGui: +LastFoundExist | ||
Return DefaultGui, ErrorLevel := 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
; Link: | ||
; Author: | ||
; Date: | ||
; for: AHK_L | ||
|
||
/* | ||
*/ | ||
|
||
|
||
BinToHexSp(ByRef B, NB:=0, ByRef H:="", F:=0x40000004) { ; By SKAN on D36P/D36P @ tiny.cc/bintohexsp | ||
Local BB:=NB ? NB : VarSetCapacity(B), HB:=(BB*(F?3:2))*(A_Isunicode?2:1), X:=VarSetCapacity(H,HB,0) | ||
Return DllCall("Crypt32.dll\CryptBinaryToString", "Ptr",&B,"Int",BB,"Int",F?F:12,"Str",H,"UIntP",HB) | ||
} | ||
|
||
InHex(Haystack, Needle, CS:=0, Pos:=1, Occur:=1) { ; InHex by SKAN on D36P/D36P @ tiny.cc/bintohexsp | ||
Return (ErrorLevel:=InStr(Haystack, Needle, CS, Pos, Occur)) ? ((ErrorLevel+2)//3)-1 : "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
; Link: | ||
; Author: | ||
; Date: | ||
; for: AHK_L | ||
|
||
/* | ||
*/ | ||
|
||
DualMID() { ; v0.90 By SKAN on D36I/D36M @ tiny.cc/dualmid | ||
Local | ||
ClassGuid:="{4d36e96e-e325-11ce-bfc1-08002be10318}", M1:="", M2:="", M3:="" | ||
WMI:=ComObjGet("winmgmts:{impersonationLevel=impersonate}!\\" . A_ComputerName . "\root\cimv2") | ||
For Monitor in WMI.ExecQuery("SELECT * FROM Win32_PnPEntity WHERE ClassGuid='" . ClassGuid . "'") | ||
{ | ||
M:=StrSplit(U:=Monitor.DeviceID, ["\","UID"]), M%A_Index%:=Format("{2:}\{4:}", M*) | ||
RegRead, U, HKLM\SYSTEM\CurrentControlSet\Enum\%U%\Device Parameters, EDID | ||
U%A_Index% := Format("{1:}_{8:}{9:}{6:}{7:}{4:}{5:}{2:}{3:}", M[2], StrSplit(SubStr(U, 25, 8))*) | ||
} | ||
|
||
Loop % ( 2, VarSetCapacity(DD,840,0), NumPut(840,DD,0,"UInt"), D1:="", D2:="" ) | ||
DllCall("EnumDisplayDevicesW", "wStr","\\.\DISPLAY" . A_Index, "Int",0, "Ptr",&DD, "Int",1) | ||
, D:=StrSplit(StrGet(&DD+328,"UTF-16"),["#","UID"]), D%A_Index%:=(D ? Format("{2:}\{4:}",D*) : "") | ||
|
||
R1:="\\.\DISPLAY1", R2:="\\.\DISPLAY2", NUL:="" | ||
Return (M3) ? NUL : (M2="") ? {(U1):(R1)} | ||
: (M2 && D2) ? (M2=D2 ? {(U1):(R1),(U2):(R2)} : {(U2):(R1),(U1):(R2)}) | ||
: (M2 && D2="") ? (M1=D1 ? {(U1):(R1),(U2):(R2)} : {(U2):(R1),(U1):(R2)}) : NUL | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
; Link: | ||
; Author: | ||
; Date: | ||
; for: AHK_L | ||
|
||
/* | ||
*/ | ||
|
||
ExpandNS( NumSeries, RL:="", Uni:=0, D:="," ) { ; By SKAN on D28U @ bit.ly/2L81pmP | ||
Local R:= "", N:="", Out:=D, B := IsObject(RL) ? RL : [2**63, 2**63-1] | ||
Loop, Parse, NumSeries, `,, % " `r`n`t" | ||
{ | ||
R := StrSplit(A_LoopField . ".." . A_LoopField, "..", " `r`n`t", 3) | ||
Loop % ( Abs(R.1-R.2)+1 ) | ||
{ | ||
N := Round(R.1<R.2 ? R.1+A_Index-1 : R.1-A_Index+1) | ||
Out .= (Uni && InStr(Out, D . N . D) ? "" : N>=B.1 && N<=B.2 ? N . D : "") | ||
} | ||
} | ||
Return Trim(Out, D) | ||
} | ||
|
||
|
||
/* | ||
Basic usage example: | ||
MsgBox % ExpandNS( "1..10, 25..30, 41" ) ; 1,2,3,4,5,6,7,8,9,10,25,26,27,28,29,30,41 | ||
Parameters | ||
---------- | ||
Number series: Numbers in abbreviated range form | ||
For eg. 1,2,3,4,5,9,11,12,13,14 in range form would be: 1..5, 9, 11..14 | ||
Non-numerical values are ignored. | ||
Fractional values would be rounded-off to nearest integer. | ||
Numbers outside boundary will be omitted from output. (Refer next) | ||
Range limit: 2 element array with Low/high boundary. for eg: [1, 26] | ||
Unique: True/False. True will omit duplicate numbers from output. | ||
Delimiter: Default output delimiter is comma. | ||
Clipboard := ExpandNS( "1..9",,,")`n") . ")" | ||
would generate following paste content | ||
1) | ||
2) | ||
3) | ||
4) | ||
5) | ||
6) | ||
7) | ||
8) | ||
9) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
; Link: | ||
; Author: | ||
; Date: | ||
; for: AHK_L | ||
|
||
/* | ||
*/ | ||
|
||
GuiList() { ; List all Gui names, by SKAN http://goo.gl/qgxzhx | Created: 31-Aug-2014 | ||
Static TList := "", ADM := 0x801 | ||
Local Instance := 0, List := "" | ||
|
||
IfNotEqual, A_Gui,, Return 0, TList .= A_Gui "`n" | ||
|
||
DetectHiddenWindows, % SubStr( ( ADHW := A_DetectHiddenWindows ) . "On", -1 ) | ||
WinGet, Instance, List, % "ahk_class AutoHotkeyGUI ahk_pid " DllCall( "GetCurrentProcessId" ) | ||
DetectHiddenWindows, %ADHW% | ||
IfEqual, Instance, 0, Return "", ErrorLevel := 0 | ||
|
||
OnMessage( ADM, A_ThisFunc ) | ||
Loop %Instance% | ||
DllCall( "SendMessage", "Ptr",Instance%A_Index%, "UInt",ADM, "Ptr",0, "Ptr",0 ) | ||
OnMessage( ADM, "" ) | ||
|
||
StringTrimRight, List, TList, 1 | ||
Return List, TList := "", ErrorLevel := Instance | ||
} |
Oops, something went wrong.