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
/* | |
Derived from Wicked - can't locate his thread but found this in the ff thread: | |
http://www.autohotkey.com/board/topic/97642-urldownloadtofile/#entry614852 | |
*/ | |
Download(url, dest) { | |
static r | |
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1") | |
if (!r || whr.Option(1) != url) |
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
DynaRun(script, name:="", args*) { ;// http://goo.gl/ECC6Qw | |
if (name == "") | |
name := "AHK_" . A_TickCount | |
;// Create named pipe(s), first one is a dummy | |
for each, pipe in ["__PIPE_GA_", "__PIPE_"] | |
%pipe% := DllCall( | |
(Join Q C | |
"CreateNamedPipe", ;// http://goo.gl/3aJQg7 | |
"Str", "\\.\pipe\" . name, ;// lpName | |
"UInt", 2, ;// dwOpenMode = PIPE_ACCESS_OUTBOUND |
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
; http://www.autohotkey.com/board/topic/20925-listvars/#entry156570 | |
VAR_get() { | |
global | |
static hEdit, pSFW, pSW, bkpSFW, bkpSW | |
local dhw, AStr, Ptr, hmod, text, v, i := 0, vars := [] | |
if !hEdit { | |
dhw := A_DetectHiddenWindows | |
DetectHiddenWindows, On | |
ControlGet, hEdit, Hwnd,, Edit1, % "ahk_id " A_ScriptHwnd |
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
RemoveDuplicate(str, delim:="`n", cs:=false) { | |
_ := cs ? ComObjCreate("Scripting.Dictionary") : [] | |
Loop, Parse, str, % delim | |
alf := A_LoopField | |
, out .= cs ? (_.Exists(alf) ? "" : (alf . delim, _.Add(alf, 1))) | |
: (_[alf] ? "" : (alf . delim, _[alf] := 1)) | |
return RTrim(out, delim) | |
} |
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
Obj2Str(obj) { | |
str := "" , array := true | |
for k in obj { | |
if (k == A_Index) | |
continue | |
array := false | |
break | |
} | |
for a, b in obj | |
str .= (array ? "" : "'" a "': ") . (IsObject(b) ? Obj2Str(b) : "'" b "'") . ", " |
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
/* | |
derived from Getfree's parseJson function | |
http://www.autohotkey.com/board/topic/93300-what-format-to-store-settings-in/#entry588268 | |
credits to Getfree | |
*/ | |
JSON_parse(jsonStr) { | |
SC := ComObjCreate("ScriptControl") | |
SC.Language := "JScript" | |
ComObjError(false) | |
jsCode = |
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
/* | |
Function: Anchor | |
Defines how controls should be automatically positioned relative to the new dimensions of a window when resized. | |
Parameters: | |
cl - a control HWND, associated variable name or ClassNN to operate on | |
a - (optional) one or more of the anchors: 'x', 'y', 'w' (width) and 'h' (height), | |
optionally followed by a relative factor, e.g. "x h0.5" | |
r - (optional) true to redraw controls, recommended for GroupBox and Button types |
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
range(stop, start:=0, step:=1) { | |
r := [] | |
Loop | |
v := start+step*(A_Index-1) | |
, r[v] := v | |
until (stop<0 ? v<=stop-step : v>=stop-step) | |
return r | |
} |
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
; Prevent "sizing arrow" cursor when hovering over window border | |
WM_SETCURSOR(wParam, lParam) { ; WM_SETCURSOR := 0x0020 | |
; standard arrow cursor | |
static HARROW := DllCall("LoadCursor", "Ptr", 0, "Ptr", 32512, "UPtr") | |
HTCODE := lParam & 0xFFFF | |
if (HTCODE > 9) && (HTCODE < 19) { ; cursor is on a border | |
DllCall("SetCursor", "Ptr", HARROW) ; show arrow cursor | |
return true ; prevent further processing | |
} |
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
/* | |
By Toralf: | |
Forum thread: http://www.autohotkey.com/forum/topic59407.html | |
Basic idea for SIFT3 code by Siderite Zackwehdex | |
http://siderite.blogspot.com/2007/04/super-fast-and-accurate-string-distance.html | |
Took idea to normalize it to longest string from Brad Wood | |
http://www.bradwood.com/string_compare/ |
NewerOlder