Close another AHK script with button Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
zareen
Posts: 3
Joined: 09 Dec 2022, 06:49

Close another AHK script with button

Post by zareen » 09 Dec 2022, 06:53

is there any way to close ANOTHER ahk script using button?

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

Re: Close another AHK script with button

Post by boiler » 09 Dec 2022, 07:00

Create a GUI with a button linked to a routine that does something like this.

zareen
Posts: 3
Joined: 09 Dec 2022, 06:49

Re: Close another AHK script with button

Post by zareen » 09 Dec 2022, 07:19

I don't understand how to do this, because I am bad at ahk :crazy: , I got ready GUI with working buttons, but I need to close opened ahk script located in the same folder as gui
ahk name I need to close "FHome.ahk"

Code: Select all

SHOME:
DetectHiddenWindows, On
WinGet, AHKList, List, ahk_class AutoHotkey
Loop, %AHKList%
{
    ID := AHKList%A_Index%
    If (ID <> A_ScriptHwnd)
        WinClose, ahk_id %ID%
}
Return

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

Re: Close another AHK script with button  Topic is solved

Post by boiler » 09 Dec 2022, 08:32

That can be reduced to just this:

Code: Select all

DetectHiddenWindows, On
WinClose, % A_ScriptDir "\FHome.ahk"

Post Reply

Return to “Ask for Help (v1)”