SplashImage not working with certain apparently unrelated code Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
wpb
Posts: 150
Joined: 14 Dec 2015, 01:53

SplashImage not working with certain apparently unrelated code

16 Jun 2020, 16:51

I'm seeing some very strange things happening when using SplashImage. The following code works with the SingleInstance directive commented out, but when I uncomment it, the SplashImage command has no effect.

The code also works if I uncomment the MsgBox just before the SplashImage – I then see the screen go black for half a second.

I'm totally baffled! Any ideas?

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;#SingleInstance, Force
#Persistent

^4::
Testing4()
{
	;MsgBox, Test!
	SplashImage,,B w%A_ScreenWidth% h%A_ScreenHeight% cwBlack NA
	Sleep,500
	SplashImage,off
}
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: SplashImage not working with certain apparently unrelated code

16 Jun 2020, 16:57

You've created a function, but I can't see where you're calling the function in the first place?
wpb
Posts: 150
Joined: 14 Dec 2015, 01:53

Re: SplashImage not working with certain apparently unrelated code

16 Jun 2020, 17:02

It's a function hotkey (see here: https://www.autohotkey.com/docs/Hotkeys.htm#Function). It works just like a normal hotkey, so just press ctrl+4 to invoke.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: SplashImage not working with certain apparently unrelated code

16 Jun 2020, 17:04

wpb wrote:
16 Jun 2020, 17:02
It's a function hotkey (see here: https://www.autohotkey.com/docs/Hotkeys.htm#Function). It works just like a normal hotkey, so just press ctrl+4 to invoke.
Ooops, wasn't aware of that! Thx :thumbup:
You've set 'NA' within the SplashImage parameter section? Is that a valid parameter?? AFAIK, #Persistent isn't necessary in case a Hotkey is used?
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: SplashImage not working with certain apparently unrelated code

16 Jun 2020, 17:52

NA is not a valid parameter, its parsed as A(dont make the splash always on top)
something about modifiers being down interferes with the way these particular types of splash windows are displayed
at least on win10 1909 and 1.1.32.00

Code: Select all

Send {Ctrl Down}
SplashImage, , w100 h100 A ; created but doesnt show up

*Esc::
	Send {Ctrl Up}
	ExitApp
wpb
Posts: 150
Joined: 14 Dec 2015, 01:53

Re: SplashImage not working with certain apparently unrelated code

17 Jun 2020, 01:18

Thanks for the replies so far.

Changed the "NA" modifier to "A" makes no difference, sadly.

I have to admit, I suspected modifiers might be affecting things. But adding a KeyWait, Control at the top of Testing4() makes no difference.

It feels like a bug in AHK, or in the OS, but that's just a hunch.

Any other ideas or similar experiences?
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: SplashImage not working with certain apparently unrelated code

17 Jun 2020, 02:07

Code: Select all

 #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
 #Warn  ; Enable warnings to assist with detecting common errors.
 SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
 SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#SingleInstance, Force
; #Persistent

^4::
Testing4()
{
	MsgBox, Test!
	SplashImage,, B w%A_ScreenWidth% h%A_ScreenHeight% cwBlack A  
	Sleep, 5000
	SplashImage,off
}
AHK 1.1.30.03 | Win 10.0.18362 - Tested successfully.
wpb
Posts: 150
Joined: 14 Dec 2015, 01:53

Re: SplashImage not working with certain apparently unrelated code

17 Jun 2020, 03:41

Thanks, Bobo. But does it also work if you comment out the MsgBox?
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: SplashImage not working with certain apparently unrelated code  Topic is solved

17 Jun 2020, 04:38

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;#SingleInstance, Force
#Persistent

^4::
Testing4()
{
	;MsgBox, Test!
	SplashImage,,B w%A_ScreenWidth% h%A_ScreenHeight% cwBlack A
	Sleep,5000
	SplashImage,off
}
This shows the SplashImage at the bottom of the z-order here (Win10 18362 64-bit / AHK 1.1.32.00 64-bit). After removing the A option, it's shown at the top.
wpb
Posts: 150
Joined: 14 Dec 2015, 01:53

Re: SplashImage not working with certain apparently unrelated code

17 Jun 2020, 04:52

Thank you so much for your input. Yes, that must be it! It's the z-order.
I wonder why the singleinstance, force and msgbox commands were making it work. Perhaps leaving the script window as the last highest window in the stack, so the splashscreen displays at the top as well?
Very pleased to have found the answer. Thanks again to everyone who chipped in!
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: SplashImage not working with certain apparently unrelated code

17 Jun 2020, 04:57

@ wpb -
No, if the MsgBox is disabled (while the 'A'-param is present) SplashImage won't work as expected.
As @just me has sorted out if the 'A'-param gets removed, SplashImage works fine regardless of the MsgBox is en-/disabled/exists.
wpb
Posts: 150
Joined: 14 Dec 2015, 01:53

Re: SplashImage not working with certain apparently unrelated code

17 Jun 2020, 06:39

Thanks for confirming, and thanks to everyone for helping.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jeves and 286 guests