Messages - highend01 [ switch to compact view ]

Pages: prev1 2 3 [4] 5 6 7 8 9 ... 38next
16
The .png files you've attached to your previous post are working fine as well.

AHK v1.1.32.00

17
pngs gives error so attached ico files
The three .png files I'm using here are working perfectly fine...

18

#NoEnv
#SingleInstance force
#Persistent

Gosub, Check
SetTimer, Check, 5000
return


Check:
result := Runret("cmd /c netsh wlan show interfaces")
RegExMatch(result, "im)channel\s+:\s*(?P<Channel>\d{1,3})", match)

If (matchChannel >= 1 && matchChannel <= 14)
Menu, Tray, Icon, %A_ScriptDir%\_green.png
Else If (matchChannel >= 34)
Menu, Tray, Icon, %A_ScriptDir%\_red.png
Else
Menu, Tray, Icon, %A_ScriptDir%\_grey.png

return


; http://www.autohotkey.com/board/topic/15455-stdouttovar/page-7
Runret(cmd, params="") {
; Assemble command + parameters
cmd := (params) ? cmd . " " . params : cmd

DllCall("CreatePipe", "Ptr*", hStdInRd , "Ptr*", hStdInWr , "Uint", 0, "Uint", 0)
DllCall("CreatePipe", "Ptr*", hStdOutRd, "Ptr*", hStdOutWr, "Uint", 0, "Uint", 0)
DllCall("SetHandleInformation", "Ptr", hStdInRd , "Uint", 1, "Uint", 1)
DllCall("SetHandleInformation", "Ptr", hStdOutWr, "Uint", 1, "Uint", 1)

; Fill a StartupInfo structure
if A_PtrSize = 4 ; We're on a 32-bit system
{
VarSetCapacity(pi, 16, 0)
sisize := VarSetCapacity(si, 68, 0)
NumPut(sisize,    si,  0, "UInt")
NumPut(0x100,     si, 44, "UInt")
NumPut(hStdInRd , si, 56, "Ptr") ; stdin
NumPut(hStdOutWr, si, 60, "Ptr") ; stdout
NumPut(hStdOutWr, si, 64, "Ptr") ; stderr
}
else if A_PtrSize = 8 ; We're on a 64-bit system
{
VarSetCapacity(pi, 24, 0)
sisize := VarSetCapacity(si, 96, 0)
NumPut(sisize,    si,  0, "UInt")
NumPut(0x100,     si, 60, "UInt")
NumPut(hStdInRd , si, 80, "Ptr") ; stdin
NumPut(hStdOutWr, si, 88, "Ptr") ; stdout
NumPut(hStdOutWr, si, 96, "Ptr") ; stderr
}

DllCall("CreateProcess" , "Uint", 0 ; Application Name
, "Ptr", &cmd ; Command Line
, "Uint", 0 ; Process Attributes
, "Uint", 0 ; Thread Attributes
, "Int", True ; Inherit Handles
, "Uint", 0x08000000 ; Creation Flags (0x08000000 = Suppress console window)
, "Uint", 0 ; Environment
, "Uint", 0 ; Current Directory
, "Ptr", &si ; Startup Info
, "Ptr", &pi) ; Process Information

DllCall("CloseHandle", "Ptr", NumGet(pi, 0))
DllCall("CloseHandle", "Ptr", NumGet(pi, A_PtrSize))
DllCall("CloseHandle", "Ptr", hStdOutWr)
DllCall("CloseHandle", "Ptr", hStdInRd)
DllCall("CloseHandle", "Ptr", hStdInWr)

VarSetCapacity(temp, 4095)
size := 0
Loop
{
result := DllCall("Kernel32.dll\ReadFile", "Uint", hStdOutRd, "Ptr", &temp, "Uint", 4095, "UintP", size, "Uint", 0)
if (result = "0")
break
else
output := output . StrGet(&temp, size, "CP850")
}
DllCall("CloseHandle", "Ptr", hStdOutRd)
return output
}

19
Write a simple .ahk script which executes
netsh wlan show interfaces
and parses the content afterwards.

Regarding capturing the cmd output, e.g.: https://autohotkey.com/board/topic/15455-stdouttovar/page-7

If Channel is 1-14 you're on 2,4 GHz and if it's 36+ (both values depend on country, look at e.g. https://en.wikipedia.org/wiki/List_of_WLAN_channels#5_GHz_or_5.8_GHz_(802.11a/h/j/n/ac/ax)
you're on 5 GHz.

~15 lines of code, 3 16x16 px .png / .ico files (e.g. grey = no wifi connection, green = 2.4 GHz, red = 5 GHz, or whatever you'd prefer)...

Works at least on Win 10...

20
General Software Discussion / Re: looking for cheap email hoster
« on: January 13, 2020, 01:24 AM »
www.SneakEmail.com: Sorry, account creation is currently disabled

Are there any other recommendable services like this?

Pages: prev1 2 3 [4] 5 6 7 8 9 ... 38next
Go to full version