Page 1 of 1

Can't make my script work ONLY in a specific window

Posted: Jun 5th, ’23, 23:51
by Drakemoor
I'm trying to make Fastkeys insert two Enter when I hit enter once and one Enter on Shift+Enter, only when typing in the Obsidian app. Unfortunately, it does it in all apps, regardless of the code I use. Here are two examples:

Code: Select all

#IfWinActive ahk_exe Obsidian.exe
::Enter::
Send {Enter 2}
return

::^Enter::
Send {Enter}
return
#IfWinActive
Here is a second one:

Code: Select all

::Enter::
Send, {ENTER}{ENTER}
return 

::^Enter::
Send, {ENTER}
return
I've tried putting the name of the app in the window option, but that also doesn't work.

Please help.

Re: Can't make my script work ONLY in a specific window

Posted: Jun 6th, ’23, 07:07
by Marko
You should use a name of the window or ahk_class to identify the window. Use Window Information Tool to get this info - Tools/Window Information.

Also, you are using the shortcut syntax incorrectly. It should be
Enter::
instead of
::Enter::

Re: Can't make my script work ONLY in a specific window

Posted: Jun 6th, ’23, 13:51
by Drakemoor
Thank you! That worked.