Intro code in autohotkey scripts v2?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
wlashack
Posts: 39
Joined: 25 Aug 2019, 01:28

Intro code in autohotkey scripts v2?

Post by wlashack » 29 Mar 2023, 10:44

Hello,
I am a casual user of Autohotkey, I use it, it helps me a lot, but am not a codie.
When I started using AHK v1 years ago, I found somewhere an info, that it is recommended to star my .ahk script with following code:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
I switched to AHK 2 recently and my question is: does this apply also for AHK v2 scripts or is it pointless now?

Thanks!

SandyClams
Posts: 63
Joined: 02 Jul 2020, 11:55

Re: Intro code in autohotkey scripts v2?

Post by SandyClams » 29 Mar 2023, 11:04

it's all pointless now; each of those settings is already default in v2.

AHK_user
Posts: 515
Joined: 04 Dec 2015, 14:52
Location: Belgium

Re: Intro code in autohotkey scripts v2?

Post by AHK_user » 29 Mar 2023, 12:41

I would recommend:

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force

wlashack
Posts: 39
Joined: 25 Aug 2019, 01:28

Re: Intro code in autohotkey scripts v2?

Post by wlashack » 29 Mar 2023, 13:07

Thanks for both replies!

Post Reply

Return to “Ask for Help (v2)”