[Topic split] Modifiers and custom combos

Get help with using AutoHotkey and its commands and hotkeys
zhanglei1371
Posts: 19
Joined: 05 Aug 2014, 02:01

[Topic split] Modifiers and custom combos

29 Nov 2015, 18:19

[Moderator's note: Topic split from #If bug maybe - Bug Reports.]

l can use shift & Alt::to define an action,but why cant the +!::do that?
Then l can define my combo with pure modifier without any problem.
Last edited by zhanglei1371 on 29 Nov 2015, 23:07, edited 1 time in total.
lexikos
Posts: 6435
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: #If bug maybe

29 Nov 2015, 18:41

...


What?

Oh, you mean Alt. :roll:

Just replace "shift &" with "+".

A modifier symbol isn't a modifier symbol if it's not modifying something. +!:: is Shift and literally the "!" symbol.
zhanglei1371
Posts: 19
Joined: 05 Aug 2014, 02:01

Re: #If bug maybe

29 Nov 2015, 23:17

lexikos wrote:...

Just replace "shift &" with "+".

A modifier symbol isn't a modifier symbol if it's not modifying something. +!:: is Shift and literally the "!" symbol.
Well,Many many Thx lexikos! :bravo: Your post solved my problem that worried me for a long time.

long ago,I used the Lshift & L alt:: to define an action,But I fonud that it will disturb another combo that begin with + like +!g::.Now I can use +Lalt::Action1 or !Lshift::Action2 to define my hotkey.Then it won't impact other hotkey begin with shift。Now I can use more efficient and flexible Hotkey。

Thx very much for the reply and thx tmplinshi posting the theme!
zhanglei1371
Posts: 19
Joined: 05 Aug 2014, 02:01

Re: #If bug maybe

30 Nov 2015, 04:35

lexikos wrote:...

A modifier symbol isn't a modifier symbol if it's not modifying something. +!:: is Shift and literally the "!" symbol.
The last question:
I make the code below,I want to use shift to press different times to perform deferent function.and I give it a situation:ahk_class Notepad(or other similar situation ,to avoid affect the first combo).But I found it still have a impact to the first combo.
Are there an effective method to match both combo,without affect each other? If so ,there will be the best solution and great work!

Code: Select all

~: & Shift Up::Send {=} ;the first hotkey

#IfWinActive ahk_class Notepad ;the second hotkey,actived by ahk_class notepad,but it will affect the global.
Shift::
if winc_presses > 0 
{
    winc_presses += 1
    return
}
winc_presses = 1
SetTimer, KeyWinC, 400 
return

KeyWinC:
SetTimer, KeyWinC, off
if winc_presses = 1 
{
    send {shift}
}
else if winc_presses = 2 
{
    send {down} 
}
else if winc_presses > 2
{
    send {right}
}
winc_presses = 0
return
#IfWinActive
lexikos
Posts: 6435
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: [Topic split] Modifiers and custom combos

30 Nov 2015, 04:59

Your questions are off-topic for the Bug Reports forum and the original thread in which you posted. I have split the posts into their own topic.

As for your last question, I don't get what you mean.
tmplinshi
Posts: 1404
Joined: 01 Oct 2013, 14:57

Re: [Topic split] Modifiers and custom combos

30 Nov 2015, 07:02

It seems send {shift} can't start the Shift:: lable.

@zhanglei1371 How about replace send {shift} to SetTimer, ShiftLable, -1 or GoSub, ShiftLable

Code: Select all

ShiftLable:
Shift::
...your code
return
zhanglei1371
Posts: 19
Joined: 05 Aug 2014, 02:01

Re: [Topic split] Modifiers and custom combos

30 Nov 2015, 07:21

lexikos wrote:Your questions are off-topic for the Bug Reports forum and the original thread in which you posted. I have split the posts into their own topic.

As for your last question, I don't get what you mean.
Sorry for my bad expression :oops: :oops: :oops: 。I will express my problem more detailed:

I use this code to implement a function:when I input "(",I will press the "Shift" firstly,then I press "9" without releasing the "shift" key. After I relese the shift key without releasing the "9",then then ")" will generate automatically and the curse will move left to the middle of the two bracket. If you release the 9 firstly then release the shift finally,the ) won't appear :D .So the order of releasing is needed.

Code: Select all

~: & Shift Up::Send {=} ;the first hotkey
This code is always works well If there are no other factors.but if I set up a "shift::" key, as follows, it will not work correctly. Even adding a conditional statement "ahk class Notepad",The result is that the right bracket won't generate automatically and the curse do not move left.
I have test many times,but failed at last.If I delete the code below,the code above will work well.But I if want to have both ,If there is α possible solution?
Thx very much for the reply!!!

Code: Select all


#IfWinActive ahk_class Notepad ;the second hotkey,actived by ahk_class notepad,but it will affect the global.
$Shift::
if winc_presses > 0 
{
    winc_presses += 1
    return
}
winc_presses = 1
SetTimer, KeyWinC, 400 
return
 
KeyWinC:
SetTimer, KeyWinC, off
if winc_presses = 1 
{
    send {shift}
}
else if winc_presses = 2 
{
    send {down} 
}
else if winc_presses > 2
{
    send {right}
}
winc_presses = 0
return
#IfWinActive
zhanglei1371
Posts: 19
Joined: 05 Aug 2014, 02:01

Re: [Topic split] Modifiers and custom combos

30 Nov 2015, 23:13

Hi,everyone,is there a possible solution for this puzzle?

What I want is to get a confirmation。

if so ,I will give up it.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Flipeador, Google [Bot], opc121177, roysubs, vsub and 152 guests