ketlyn

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Swagger100
Posts: 37
Joined: 01 Dec 2019, 23:41

ketlyn

02 Dec 2019, 21:12

hello
Last edited by Swagger100 on 08 Feb 2020, 17:19, edited 1 time in total.
rakesha002
Posts: 34
Joined: 04 Dec 2017, 00:11

Re: Good night my name is Ketlyn, some of you can help me, I'm a beginner

06 Dec 2019, 06:16

Hi,

I might be able to help you but need more info,

for Autohotkey script to work you need either autohotkey installed on your computer or
you need a compiled script to work, as a beginner you should know this,

and how you are pressing the "F" key press and hold / pressing simultaneously
and you have any script? if yes sharing it will help you a lot.
User avatar
Swagger100
Posts: 37
Joined: 01 Dec 2019, 23:41

Re: Good night my name is Ketlyn, some of you can help me, I'm a beginner

15 Dec 2019, 09:44

...
Last edited by Swagger100 on 08 Feb 2020, 17:19, edited 1 time in total.
gregster
Posts: 4606
Joined: 30 Sep 2013, 06:48

Re: Good night my name is Ketlyn, some of you can help me, I'm a beginner

16 Dec 2019, 02:36

If Shift doesn't react (fast enough) while you hold down f, try to add a small sleep to the loop.
User avatar
Swagger100
Posts: 37
Joined: 01 Dec 2019, 23:41

good

16 Dec 2019, 17:50

f
Last edited by Swagger100 on 08 Feb 2020, 17:19, edited 1 time in total.
rakesha002
Posts: 34
Joined: 04 Dec 2017, 00:11

Re: Good night my name is Ketlyn, some of you can help me, I'm a beginner

19 Dec 2019, 03:43

Hi,

sleep is in milliseconds (1 second = 1000 millisecods)
adding 1ms won't help much, try adding 50ms, 100ms , and so on as per your requirement.
ivanthedevil
Posts: 17
Joined: 18 Dec 2019, 03:39

Re: Good night my name is Ketlyn, some of you can help me, I'm a beginner

19 Dec 2019, 04:12

Ahoy! :)

This should work for you:

Code: Select all

#NoEnv
#Persistent
#SingleInstance, force
SendMode Input
SetBatchLines, -1

global IsRunning := false
global Keys := ["3", "4"]
global KeyCounter := 1
global TimeFromKeyToKey := 100 ; you can adjust this time to your liking

Loop {
    if(IsRunning) {
        PressKey(Keys[KeyCounter])
        
        KeyCounter++

        if(KeyCounter > 2) {
            KeyCounter := 1
        }
    }

    Sleep, %TimeFromKeyToKey%
}

PressKey(key) {
    SendInput, {%key% down}
    Sleep, 25
    SendInput, {%key% up}
}

$F::
    IsRunning := !IsRunning
return
If you need any help - feel free to ask!
User avatar
Swagger100
Posts: 37
Joined: 01 Dec 2019, 23:41

Re: Good night my name is Ketlyn, some of you can help me, I'm a beginner

19 Dec 2019, 17:17

....
Last edited by Swagger100 on 08 Feb 2020, 17:20, edited 1 time in total.
ivanthedevil
Posts: 17
Joined: 18 Dec 2019, 03:39

Re: Good night my name is Ketlyn, some of you can help me, I'm a beginner

20 Dec 2019, 02:41

Alright, this should do the trick -- just modify the value of SleepTime variable to your liking:

Code: Select all

#NoEnv
#Persistent
#SingleInstance, force
SendMode Input
SetBatchLines, -1

global IsRunning := false
global Keys := ["3", "4"]
global SleepTime := 1000 ; you can adjust this time to your liking

Loop {
    if(IsRunning) {
        for key, value in Keys {
            PressKey(value)
        }
    }

    Sleep, %SleepTime%
}

PressKey(key) {
    SendInput, {%key% down}
    Sleep, 25
    SendInput, {%key% up}
}

$F::
    IsRunning := !IsRunning
return
P.S. If you need to change the order of keys, just change this line:

Code: Select all

global Keys := ["3", "4"]
to this:

Code: Select all

global Keys := ["4", "3"]
User avatar
Swagger100
Posts: 37
Joined: 01 Dec 2019, 23:41

55

20 Dec 2019, 15:48

4
Last edited by Swagger100 on 08 Feb 2020, 17:20, edited 1 time in total.
User avatar
Swagger100
Posts: 37
Joined: 01 Dec 2019, 23:41

sadsa

20 Dec 2019, 15:49

a
Last edited by Swagger100 on 08 Feb 2020, 17:21, edited 1 time in total.
ivanthedevil
Posts: 17
Joined: 18 Dec 2019, 03:39

Re: Good night my name is Ketlyn, some of you can help me, I'm a beginner

20 Dec 2019, 17:01

Alright, a different solution then perhaps:

Code: Select all

#NoEnv
#Persistent
#SingleInstance, force
SendMode Input
SetBatchLines, -1

global IsRunning := false
global Keys := ["3", "4"]
global SleepTime := 400 ; you can adjust this time to your liking

PressKey(key) {
    SendInput, {%key% down}
    Sleep, 25
    SendInput, {%key% up}
}

$F::
    IsRunning := !IsRunning

    if(IsRunning) {
        Gosub, PressKeys
        SetTimer, PressKeys, %SleepTime%
    }
    else {
        SetTimer, PressKeys, Off
    }
return

PressKeys:
    for key, value in Keys {
        PressKey(value)
    }
return
User avatar
Swagger100
Posts: 37
Joined: 01 Dec 2019, 23:41

44

21 Dec 2019, 16:39

ss
Last edited by Swagger100 on 08 Feb 2020, 17:21, edited 1 time in total.
gregster
Posts: 4606
Joined: 30 Sep 2013, 06:48

Re: Good night my name is Ketlyn, some of you can help me, I'm a beginner

21 Dec 2019, 19:38

Avast is well-known to detect false-positives for AHK scripts.

Obviously, the script (text) files above are relatively harmless. They are sending some keys (according to your request) which probably trigger some heuristic rule of Avast.
(Why these scripts are using global is not clear to me, but that's not the point.)

If you downloaded AHK (especially the interpreter) from our website and are reasonably sure that your system is clean, you could surely whitelist AHK in Avast - and report these scripts as false-positives to Avast. (But of course, you are solely responsible for executing any scripts on your computer.)
User avatar
AlexL
Posts: 13
Joined: 13 Dec 2019, 15:30
Contact:

Re: Good night my name is Ketlyn, some of you can help me, I'm a beginner

22 Dec 2019, 12:00

Try this one:

Code: Select all

;##############################################
#Persistent
SetTimer, checkit, 100
return
;##############################################
;##############################################
checkit()
{
	if(testWindow())
	{
		GetKeyState, xstate, f
		if (xstate = "D")
		{
			SendInput {3}
			sleep 100
			SendInput {4}
			sleep 100
		}
	}
}
;##############################################
;--------------------------------------------------------------------
;check if active window is correct - this function avoids running scripts when the game window is not active.
;--------------------------------------------------------------------
testWindow()
{
	windowId:="notepad++.exe" ;id of the game window
	
	;get the window process name
	WinGet, activeWindowId, ProcessName, A
	
	if(activeWindowId = windowId)
	{
		;the process name is the same. The active window is the Game's window!
		return true
	}
	else
	{
		;the process name is different. The game window is not active!
		return false
	}
return
}
;--------------------------------------------------------------------
;##############################################
NOTE: change the name of the process (In this case "notepad++.exe"), so the script only works inside the game you want, and doesn't mess around outside.
The sleep commands give some pause for the keys to not be too harsh, and allow other key input. Hope it suits you.
Cheers.
User avatar
Swagger100
Posts: 37
Joined: 01 Dec 2019, 23:41

s

24 Dec 2019, 12:12

?
Last edited by Swagger100 on 08 Feb 2020, 17:21, edited 1 time in total.
User avatar
Swagger100
Posts: 37
Joined: 01 Dec 2019, 23:41

sss

24 Dec 2019, 12:13

vvv

Return to “Ask For Help”

Who is online

Users browsing this forum: 2ndprotocol, Chunjee, Google [Bot], honarjoo, randysejas and 62 guests