Searching error in my script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AccuracySword
Posts: 8
Joined: 26 Aug 2017, 09:47

Searching error in my script

26 Aug 2017, 10:07

good afternoon
I tried to figure it out, but apparently I did not have enough zeal, so I ask for help
I need to create two scripts that multiply the result from a single physical press of a key (NUMPAD 2) in 2 and 3 times.
Simply put, get the effect like from double PHYSICAL pressing of the key, but with a single
IMPORTANT: The script should work when starting a certain program!
Would be nice if you help me, or point my mistake

Code: Select all

F11::Suspend
; KP2 - KP2KP2KP2
SetKeyDelay, 0
vk62sc050::SendEvent, {vk62sc05}{vk62sc050}{vk62sc050}

Code: Select all

vk62sc050::    ;Numpad2 3x.
Loop, 3    ; Cycle 3x
        {
        Send, {vk62sc050}    ; Numpad2
        }
Return
There is two different scripts i did.
I'm not glad with result of my development. The fact is that when you press the key, too many operations are triggered, more than required. Also, these triggers are not obtained in physical form. A computer clicks a push, but I dont get the proper result.
The problem is in the range of operation (the time of the clamped key). This should be between each trip to simulate real push
Last edited by AccuracySword on 26 Aug 2017, 13:44, edited 1 time in total.
User avatar
tidbit
Posts: 1272
Joined: 29 Sep 2013, 17:15
Location: USA

Re: Searching error in my script

26 Aug 2017, 11:42

posting 6 times when it says your post is waiting for approval won't help it get approved any faster.
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
AccuracySword
Posts: 8
Joined: 26 Aug 2017, 09:47

Re: Searching error in my script

26 Aug 2017, 13:35

tidbit wrote:posting 6 times when it says your post is waiting for approval won't help it get approved any faster.
i am just stupid,
by the way question still actual
obeeb
Posts: 140
Joined: 20 Feb 2014, 19:15

Re: Searching error in my script

26 Aug 2017, 20:15

AccuracySword wrote:I'm not glad with result of my development. The fact is that when you press the key, too many operations are triggered, more than required.
This happens because you trigger the hotkey from itself when you send the same hotkey. To prevent it you should prefix it with $ if you want your hotkey to work only when a certain application is active you should use #IfWinActive the $ is not required in this case but better just keep it anyway. With the following code it will only work in notepad:

Code: Select all

#IfWinActive ahk_class Notepad
$vk62sc050::Send, {vk62sc050 3} ; Numpad2 3x.
#IfWinActive
AccuracySword wrote:Also, these triggers are not obtained in physical form. A computer clicks a push, but I dont get the proper result.
The problem is in the range of operation (the time of the clamped key). This should be between each trip to simulate real push
You should try different things to obtain "proper result" see the following for some ideas: https://www.autohotkey.com/docs/FAQ.htm#games
AccuracySword
Posts: 8
Joined: 26 Aug 2017, 09:47

Re: Searching error in my script

27 Aug 2017, 01:46

obeeb wrote:
AccuracySword wrote:I'm not glad with result of my development. The fact is that when you press the key, too many operations are triggered, more than required.
This happens because you trigger the hotkey from itself when you send the same hotkey. To prevent it you should prefix it with $ if you want your hotkey to work only when a certain application is active you should use #IfWinActive the $ is not required in this case but better just keep it anyway. With the following code it will only work in notepad:
AccuracySword wrote:Also, these triggers are not obtained in physical form. A computer clicks a push, but I dont get the proper result.
The problem is in the range of operation (the time of the clamped key). This should be between each trip to simulate real push
You should try different things to obtain "proper result" see the following for some ideas: https://www.autohotkey.com/docs/FAQ.htm#games
At most not necessary only when the application is turned on, it is necessary that the script works while using the application. Thank you for your advice, but unfortunately this did not solve the problem. The point is that my program must recognize physical pressures. They are not fixed, so nothing happens.
By the way, with IfWinActive code script is not working.
As close as possible to the required solution is here, but still not the presses that are needed

Code: Select all


KP2 - KP2KP2KP2
$vk62sc050::Send, {vk62sc050 3} ; Numpad2 3x.

I saw script that i need years ago, so i am sure that AHK works with my prog
I tried different variants with control send and set key delay, but i dont know right sequence for put that,
I'm still looking for solutions.
obeeb
Posts: 140
Joined: 20 Feb 2014, 19:15

Re: Searching error in my script

27 Aug 2017, 03:06

AccuracySword wrote:The point is that my program must recognize physical pressures.
Autohotkey can't physically press buttons on your keyboard.
AccuracySword wrote:They are not fixed, so nothing happens.
I don't understand this sentence.
AccuracySword
Posts: 8
Joined: 26 Aug 2017, 09:47

Re: Searching error in my script

27 Aug 2017, 04:52

obeeb wrote:
AccuracySword wrote:The point is that my program must recognize physical pressures.
Autohotkey can't physically press buttons on your keyboard.
AccuracySword wrote:They are not fixed, so nothing happens.
I don't understand this sentence.
Pressing a button occurs, but they do not affect the program
it should be vice versa

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AHK_user, Google [Bot] and 242 guests