#SingleInstance why not make it the default Topic is solved

Discuss the future of the AutoHotkey language
cgx5871
Posts: 319
Joined: 26 Jul 2018, 14:02

#SingleInstance why not make it the default

Post by cgx5871 » 15 Jan 2023, 00:31

#SingleInstance why not make it the default
Every script must write this line.
Most people are used to running on a single instance, right?
User avatar
andymbody
Posts: 996
Joined: 02 Jul 2017, 23:47

Re: #SingleInstance why not make it the default

Post by andymbody » 15 Jan 2023, 00:56

I assume you mean #SingleInstance, force

If so... Agreed!! :thumbup:
cgx5871
Posts: 319
Joined: 26 Jul 2018, 14:02

Re: #SingleInstance why not make it the default

Post by cgx5871 » 15 Jan 2023, 01:02

andymbody wrote:
15 Jan 2023, 00:56
I assume you mean #SingleInstance, force

If so... Agreed!! :thumbup:
If the parameter is omitted, it defaults to Force
User avatar
andymbody
Posts: 996
Joined: 02 Jul 2017, 23:47

Re: #SingleInstance why not make it the default

Post by andymbody » 15 Jan 2023, 01:09

If the parameter is omitted, it defaults to Force
Ok... that must have changed in v2. V1 defaults to "prompt" (as far as I know)
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: #SingleInstance why not make it the default  Topic is solved

Post by swagfag » 15 Jan 2023, 20:44

good point, why not. makes u wonder why this wasnt the default behavior in the first place
0.208 BETA - November 17, 2003 wrote:In this version, by default, multiple instances of the same script can be launched. If you wish to limit a script to a single instance, use the #SingleInstance directive described below.
#SingleInstance: Specifying this anywhere in a script will prevent new instances of that script from being launched once there is already one running. Instead, you will be prompted for whether to close the existing instance. Note: You do not need to use "on" or "off" with this command.
0.217 BETA - January 5, 2004 wrote:Improved the behavior of #SingleInstance scripts when the user attempts to run another instance: The user is now prompted for whether to keep the original instance or replace it with the new one.
1.0.09 - April 27, 2004 wrote:Improved #SingleInstance with an optional FORCE parameter that skips the warning dialog. [thanks beardboy]
1.0.10 - May 11, 2004 wrote:Improved #SingleInstance to optionally ignore attempts to launch a script that is already running. [thanks Rajat]
1.0.16 - July 15, 2004 wrote:Changed scripts that use hotkeys, hotstrings, or #Persistent so that #SingleInstance is automatically implied. Use #SingleInstance Off to override this.
1.0.20 - September 30, 2004 wrote:(Might break existing scripts): Scripts that contain the GUI command anywhere are automatically single-instance unless the #SingleInstance directive has been used to override that. In addition, GUI scripts are now instantly persistent rather than becoming so only after a GUI window is created.
User avatar
xMaxrayx
Posts: 237
Joined: 06 Dec 2022, 02:56
Contact:

Re: #SingleInstance why not make it the default

Post by xMaxrayx » 12 Jun 2024, 15:14

Meh disagree if you are using a lot of libraries and shared Ahk processes, this won't be good, besides we now need to re-write all theses old scripts

You can make Auto-apply snippet in (vs code) when you are creating a new Ahk file (write whatever you want as defoult.

You can use AHK++ it has that future.
-----------------------ヾ(•ω•`)o------------------------------
https://github.com/xmaxrayx/
niCode
Posts: 320
Joined: 17 Oct 2022, 22:09

Re: #SingleInstance why not make it the default

Post by niCode » 12 Jun 2024, 17:13

xMaxrayx wrote:
12 Jun 2024, 15:14
Meh disagree if you are using a lot of libraries and shared Ahk processes
I don't know what libraries has anything to do with the topic and I'm not sure what you mean by scripts "sharing" a process. Could you elaborate?

I have actually never heard of someone that intentionally runs multiple of the same script, or read about someone suggesting to do that to solve a particular problem. The lack of info on multiple instances in a practical scenario means I'm not even sure what the benefit would be. I'm sure scenarios exist but it feels like they would be so rare that the default should absolutely be #SingleInstance, Force because that's how the overwhelming majority of people use their scripts and it also avoids confusion for new people if they accidentally run multiple of the same script and inevitably have issues.
Marium0505
Posts: 43
Joined: 11 May 2020, 20:45

Re: #SingleInstance why not make it the default

Post by Marium0505 » Yesterday, 16:29

@niCode
Many use cases where you would have more than one instance of a script running at the same time, let's say the script is a calculator, I sometimes have multiple calculators open at the same time, and don't get me started on browsers... Or windows explorer windows.... or VS Code windows.
Last edited by Marium0505 on 16 Jun 2024, 04:19, edited 1 time in total.
niCode
Posts: 320
Joined: 17 Oct 2022, 22:09

Re: #SingleInstance why not make it the default

Post by niCode » Yesterday, 16:51

Those are all programs, not scripts. If you were making a point, it didn't come across.
Post Reply

Return to “AutoHotkey Development”