Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Spacebar to send Escape when KMPlayer running



  • Please log in to reply
4 replies to this topic
GOLDSTAR
  • New members
  • 3 posts
  • Last active: Oct 24 2015 08:29 PM
  • Joined: 14 Oct 2015

Hi

 

I'm trying to do a simple thing:

To make Spacebar key send Escape when KMPlayer is running.

 

I tried this:

 

#Persistent

SetTitleMatchMode, 2

return

 

#IfWinActive, KMPlayer

Backspace::Send {ESC}

#IfWinActive

 

It does the work when KMPlayer is running, but not when it plays a playback.

 

I would appreciate any help.



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

What does the win title become during a playback? My recommendation is using ahk_exe KMPlayer.exe or whatever the executable name may be as a WinTitle.

 

Also, your hotkey is for Backspace, and not for the Spacebar (Space::), very different keys.



GOLDSTAR
  • New members
  • 3 posts
  • Last active: Oct 24 2015 08:29 PM
  • Joined: 14 Oct 2015

My mistake, I meant Backspace, not Spacebar.

 

Now i understand.

the problam is that when a playback is running, the win title is the name of the file...

so I guess there's no solution.

 

Thank you for the enlightenment :)



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

Just in case I was not clear enough before, there should indeed be a solution. Check out that WinTitle link I provided for different ways to specify a window, notably by referring to the process name or executable name which should not be changing when the program runs.



GOLDSTAR
  • New members
  • 3 posts
  • Last active: Oct 24 2015 08:29 PM
  • Joined: 14 Oct 2015
✓  Best Answer

Great, it does the trick:

#Persistent
SetTitleMatchMode, 2
return
 
if(WinActive("ahk_exe KMPlayer.exe"))
~Backspace::Send {ESC}

Many Thanks, Exaskryz