Page 1 of 1

Setting the position of the seekbar of foobar2000

Posted: 30 Jan 2023, 23:18
by william_ahk
I'm trying to set the position of this seekbar in foobar2000:
foobar2000_seekbar.png
foobar2000_seekbar.png (709 Bytes) Viewed 456 times
I have attempted TBM_SETPOS but to no avail. TBM_GETRANGEMIN and TBM_GETRANGEMAX both reports 0. Is this not a regular win32 slider control?

Code: Select all

window := "ahk_class {97E27FAA-C0B3-4b8e-A693-ED7881E99FC1}"
seekbar := "{596C5150-D8FF-4ed4-81AB-99B3DDA08AF1}1"
SendMessage, 0x0405, 1, 10, % seekbar, % window ; TBM_SETPOS
msgbox % ErrorLevel ; -> 0 but no effect

SendMessage, 0x0401, 0, 0, % seekbar, % window ; TBM_GETRANGEMIN
rangemin := ErrorLevel
SendMessage, 0x0402, 0, 0, % seekbar, % window ; TBM_GETRANGEMAX
rangemax := ErrorLevel
msgbox % rangemin " - " rangemax ; -> 0 - 0

Re: Setting the position of the seekbar of foobar2000

Posted: 11 Feb 2023, 19:45
by swagfag
william_ahk wrote:Is this not a regular win32 slider control?
ahk_class {97E27FAA-C0B3-4b8e-A693-ED7881E99FC1} should already be enough of a clue that its not
u can try MSAA or UIA to automate it

Re: Setting the position of the seekbar of foobar2000

Posted: 11 Feb 2023, 20:37
by william_ahk
swagfag wrote:
11 Feb 2023, 19:45
ahk_class {97E27FAA-C0B3-4b8e-A693-ED7881E99FC1} should already be enough of a clue that its not
u can try MSAA or UIA to automate it
Well damn, I did not know that. MSAA/UIA did not expose any value for the seekbar, so I ended up using ControlClick.

Code: Select all

ControlGetPos, x, y, w, h, % seekbar, % wintitle
Random, rand_pos, 0, % w
ControlClick, % seekbar, % wintitle,,,, % "NA x" rand_pos " y0"
One drawback is that the window must be shown for this to work. If anyone knows how to control the playback programmatically with AHK it would be great.