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
DownloadToString(url, encoding = "utf-8") | |
{ | |
static a := "AutoHotkey/" A_AhkVersion | |
if (!DllCall("LoadLibrary", "str", "wininet") || !(h := DllCall("wininet\InternetOpen", "str", a, "uint", 1, "ptr", 0, "ptr", 0, "uint", 0, "ptr"))) | |
return 0 | |
c := s := 0, o := "" | |
if (f := DllCall("wininet\InternetOpenUrl", "ptr", h, "str", url, "ptr", 0, "uint", 0, "uint", 0x80003000, "ptr", 0, "ptr")) | |
{ | |
while (DllCall("wininet\InternetQueryDataAvailable", "ptr", f, "uint*", s, "uint", 0, "ptr", 0) && s > 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
DownloadToFile(url, filename) | |
{ | |
static a := "AutoHotkey/" A_AhkVersion | |
if (!(o := FileOpen(filename, "w")) || !DllCall("LoadLibrary", "str", "wininet") || !(h := DllCall("wininet\InternetOpen", "str", a, "uint", 1, "ptr", 0, "ptr", 0, "uint", 0, "ptr"))) | |
return 0 | |
c := s := 0 | |
if (f := DllCall("wininet\InternetOpenUrl", "ptr", h, "str", url, "ptr", 0, "uint", 0, "uint", 0x80003000, "ptr", 0, "ptr")) | |
{ | |
while (DllCall("wininet\InternetQueryDataAvailable", "ptr", f, "uint*", s, "uint", 0, "ptr", 0) && s > 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
DownloadBin(url, byref buf) | |
{ | |
static a := "AutoHotkey/" A_AhkVersion | |
if (!DllCall("LoadLibrary", "str", "wininet") || !(h := DllCall("wininet\InternetOpen", "str", a, "uint", 1, "ptr", 0, "ptr", 0, "uint", 0, "ptr"))) | |
return 0 | |
c := s := 0 | |
if (f := DllCall("wininet\InternetOpenUrl", "ptr", h, "str", url, "ptr", 0, "uint", 0, "uint", 0x80003000, "ptr", 0, "ptr")) | |
{ | |
while (DllCall("wininet\InternetQueryDataAvailable", "ptr", f, "uint*", s, "uint", 0, "ptr", 0) && s > 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
CPULoad() { ; By SKAN / 22-Apr-2014. Thanks to ejor, Codeproject: http://goo.gl/epYnkO | |
Static GetSystemTimes, PIT, PKT, PUT ; Note > vars Pxx is Previous and Cxx is Current | |
If ! GetSystemTimes | |
GetSystemTimes := DllCall( "GetProcAddress", UInt, DllCall( "GetModuleHandle" | |
, Str,"Kernel32.dll" ), A_IsUnicode ? "AStr" : "Str","GetSystemTimes" ) | |
, DllCall( GetSystemTimes, Int64P,PIT, Int64P,PKT, Int64P,PUT ) | |
DllCall( GetSystemTimes, Int64P,CIT, Int64P,CKT, Int64P,CUT ) | |
, IdleTime := PIT - CIT, KernelTime := PKT - CKT, UserTime := PUT - CUT | |
, SystemTime := KernelTime + UserTime |
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
PostClick(x, y, class, title) | |
{ | |
lParam := x & 0xFFFF | (y & 0xFFFF) << 16 | |
PostMessage, 0x201, 1, %lParam%, %class%, %title% ;WM_LBUTTONDOWN | |
PostMessage, 0x202, 0, %lParam%, %class%, %title% ;WM_LBUTTONUP | |
} |
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
AutoSort(Arr) { | |
t := [] | |
for k, v in Arr | |
t[RegExReplace(v, "\s")] := v | |
for k, v in t | |
Arr[A_Index] := v | |
return Arr | |
} |
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
PIDfromAnyID( anyID="" ) { ; SKAN, 10-May-2014. http://ahkscript.org/boards/viewtopic.php?p=17974#p17974 | |
Process, Exist, %anyID% | |
IfGreater, ErrorLevel, 0, Return ErrorLevel | |
DetectHiddenWindows, % SubStr( ( ADHW := A_DetectHiddenWindows ) . "On", -1 ) | |
SetTitleMatchMode, % SubStr( ( ATMM := A_TitleMatchMode ) . "RegEx", -4 ) | |
WinGet, PID, PID, ahk_id %anyID% | |
IfEqual, PID,, WinGet, PID, PID, %anyID% | |
DetectHiddenWindows, %ADHW% | |
SetTitleMatchMode, %ATMM% | |
Return PID ? PID : 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
F1::ComObjCreate("shell.application").ControlPanelItem("Firewall.cpl") |
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
SetParentByTitle(Window_Title_Text, Gui_Number) ; F | |
{ | |
WinGetTitle, Window_Title_Text_Complete, %Window_Title_Text% | |
Parent_Handle := DllCall( "FindWindowEx", "uint",0, "uint",0, "uint",0, "str", Window_Title_Text_Complete) | |
Gui, %Gui_Number%: +LastFound | |
Return DllCall( "SetParent", "uint", WinExist(), "uint", Parent_Handle ) | |
} |
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
SetParentByClass(Window_Class, Gui_Number) ; F | |
{ | |
Parent_Handle := DllCall( "FindWindowEx", "uint",0, "uint",0, "str", Window_Class, "uint",0) | |
Gui, %Gui_Number%: +LastFound | |
Return DllCall( "SetParent", "uint", WinExist(), "uint", Parent_Handle ) | |
} |
OlderNewer