Skip to content

Instantly share code, notes, and snippets.

@TLMcode
Last active December 19, 2015 10:29
Show Gist options
  • Save TLMcode/5941057 to your computer and use it in GitHub Desktop.
Save TLMcode/5941057 to your computer and use it in GitHub Desktop.
Microphone Meter
DetectHiddenWindows, On
OnExit, Exit
If !(A_OSVersion~="WIN_(\d|\w{5})\b")
{
Msgbox, 0x10, Whoops!, Cannot run on this version of Windows!`nThe script will now exit.
ExitApp
}
Else If !FileExist(A_WinDir "\System32\" srcd := "SoundRecorder.exe")
{
Msgbox, 0x10, Whoops!, Cannot find system resource!`nThe script will now exit.
ExitApp
}
Else If WinExist(srClass := "ahk_class AudioRecorderMainFrameTraits")
Process, Close, % srcd
WinGetPos,,,, stH, ahk_class Shell_TrayWnd
w := 10, h := A_ScreenHeight-stH
Gui, +hwndGUIHwnd +AlwaysOnTop +ToolWindow -Caption
Gui, Color, FF0000
Gui, Add, Progress, x0 w%w% h%h% range0-7000 BackgroundFF0000 +vertical c00FF00 vprogbar
Gui, Show, x-9999 y0 w%w% h%h% NA
WinWait % "ahk_id " GUIHwnd
WinSet, TransColor, FF0000
WinMove, 0
Run % srcd,, Hide, srPID
WinWait % "ahk_pid " srPID
Loop {
SendMessage, 0x400|8,0,0, msctls_progress321, % srClass
GuiControl,, progbar, % ErrorLevel
}
ESC:: ; <<< press escape to exit.
Exit:
Process, Close, % srcd
ExitApp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment