How to keep the scripts independent and not affecting each other? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
afe
Posts: 432
Joined: 06 Dec 2018, 04:36

How to keep the scripts independent and not affecting each other?

15 Jun 2019, 00:43

Hello,

When the same script is run again, how do the two processes of the script remain independent and do not affect each other?

For example, in the example below, I found that when the script was run again, they interacted with each other and could not work as expected.

Code: Select all

#SingleInstance Off

Gui, Show, h300 w400, TEST
return

#IfWinActive TEST
Enter::
Gui, +OwnDialogs
MsgBox OK
return
Hellbent
Posts: 572
Joined: 23 Sep 2017, 13:34

Re: How to keep the scripts independent and not affecting each other?  Topic is solved

15 Jun 2019, 00:53

Try using the handle of the gui for your #IfWinActive rather than the title. That should fix it.

Code: Select all

#SingleInstance Off
Gui,+HWNDGUIHWND
Gui,Add,Text,xm ym w380 h200 vText,Text
Gui, Show, h300 w400, TEST
count:=0
return

#IF (WinActive("ahk_id" GUIHWND))
Enter::
GuiControl,,text,% ++Count
return


Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], DataLife, Google [Bot] and 146 guests