Automatically select the subtitle [potplayer]

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kafka1979
Posts: 4
Joined: 26 Sep 2022, 01:03

Automatically select the subtitle [potplayer]

Post by kafka1979 » 26 Sep 2022, 01:21

I'm new to coding. (installed AHK yesterday, still learning)
I want to write a script to automatically select the subtitle by the name I want
In fact, I've already written one, which is worked by imageSearch and Click, but it's not flexible enough

How can i make it more flexible?
Attachments
2022-09-26_133543.jpg
related information
2022-09-26_133543.jpg (631.16 KiB) Viewed 651 times

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: Automatically select the subtitle [potplayer]

Post by mikeyww » 26 Sep 2022, 05:52

Welcome to this AutoHotkey forum!

I did not try it, but you could try Control, ChooseString.

https://www.autohotkey.com/docs/commands/Control.htm#ChooseString

kafka1979
Posts: 4
Joined: 26 Sep 2022, 01:03

Re: Automatically select the subtitle [potplayer]

Post by kafka1979 » 26 Sep 2022, 10:04

mikeyww wrote:
26 Sep 2022, 05:52
Welcome to this AutoHotkey forum!

I did not try it, but you could try Control, ChooseString.

https://www.autohotkey.com/docs/commands/Control.htm#ChooseString
thank you for your help!
now the problem is that I can't get any information from the control(Afx:00007FFEE7E60000:b:0000000000010003:0000000000900011:00000000000000001)

Code: Select all

#IfWinActive ahk_class PotPlayer64
ControlGet, Items, List,, Afx:00007FFEE7E60000:b:0000000000010003:0000000000900011:00000000000000001
Loop, Parse, Items, `n
    MsgBox Item number %A_Index% is %A_LoopField%.
it didn't return any information. the control seems not a regular control

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: Automatically select the subtitle [potplayer]

Post by mikeyww » 26 Sep 2022, 11:58

I do not have a way to test, but if Window Spy shows the control, then it should work. What does Window Spy show as ClassNN?

kafka1979
Posts: 4
Joined: 26 Sep 2022, 01:03

Re: Automatically select the subtitle [potplayer]

Post by kafka1979 » 26 Sep 2022, 23:46

mikeyww wrote:
26 Sep 2022, 11:58
I do not have a way to test, but if Window Spy shows the control, then it should work. What does Window Spy show as ClassNN?

it showed like this

Code: Select all

ClassNN:Afx:00007FFEE7E60000:b:0000000000010003:0000000000900011:00000000000000001
2022927124156.png
2022927124156.png (132.15 KiB) Viewed 545 times

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: Automatically select the subtitle [potplayer]

Post by mikeyww » 27 Sep 2022, 06:24

Is this part of a hotkey routine? What is the larger script?

Your posted code contains a bug: #If is used only for hotkeys & hotstrings. See documentation. #If is not If.

Without a :arrow: WinTitle for ControlGet, AHK will use the last found window. In your posted code, this might be the wrong window.

kafka1979
Posts: 4
Joined: 26 Sep 2022, 01:03

Re: Automatically select the subtitle [potplayer]

Post by kafka1979 » 27 Sep 2022, 08:16

mikeyww wrote:
27 Sep 2022, 06:24
Is this part of a hotkey routine? What is the larger script?

Your posted code contains a bug: #If is used only for hotkeys & hotstrings. See documentation. #If is not If.

Without a :arrow: WinTitle for ControlGet, AHK will use the last found window. In your posted code, this might be the wrong window.
Thank you so much!I think I should read the documentation first :D :D :D

Post Reply

Return to “Ask for Help (v1)”