Difficult script maybe?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mulder427
Posts: 6
Joined: 17 Mar 2018, 04:53

Difficult script maybe?

17 Mar 2018, 09:15

Hi all

I got a difficult script to make and not sure where to start

ill try explain it...

I want the button A to be 2 keys when i click it once it makes E and when i hold it it holds down C but does not repeat C just holds it down till i release key... is this even possible my brains hurting.

and i want it to work with this...

e::
If e:=!e
{
Send {q down}
Sleep 100
Send {w down}
}
Else
Send {q up}{w up}
return


Thanks to anyone who can help.
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Difficult script maybe?

17 Mar 2018, 12:53

Hallo,
this??:

Code: Select all

a:: ;want the button A
Send, e{c Down} ;makes E and holds down C
KeyWait, a ;till i release key A
Send, {c up}
Return
$e:: ;and i want it to work with this
If e:=!e
{
	Send {q down}
	Sleep 100
	Send {w down}
}
Else
	Send {q up}{w up}
return
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: Difficult script maybe?

17 Mar 2018, 12:55

Not sure but I tried. The problem is that clicking A once will take 200milliseconds until e is sent. That's all. I don't know a better way.
Rohwedder's script serves the same purpose but in his script E is sent regardless of whether or not you pressed or clicked A. I thought you wanted to be particular on that as e has been assigned as a hotkey. If you are not then you must add a $ prefix to the e hotkey to prevent it from being triggered every time you press A.

My script if for when you want to Click A for E and hold A for holding C. esc closes script.

Code: Select all

A::
Sleep 200
While GetKeyState("a","P") {
Send, {c down}
}
Send, {c up}
Send, {e} 
return

e::
If e:=!e
{
Send {q down}
Sleep 100
Send {w down}
}
Else
Send {q up}{w up}
return

		
esc:: ExitApp
Change sleep's value to a bit higher if you don't want it to trigger so early.
Last edited by Nwb on 17 Mar 2018, 22:31, edited 1 time in total.
I am your average ahk newbie. Just.. a tat more cute. ;)
mulder427
Posts: 6
Joined: 17 Mar 2018, 04:53

Re: Difficult script maybe?

17 Mar 2018, 15:46

Nwb wrote:Not sure but I tried. The problem is that clicking A once will take 200milliseconds until e is sent. That's all. I don't know a better way.
Rohwedder's script serves the same purpose but in his script E is sent regardless of whether or not you pressed or clicked A. I thought you wanted to be particular on that as e has been assigned as a hotkey. If you are not then you must add a tilde (~) to the e hotkey to prevent it from being triggered every time you press A.

My script if for when you want to Click A for E and hold A for holding C. esc closes script.

Code: Select all

A::
Sleep 200
While GetKeyState("a","P") {
Send, {c down}
}
Send, {c up}
Send, {e} 
return

e::
If e:=!e
{
Send {q down}
Sleep 100
Send {w down}
}
Else
Send {q up}{w up}
return

		
esc:: ExitApp
Change sleep's value to a bit higher if you don't want it to trigger so early.

Absolutlely perfect, very clever to get your head round what i wrote but you did it, thanks very much my friend. :bravo:
mulder427
Posts: 6
Joined: 17 Mar 2018, 04:53

Re: Difficult script maybe?

17 Mar 2018, 16:10

Nwb wrote:Not sure but I tried. The problem is that clicking A once will take 200milliseconds until e is sent. That's all. I don't know a better way.
Rohwedder's script serves the same purpose but in his script E is sent regardless of whether or not you pressed or clicked A. I thought you wanted to be particular on that as e has been assigned as a hotkey. If you are not then you must add a tilde (~) to the e hotkey to prevent it from being triggered every time you press A.

My script if for when you want to Click A for E and hold A for holding C. esc closes script.

Code: Select all

A::
Sleep 200
While GetKeyState("a","P") {
Send, {c down}
}
Send, {c up}
Send, {e} 
return

e::
If e:=!e
{
Send {q down}
Sleep 100
Send {w down}
}
Else
Send {q up}{w up}
return

		
esc:: ExitApp
Change sleep's value to a bit higher if you don't want it to trigger so early.
One more thing would be great could you make it with this script..

e::
Send {q down}
Sleep 100
Send {w down}
KeyWait, e
Send {q up}{w up}
return

so its sort of the other way round e would now need to be held while c would be the key to click and toggle on?

Thanks again my friend trying to get my head round it is hard =)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333, wilkster and 330 guests