multiple instances incorrectly run at the same time every time I click RUN

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

multiple instances incorrectly run at the same time every time I click RUN

15 Oct 2023, 06:03

I noticed that when I run a script that Is already running, another instance runs at the same time every time I click RUN. I can see them doubling up in the task tray and no, when I hover the mouse over them it doesn't disappear .
I use the line '#SingleInstance, Force' and it still happens.
This never ever happened on my Windows 10 PC since I started with Autohotkey 3 years ago, but now I have a Windows 11 Laptop, it always happens and even running the same scripts. why?
It's so frustrating , I have to implement an exit first method before running each time when I'm in Dev.

I even put in a trillion fail safes that ChatGPT offered, which were all very good. See spoiler here for reference of one suggestion
Spoiler
but, It seems if I press run for the 2nd time without clicking anywhere else on the screen or typing, it'll create two instances, but If I do click or type, the fail-safe scripts will work and nullify two instance. strange
RussF
Posts: 1303
Joined: 05 Aug 2021, 06:36

Re: multiple instances incorrectly run at the same time every time I click RUN

15 Oct 2023, 08:35

SteveMylo wrote: I use the line '#SingleInstance, Force' and it still happens.
I honestly don't know for sure if it makes a difference, but the example in #SingleInstance does not have a comma - your example does. Perhaps try without one?

Russ
User avatar
V0RT3X
Posts: 245
Joined: 20 May 2023, 21:59
Contact:

Re: multiple instances incorrectly run at the same time every time I click RUN

15 Oct 2023, 08:55

Just a possibility...

The posting by Cattleya about 2/3 of the way down in the below old thread offers a SingleInstance function that may help.

https://www.autohotkey.com/board/topic/56956-singleinstance-force-doesnt-work-sometimes/
User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

Re: multiple instances incorrectly run at the same time every time I click RUN

15 Oct 2023, 10:23

Would you believe chatGPT pointed me to that thread. Pretty unbelievable.
Anyways, i tried about 11 different fail safes & they all didn’t work. Even ones including a FlagFile & many others.
Something is wrong that my other computer PC windows 10 does not happen.
I’m using SciTE4Autohotkey. Maybe that’s it.
I have recently switched to VS Code. I’ll try there perhaps
User avatar
SteveMylo
Posts: 233
Joined: 22 Jun 2021, 00:50
Location: Australia
Contact:

Re: multiple instances incorrectly run at the same time every time I click RUN

15 Oct 2023, 10:27

RussF wrote:
SteveMylo wrote: I use the line '#SingleInstance, Force' and it still happens.
I honestly don't know for sure if it makes a difference, but the example in #SingleInstance does not have a comma - your example does. Perhaps try without one?

Russ
It shouldn’t make a difference at all. But i’ll try tomorrow
The comma in `#SingleInstance, Force` is optional. Both `#SingleInstance, Force` and `#SingleInstance Force` are valid and functionally identical in AutoHotkey.

In AutoHotkey, the comma is often used to delimit parameters in function calls and commands, but in the case of directives like `#SingleInstance`, it's not required. So you can use whichever version you find more readable or consistent with your coding style.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mexican scientist, swiss and 152 guests