Program does not work without SciTE open

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Shuu148
Posts: 39
Joined: 11 May 2023, 21:25

Program does not work without SciTE open

Post by Shuu148 » 03 Jun 2023, 05:59

Hello guys. I dont understand why my program does not work without having SciTe open. I need to open test.ahk and SciTe to make that program work. But i want to compile it to an .exe.If i make it to an .exe it does not work. So if i close SciTe it does not work anymore.

Code: Select all

~F1::
{
	SendInput "{F1}"
	Sleep 500
	SendInput "{XButton2}"
}


Attachments
1.PNG
1.PNG (18.23 KiB) Viewed 275 times

User avatar
mikeyww
Posts: 26596
Joined: 09 Sep 2014, 18:38

Re: Program does not work without SciTE open

Post by mikeyww » 03 Jun 2023, 06:09

Before you compile the script, get it working.

1. What does the script actually do?

2. What should the script do instead?

3. What do you believe is the role of the tilde in your hotkey?

4. When you refer to "program", are you referring to your AutoHotkey script?

Shuu148
Posts: 39
Joined: 11 May 2023, 21:25

Re: Program does not work without SciTE open

Post by Shuu148 » 03 Jun 2023, 07:26

1. What does the script actually do? When I press F1 the view switches to a fellow player. After 500 ms the view switches back to me. I have tried it with GetKeyState("F1" , "P") and !GetkeyState("F1" , "P") but i am getting the same problem.

2. What should the script do instead? This script is doing what i want but only when SciTe is open.

3. What do you believe is the role of the tilde in your hotkey? Its a prefix to prevent blocking native(original) function of that key? So it blocks the original input of that key? I dont understand it 100% because it works sometimes.

4. When you refer to "program", are you referring to your AutoHotkey script? Yes

User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: Program does not work without SciTE open

Post by boiler » 03 Jun 2023, 08:02

Shuu148 wrote: 3. What do you believe is the role of the tilde in your hotkey? Its a prefix to prevent blocking native(original) function of that key? So it blocks the original input of that key? I dont understand it 100% because it works sometimes.
No, it is not. It is the exact opposite. It causes the original function of that key to be retained rather than getting blocked/eaten by the hotkey. What you need is the $ prefix which prevents your routine from triggering its own hotkey when you send F1.

User avatar
mikeyww
Posts: 26596
Joined: 09 Sep 2014, 18:38

Re: Program does not work without SciTE open

Post by mikeyww » 03 Jun 2023, 09:52

"This script is doing what i want" is not actually a description of what the script should do. Thus, nowhere in this thread do you indicate what the script should do.

Below is a potential alternative. Again, this assumes that you want F1 to be sent first, since "prevent blocking" means "do not block".

Code: Select all

#Requires AutoHotkey v2.0

~F1:: {
 Sleep 500
 Click 'X2'
 SoundBeep 1500
}

Post Reply

Return to “Ask for Help (v2)”