Skip to content

Instantly share code, notes, and snippets.

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)
' 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
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()
Add-Type -TypeDefinition @'
using System;
using System.Runtime;
using System.Runtime.InteropServices;
public static class Marshal
{
internal const String OLEAUT32 = "oleaut32.dll";
public static Object GetActiveObject(Guid clsid)
MsgBox, % CmdRet("cmd /c code --list-extensions")
CmdRet(sCmd, callBackFuncObj := "", encoding := "CP0")
{
static HANDLE_FLAG_INHERIT := 0x00000001, flags := HANDLE_FLAG_INHERIT
, STARTF_USESTDHANDLES := 0x100, CREATE_NO_WINDOW := 0x08000000
DllCall("CreatePipe", "PtrP", hPipeRead, "PtrP", hPipeWrite, "Ptr", 0, "UInt", 0)
DllCall("SetHandleInformation", "Ptr", hPipeWrite, "UInt", flags, "UInt", HANDLE_FLAG_INHERIT)
Menu, MyMenu, Add, Item 1, Label
Menu, MyMenu, Disable, Item 1
Menu, MyMenu, Add, Item 2, Label
DllCall("SetTimer", "Ptr", A_ScriptHwnd, "Ptr", id := 1, "UInt", 2000, "Ptr", RegisterCallback("MyTimer", "F"))
Menu, MyMenu, Show
Return
Label() {
MsgBox, % A_ThisMenuItem
}
url:= "https://cdn.ostrovok.ru/t/1024x768/second/fd/8b/fd8b26115b8cf4510b8bf02fe85084eecbbd32a8.jpeg"
localFilePath:= "TestWhr.jpg"
;===================================================================================
FileDelete % localFilePath
DownLoader := ComObjCreate("WMPlayer.OCX.7")
DownLoader.url := url, moreDataAvailable:= 1
Whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
Events := new IWinHttpRequestEvents(Whr, Func("ReceiveData").Bind(localFilePath, Stop := [false]))
Whr.Open("GET", url, true)