Skip to content

Instantly share code, notes, and snippets.

@tmplinshi
tmplinshi / Class_CustomFont.ahk
Last active August 8, 2023 14:55
Load font from file or resource, without needed install to system. https://autohotkey.com/boards/viewtopic.php?f=6&t=813
/*
CustomFont v2.01 (2018-8-25)
---------------------------------------------------------
Description: Load font from file or resource, without needed install to system.
---------------------------------------------------------
Useage Examples:
* Load From File
font1 := New CustomFont("ewatch.ttf")
Gui, Font, s100, ewatch
; AutoHotkey Version: AutoHotkey 1.1
; Language: English
; Platform: Win7 SP1 / Win8.1
; Author: Antonio Bueno <user atnbueno of Google's popular e-mail service>
; Short description: Gets the URL of the current (active) browser tab for most modern browsers
; Last Mod: 2014-07-05
Menu, Tray, Icon, % A_WinDir "\system32\netshell.dll", 86 ; Shows a world icon in the system tray
#u::
; WinHttpRequest.ahk
;
; Usage is similar to HTTPRequest (by VxE),
; Please visit the HTTPRequest page (http://goo.gl/CcnNOY) for more details.
;
; Supported Options:
; NO_AUTO_REDIRECT
; Timeout: <Seconds>
; Proxy: <IP:Port>
; Codepage: <CPnnn> - e.g. "Codepage: 65001"
@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
{
' https://stackoverflow.com/a/152333
' Example: QuickSort arr, LBound(arr), UBound(arr)
Private Sub QuickSort(ByRef Field() As String, ByVal LB As Long, ByVal UB As Long)
Dim P1 As Long, P2 As Long, Ref As String, TEMP As String
P1 = LB
P2 = UB
Ref = Field((P1 + P2) / 2)
Do
Function Sort(strOrArray)
Static doc
Dim s$
If Not IsObject(doc) Then
Set doc = CreateObject("htmlfile")
doc.parentWindow.eval "function sort(s){ return s.split(',').sort() }"
End If
Public Sub QuickSortNaturalNum(strArray() As String, intBottom As Integer, intTop As Integer)
Dim strPivot As String, strTemp As String
Dim intBottomTemp As Integer, intTopTemp As Integer
intBottomTemp = intBottom
intTopTemp = intTop
strPivot = strArray((intBottom + intTop) \ 2)
Do While (intBottomTemp <= intTopTemp)
SetScreenReaderActiveStatus(isActive)
{
SPI_SETSCREENREADER := 0x0047
SPIF_SENDCHANGE := 0x0002
return DllCall( "SystemParametersInfo"
, "uint", SPI_SETSCREENREADER
, "uint", !!isActive
, "ptr", 0
, "uint", SPIF_SENDCHANGE )
$xl = [Runtime.Interopservices.Marshal]::GetActiveObject('Excel.Application')
$rng = $xl.Range("a1")
$lastRowNumber = $rng.End(($xlDown = -4121)).Row
$rngEntireColumn = $rng.Resize($lastRowNumber)
$newData = $rngEntireColumn.value2 -replace '.{15}\B', "`$0`n" -split "`n"
$safeArr = New-Object 'object[,]' $newData.Count, 1
$i = 0
$test = [Runtime.Interopservices.Marshal]::GetActiveObject('ahk.active_com.test')
$test.hello()