I have a teeny script to toggle the holding down of my right mouse button.
Is there a way to make it only when a certain application is in focus?
Want script to only work within designated program.
Re: Want script to only work within designated program.
Thank you for the reply.
After looking at that, it might as well be in Japanese.
I'm gonna need a ELI5.
Re: Want script to only work within designated program.
Code: Select all
#IfWinActive ahk_exe notepad.exe
F3::Send % GetKeyState("RButton") ? "{RButton up}" : "{RButton down}"
#IfWinActive
Re: Want script to only work within designated program.
This was my attempt lolmikeyww wrote: ↑19 May 2022, 14:48Another exampleCode: Select all
#IfWinActive ahk_exe notepad.exe F3::Send % GetKeyState("RButton") ? "{RButton up}" : "{RButton down}" #IfWinActive
Code: Select all
#IfWinActive [somename.exe]
toggle=0
return
rbutton::
toggle:=!toggle
if toggle=1
click ,right ,down
else
click, right, up
return
I don't have that and it seems to still work.
Re: Want script to only work within designated program.
F3:: is an example of a hotkey. You do not need to use it. Another example of a hotkey is on line 6 of your script.
I recommend moving your #If directive to occur directly above your hotkey, because that is the only place where it works anyway.
I recommend moving your #If directive to occur directly above your hotkey, because that is the only place where it works anyway.
See the example that I posted, or WinTitle, for proper WinTitle syntax.Creates context-sensitive hotkeys and hotstrings. Such hotkeys perform a different action (or none at all) depending on the type of window that is active or exists.
Re: Want script to only work within designated program.
Thank you kindly for the help.mikeyww wrote: ↑19 May 2022, 15:01F3:: is an example of a hotkey. You do not need to use it. Another example of a hotkey is on line 6 of your script.
I recommend moving your #If directive to occur directly above your hotkey, because that is the only place where it works anyway.See the example that I posted, or WinTitle, for proper WinTitle syntax.Creates context-sensitive hotkeys and hotstrings. Such hotkeys perform a different action (or none at all) depending on the type of window that is active or exists.
I used your code and implemented a hotkey that works great. Much better than the toggle, to be honest.