Autohotkey script to pause video on Kmplayer and do the functions (if it is already paused do not send space) Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
soheill0098
Posts: 69
Joined: 01 Sep 2020, 12:28

Autohotkey script to pause video on Kmplayer and do the functions (if it is already paused do not send space)

Post by soheill0098 » 11 Apr 2021, 06:27

I want to write a script, so that when Kmplayer windows is activated, When I press f , if the video on Kmplyer is plying then pause it (for example by sending space) then do the functions I defined and if it is already paused, then not sending space but do the functions. Here is the script that send space and do the functions but when the video is paused it send space and do the functions (which is my issue I want those functions be done when the video is paused)

Code: Select all

#IfWinActive ahk_class KMPlayer 64X
f::
Sendinput,{space}
sleep,50
Sendinput,{enter}
sleep,50
if WinExist("Oxford Advanced Learner's Dictionary")
        WinActivate
sleep,50
Click,178,136
sleep,50
Sendinput,^a{Delete}
sleep,50
return
User avatar
mikeyww
Posts: 26934
Joined: 09 Sep 2014, 18:38

Re: Autohotkey script to pause video on Kmplayer and do the functions (if it is already paused do not send space)

Post by mikeyww » 11 Apr 2021, 06:39

In KMPlayer, you can set a hotkey to pause your video. You can then send that key.
soheill0098
Posts: 69
Joined: 01 Sep 2020, 12:28

Re: Autohotkey script to pause video on Kmplayer and do the functions (if it is already paused do not send space)

Post by soheill0098 » 11 Apr 2021, 06:51

mikeyww wrote:
11 Apr 2021, 06:39
In KMPlayer, you can set a hotkey to pause your video. You can then send that key.
I don't know how to do it. in fact I want the functions be done if the video is paused ( for when it is playing I wrote the script that pause it by sending space then do the things I defined)
User avatar
mikeyww
Posts: 26934
Joined: 09 Sep 2014, 18:38

Re: Autohotkey script to pause video on Kmplayer and do the functions (if it is already paused do not send space)  Topic is solved

Post by mikeyww » 11 Apr 2021, 07:02

In KMPlayer -> F2 for options -> Player -> Keys -> Pause -> Set shortcut to ALT+SPACE

Code: Select all

#IfWinActive ahk_class KMPlayer 64X ahk_exe KMPlayer64.exe
f::
Send !{Space} ; Pause the video
MsgBox, Done!
Return
#IfWinActive
soheill0098
Posts: 69
Joined: 01 Sep 2020, 12:28

Re: Autohotkey script to pause video on Kmplayer and do the functions (if it is already paused do not send space)

Post by soheill0098 » 11 Apr 2021, 07:11

mikeyww wrote:
11 Apr 2021, 07:02
In KMPlayer -> F2 for options -> Player -> Keys -> Pause -> Set shortcut to ALT+SPACE

Code: Select all

#IfWinActive ahk_class KMPlayer 64X ahk_exe KMPlayer64.exe
f::
Send !{Space} ; Pause the video
MsgBox, Done!
Return
#IfWinActive
Wow! You are amazing sir!
Post Reply

Return to “Ask for Help (v1)”