Keep the script open until we close the notification

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
partof
Posts: 110
Joined: 16 Jan 2016, 08:38

Keep the script open until we close the notification

Post by partof » 12 Dec 2020, 08:25

I'm struggling with this script. The notification only flashes for 1/2 second. It should remain open until I click on the close button (and the script should end). (I want to avoid a "sleep 10000000")

Code: Select all

#Persistent
Splashimage, ,M2 cwolive, test

ButtonCancel:
ExitApp
return
Any idea?

garry
Posts: 3788
Joined: 22 Dec 2013, 12:50

Re: Keep the script open until we close the notification

Post by garry » 12 Dec 2020, 08:39

maybe use msgbox ( ? ) / or a hotkey ...

Code: Select all

#Persistent
Splashimage, ,M2 cwolive, test
esc::exitapp

Rohwedder
Posts: 7733
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Keep the script open until we close the notification

Post by Rohwedder » 12 Dec 2020, 08:52

Hallo,
try:

Code: Select all

Splashimage, ,M2 cwolive, test
WinWaitClose,% A_ScriptName 
ExitApp

User avatar
mikeyww
Posts: 27241
Joined: 09 Sep 2014, 18:38

Re: Keep the script open until we close the notification

Post by mikeyww » 12 Dec 2020, 09:09

The initial script fails because, without Return, the script continues to the next command, so the script simply exits due to ExitApp.

In the next revision, the first hotkey label also functions as a Return for the preceding block.

The Return following ExitApp is never executed.

partof
Posts: 110
Joined: 16 Jan 2016, 08:38

Re: Keep the script open until we close the notification

Post by partof » 12 Dec 2020, 09:20

Rohwedder wrote:
12 Dec 2020, 08:52
Hallo,
try:

Code: Select all

Splashimage, ,M2 cwolive, test
WinWaitClose,% A_ScriptName 
ExitApp
Thank you Rohwedder but it doesn't close the script

partof
Posts: 110
Joined: 16 Jan 2016, 08:38

Re: Keep the script open until we close the notification

Post by partof » 12 Dec 2020, 09:21

garry wrote:
12 Dec 2020, 08:39
maybe use msgbox ( ? ) / or a hotkey ...
Thank you but I need to use a splash

User avatar
mikeyww
Posts: 27241
Joined: 09 Sep 2014, 18:38

Re: Keep the script open until we close the notification

Post by mikeyww » 12 Dec 2020, 09:22

Code: Select all

#Persistent
Splashimage,, M2 cwolive, test
Return

ButtonCancel:
ExitApp
Or:

Code: Select all

#Persistent
Splashimage,, M2 cwolive, test
Last edited by mikeyww on 12 Dec 2020, 09:23, edited 1 time in total.

partof
Posts: 110
Joined: 16 Jan 2016, 08:38

Re: Keep the script open until we close the notification

Post by partof » 12 Dec 2020, 09:23

mikeyww wrote:
12 Dec 2020, 09:09
The Return following ExitApp is never executed.
It makes sense! But how to solve this issue?

User avatar
mikeyww
Posts: 27241
Joined: 09 Sep 2014, 18:38

Re: Keep the script open until we close the notification

Post by mikeyww » 12 Dec 2020, 09:23

When the Return is missing, the solution is to add it. :)

Code: Select all

#Persistent
Splashimage,, M2 cwolive, test
Return

ButtonCancel:
ExitApp
Of course, this script actually has no button, so you can simply use:

Code: Select all

#Persistent
Splashimage,, M2 cwolive, test

partof
Posts: 110
Joined: 16 Jan 2016, 08:38

Re: Keep the script open until we close the notification

Post by partof » 12 Dec 2020, 10:58

mikeyww wrote:
12 Dec 2020, 09:23
you can simply use:
It sound logical, but it doesn't work (closing the window doesn't kill the script)

User avatar
mikeyww
Posts: 27241
Joined: 09 Sep 2014, 18:38

Re: Keep the script open until we close the notification

Post by mikeyww » 12 Dec 2020, 11:03

When I ran @Rohwedder's, it closed the script.

garry
Posts: 3788
Joined: 22 Dec 2013, 12:50

Re: Keep the script open until we close the notification

Post by garry » 12 Dec 2020, 14:34

want you use Rohwedder's script like this ( ? )

Code: Select all

;- Keep the script open until we close the notification 
;- https://www.autohotkey.com/boards/viewtopic.php?p=369950#p369950
Gui,1: -dpiscale
Gui,add,button,x20 y50 h30 gA1,SPLASHimage 
Gui,show,x100 y100 w500 h100,TEST
return
;------------
A1:
Splashimage, ,M2 cwolive, test
WinWaitClose,% A_ScriptName 
exitapp
;------------
Guiclose:
exitapp
;------------

partof
Posts: 110
Joined: 16 Jan 2016, 08:38

Re: Keep the script open until we close the notification

Post by partof » 14 Dec 2020, 05:17

garry wrote:
12 Dec 2020, 14:34
want you use Rohwedder's script like this ( ? )
Thanks for your help but it's not what I'm looking for.

Post Reply

Return to “Ask for Help (v1)”