Window Media Player show Volume

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ThewarII
Posts: 49
Joined: 01 Oct 2014, 09:33

Window Media Player show Volume

05 Oct 2020, 03:57

Thanks brother for this code

Code: Select all

PostMessage, 0x111, 18816, 0, , Windows Media Player ; to decrease vol
PostMessage, 0x111, 18815, 0, , Windows Media Player ; to encrease vol
I am not pro about write code but i made this for you can get volume of window media player :v
It worked in My PC but not well. I don't know how to make better ?

Anyone can help me code for show Volume in Window Media player ?
Sometime address is 0x****D934, sometime is 0x****D904, sometime is 0x****D94C, etc...

Code: Select all

WMPMusic:
Loop,
{
	Process,exist,wmplayer.exe
	If ErrorLevel
	{
		WinGet,VarPID,PID,%WMP%
		IniWrite,%VarPID%,%Fileini%,WMP,PID
		Sleep,500
		ToolTip,Searching,900,0,20
		Loop,10
		{
			PostMessage,0x111,18815,0,,%WMP% ;to increase vol
			Sleep,10
		}
		IniRead,Temp,%Fileini%,WMP,Temp
		Loop,
		{
			AmLuong := ReadMemory(Temp,"wmplayer.exe")
			If (AmLuong = 100)
			{
				Loop,
				{
					AmLuong := ReadMemory4B(Temp,"wmplayer.exe")
					If (AmLuong = 100)
					{
						SetFormat,Integer,H
						Temp := Temp
						IniWrite,%Temp%,%Fileini%,WMP,ADDR
						SetFormat,Integer,D
						Break
					}
					Temp += 0x10000
				}
				Break
			}
			Temp += 0x10000
		}
		ToolTip,,,,20
		Break
	}
	Sleep,100
}
Return
you need path for value fileini
That script very basic :))

and 2 hotkeys for change volume

Code: Select all

$+^WheelUp::
IniRead,LoadPID,%Fileini%,WMP,PID
If (LoadPID = "")
{
	GoSub,WMPMusic
}
Else
{
	Process,Exist,%LoadPID%
	If !ErrorLevel
	{
		GoSub,WMPMusic
	}
}
PostMessage,0x111,18815,0,,%WMP% ;to decrease vol
IniRead,ADDR,%Fileini%,WMP,ADDR
AmLuong := ReadMemory(ADDR,"wmplayer.exe")
ToolTip,WMP[%LoadPID%]:%AmLuong%,900,0,20
SetTimer,CCTT,-250
IfWinNotActive,%WinBnS%
{
	Send,{WheelUp}
}
Return

$+^WheelDown::
IniRead,LoadPID,%Fileini%,WMP,PID
If (LoadPID = "")
{
	GoSub,WMPMusic
}
Else
{
	Process,Exist,%LoadPID%
	If !ErrorLevel
	{
		GoSub,WMPMusic
	}
}
PostMessage,0x111,18816,0,,%WMP% ;to decrease vol
IniRead,ADDR,%Fileini%,WMP,ADDR
AmLuong := ReadMemory(ADDR,"wmplayer.exe")
ToolTip,WMP[%LoadPID%]:%AmLuong%,900,0,20
SetTimer,CCTT,-250
IfWinNotActive,%WinBnS%
{
	Send,{WheelDown}
}
Return

CCTT:
ToolTip,,,,20
Return
Oh i forgot you also need code readmemory

Code: Select all

ReadMemory(MADDRESS,PROGRAM)
{
	Process, wait, %PROGRAM%, 0.1
		pid = %ErrorLevel%
	VarSetCapacity(MVALUE,4)
	ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
	DllCall("ReadProcessMemory", "UInt", ProcessHandle, "UInt", MADDRESS, "Str", MVALUE, "Uint",4, "Uint *",0)
		result := *(&MVALUE)
	return result
}

ReadMemory4B(MADDRESS,PROGRAM)
{
	Process, wait, %PROGRAM%, 0.1
		pid = %ErrorLevel%
	VarSetCapacity(MVALUE,4)
	ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
	DllCall("ReadProcessMemory", "UInt", ProcessHandle, "UInt", MADDRESS, "Str", MVALUE, "Uint",4, "Uint *",0)
	Loop,4
		result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
	return result
}
Last edited by ThewarII on 08 Oct 2020, 01:03, edited 2 times in total.
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Window Media Player show Volume

05 Oct 2020, 08:05

Is this for someone in particular? Is it asking for help?
ThewarII
Posts: 49
Joined: 01 Oct 2014, 09:33

Re: Window Media Player show Volume

06 Oct 2020, 11:42

Can you do better than i do ?
I need show volume of WMP. i use window 10 pro.
I :superhappy:(happy) when I know about AHK.
I have & am using AHK to do anything in windows microsoft.
The first time, I know it in around year 2013.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: macromint, peter_ahk, Rauvagol and 310 guests