Issue with sending and receiving F13 - F24 Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Scr1pter
Posts: 183
Joined: 06 Aug 2017, 08:21
Location: Germany

Issue with sending and receiving F13 - F24

23 Feb 2018, 19:07

Hi,

First off: This is NOT a gaming related question.

I created a script which executes specific commands whenever F13, F14 or F15 get pressed.
(These keys get pressed by external software - either by BOME MIDI Translator Pro or Logitech Gaming Software.)
Everything works perfectly.

However, I can't receive F13 commands which were sent BY AutoHotKey.
I tried this

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



It does not execute the F13 command if I press F12.
It executes the F13 command if it came from the other two programs, though.

In another script I made a very simple test, which worked:

Code: [Select all] [Download] GeSHi © Codebox Plus

F12::
Send {F13}
return

F13::
Send F13 was pressed!
return


When pressing F12, the F13 command GETS executed correctly.
Why does the simple script work but not the one that I really need?

I also tried it with $F13:: instead of F13.
No chance either.

Best regards
I'm not an expert, just an enthusiastic AutoHotKey user.
If my post contains the word Gaming, it does not automatically mean it's a gaming related question ;)
Keyboard: Logitech G15 first generation - Mice: Logitech G9, G502, G600 - OS: Windows 7 Pro 64 Bit AHK version: 1.1.29.00
User avatar
Exaskryz
Posts: 2861
Joined: 17 Oct 2015, 20:28

Re: Issue with sending and receiving F13 - F24  Topic is solved

23 Feb 2018, 19:22

You may be able to get around these limitations by using SendLevel and/or #InputLevel.

I'll do some testing to see if it is actually a problem using the #if directive, but it may not be. (But you are sure you're inside of Notepad++ when you press F12, right?)

I had an initial suspicion that the #If would be installing a keyboard hook in a similar manner to #UseHook. These two code blocks fail to produce the MsgBox when I press F12:

Code: [Select all] [Download] GeSHi © Codebox Plus

#If WinActive("ahk_class Notepad++")

F12::Send {F13}

F13::MsgBox Hello World


Code: [Select all] [Download] GeSHi © Codebox Plus

#UseHook

F12::Send {F13}

F13::MsgBox Hello World


But what threw me off was your comment about the $F13. Did that it work for you in your test script? You said "No chance", which is ambiguous to me. I interpreted it to be a typo and you meant "No change". Which would imply your test script worked when using $F13 still; for me, this block also failed:

Code: [Select all] [Download] GeSHi © Codebox Plus

F12::Send {F13}

$F13::MsgBox Hello World


Given that I can come across a similar, if not the same, issue by using #If, the suggested solution of SendLevel may do it. This works for me:

Code: [Select all] [Download] GeSHi © Codebox Plus

#If WinActive("ahk_class Notepad++")

F12::
SendLevel, 2
Send {F13}
return

F13::MsgBox Hello World
User avatar
Scr1pter
Posts: 183
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Issue with sending and receiving F13 - F24

23 Feb 2018, 20:01

Hi Exaskryz,

The answer to all your question is yes.
By "no chance" I meant "No chance to get it work."

I tested it with SendLevel, 2.
It works flawlessly!

Thank you very much!
I'm not an expert, just an enthusiastic AutoHotKey user.
If my post contains the word Gaming, it does not automatically mean it's a gaming related question ;)
Keyboard: Logitech G15 first generation - Mice: Logitech G9, G502, G600 - OS: Windows 7 Pro 64 Bit AHK version: 1.1.29.00

Return to “Ask For Help”

Who is online

Users browsing this forum: Kenpt5u, newbieforever, Pardeep Tariyal, Pilu, rooneysoccer and 10 guests