Skip to content

Instantly share code, notes, and snippets.

; https://en.wikipedia.org/wiki/Digest_access_authentication
class DigestAuth
{
Build(username, password, method, uri, ByRef WWWAuthenticate) {
Loop, Parse, % "realm|qop|algorithm|nonce|opaque", |
RegExMatch(WWWAuthenticate, A_LoopField "=""?\K[^,""]+", %A_LoopField%)
cnonce := this.create_cnonce()
nonceCount := "00000001"
Chrome_GetTabList() {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "http://localhost:9222/json")
whr.Send()
out := []
for i, tab in Jxon_Load(whr.ResponseText)
{
if (tab.type = "page")
out.push( {url: tab.url, title: tab.title} )
Gui, +HWNDhGUI
Gui, Add, Text, x50 y50 w700 h500 HWNDhText,
Gui, Show, w800 h620
mpv := "D:\Program Files\mpv\mpv.exe"
Run, %mpv% --idle --input-ipc-server=\\.\pipe\mpvsocket --wid=%hText% ; Or --wid=%hGUI%
return
GuiDropFiles:
mpv_loadfile(A_GuiEvent)
; Accessible Info Viewer by jethrow
; https://autohotkey.com/board/topic/77888-accessible-info-viewer-alpha-release-2012-09-20/
; Modified by tmplinshi - https://gist.github.com/tmplinshi/0fcb8655c1402a3662ac048d0d974915/
#NoEnv
#SingleInstance, force
SetBatchLines, -1
{
WM_ACTIVATE := 0x06
GetBitrate(FileName) {
if !InStr(FileName, ":") {
FileName := A_WorkingDir "\" FileName
}
RegExMatch(FileName, "^(.*\\)(.*)$", m)
oShell := ComObjCreate("Shell.Application")
oFolder := oShell.Namespace(m1)
return oFolder.GetDetailsOf( oFolder.Parsename(m2), 28 )
}
/*
ArgsToObj - Convert command line parameters to object
Example:
---------------------------------------------------------------------
Command line parameters:
-from gbk /to utf-8 /a /b --delete-top 2 --delete-end=5 in.txt out.txt
Return:
{
/*
ParseCmdline - parse command line to object
Example:
cmdline = "a test.ahk" -from gbk /to utf-8 /a /b --delete-top 2 --delete-end=5 "in file.txt" out.txt
o := ParseCmdline(cmdline)
MsgBox, % obj_print(o)
Return:
{
@tmplinshi
tmplinshi / b64.ahk
Last active February 22, 2023 18:31
Base64 Encode/Decode support UTF-16-LE encoding. Ported from VBS code https://stackoverflow.com/a/40118072/1631371.
b64_encode(p*) {
return b64.encode(p*)
}
b64_decode(p*) {
return b64.decode(p*)
}
class b64
{
; ----------------------------------------------------------------------------------------------------------------------
; Function .....: StdoutToVar_CreateProcess
; Description ..: Runs a command line program and returns its output.
; Parameters ...: sCmd - Commandline to execute.
; ..............: sEncoding - Encoding used by the target process. Look at StrGet() for possible values.
; ..............: sDir - Working directory.
; ..............: nExitCode - Process exit code, receive it as a byref parameter.
; Return .......: Command output as a string on success, empty string on error.
; AHK Version ..: AHK_L x32/64 Unicode/ANSI
; Author .......: Sean (http://goo.gl/o3VCO8), modified by nfl and by Cyruz
; Works for DropDownList/ComboBox/ListBox
Class ListBox
{
__New(hwnd) {
; GuiControl, +AltSubmit, %hwnd%
this.hwnd := hwnd
}
Add(str) {
GuiControl,, % this.hwnd, %str%