MsgBox/InputBox gets hidden under another window (+ InputBox custom font) Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
jeeswg
Posts: 6645
Joined: 19 Dec 2016, 01:58
Location: UK

MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 10:55

Sometimes an AutoHotkey MsgBox/InputBox is created,
but immediately gets hidden under another window.
Although if you press Enter, the MsgBox/InputBox receives the key press.

I don't remember this happening in Windows XP,
but it does happen in Windows 7.
And it is still happening in the latest version of AutoHotkey (v1.1.24.05).

This was such a major issue for me that I had to replace
all instances of the MsgBox/InputBox command
with a custom function.

Code: Select all

q:: ;code that should replicate the problem (eventually the MsgBox will be hidden under another window)
Run, notepad.exe
WinWaitActive, ahk_class Notepad
Loop, 30
MsgBox
Return

;w:: ;code that appears to avoid the problem
Run, notepad.exe
WinWaitActive, ahk_class Notepad
WinGet, hWnd, ID, A
Loop, 30
{
MsgBox
WinActivate, ahk_id %hWnd%
}
Return
I seem to have a working solution, although sometimes if I deliberately
navigate to another window first and then go back and deal with the MsgBox,
it then takes me back to the original window, which can be a bit of surprise.
So I might tweak this.

I wondered if anyone else had been affected by or tried to resolve this problem.

Possibly relevant links:
Input Box Location - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/5815 ... -location/
Msgbox is often hidden - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/1157 ... en-hidden/
Last edited by jeeswg on 14 Feb 2017, 20:15, edited 2 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
aztec3
Posts: 177
Joined: 07 Apr 2014, 12:05

Re: MsgBox/InputBox gets hidden under another window

14 Feb 2017, 12:08

Have you tried the MsgBox option for "Always On Top"???

Code: Select all

MsgBox, 262144
Refer to URL:

https://autohotkey.com/docs/commands/MsgBox.htm
User avatar
jeeswg
Posts: 6645
Joined: 19 Dec 2016, 01:58
Location: UK

Re: MsgBox/InputBox gets hidden under another window

14 Feb 2017, 12:39

That's interesting, thanks so much for this response.
I've added the following top line to my custom MsgBox function:
vOpt := vOpt | 0x40000 ;always-on-top
MsgBox, % vOpt, % vWinTitle, % vText, % vTimeout
and removed the get hWnd/WinActivate lines,
we'll see if it works!
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
garry
Posts: 1860
Joined: 22 Dec 2013, 12:50

Re: MsgBox/InputBox gets hidden under another window

14 Feb 2017, 12:56

I like to use also the msgboxcreator from user 'thalon'
https://autohotkey.com/boards/viewtopic.php?t=6928

often use for info this (example) :

Code: Select all

msgbox, 262208,AHK-VERSION ,Your ahk version is=`n%a_ahkversion%
4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
GitHub: 4GForce

Re: MsgBox/InputBox gets hidden under another window

14 Feb 2017, 13:24

jeeswg wrote:Sometimes an AutoHotkey MsgBox/InputBox is created, but immediately gets hidden another window.
...
https://autohotkey.com/docs/commands/Gui.htm wrote:OwnDialogs: Gui +OwnDialogs should be specified in each thread (such as a ButtonOK subroutine) for which subsequently displayed MsgBox, InputBox, FileSelectFile, and FileSelectFolder dialogs should be owned by the window. Such dialogs become modal, meaning that the user cannot interact with the GUI window until dismissing the dialog.
https://autohotkey.com/docs/commands/MsgBox.htm wrote:The MsgBox is owned by a GUI window by means of Gui +OwnDialogs.
User avatar
jeeswg
Posts: 6645
Joined: 19 Dec 2016, 01:58
Location: UK

Re: MsgBox/InputBox gets hidden under another window

14 Feb 2017, 13:55

If I use SetTimer to make an InputBox always-on-top,
then I might as well add in set big font at the same time.

This creates an always-on-top InputBox with big font,
however, if I include the 'Thread, Priority' line,
which I need sometimes, the InputBox is not updated.

Code: Select all

q::
;Thread, Priority, 2 ;if I include this line SetTimer doesn't work
DetectHiddenWindows, On
SplitPath, A_ScriptName, , , , vNameNoExt
vJeeInputBoxTitle := vNameNoExt
SetTimer, JeeInputBoxResize, 0
;InputBox, vInput, % vJeeInputBoxTitle, % "prompt", , , , , , , , % "default"
InputBox, vInput, % vJeeInputBoxTitle, % "prompt", , , , , % A_ScreenHeight, , , % "default"
Return

JeeInputBoxResize:
SetTimer, JeeInputBoxResize, Off
vPIDAhk := DllCall("kernel32\GetCurrentProcessId")
if !vJeeInputBoxHFont
{
vFontName := "Arial"
vFontSize := 20
vFontWeight := 400
vFontHeight := -Round(vFontSize*A_ScreenDPI/72)
vJeeInputBoxHFont := DllCall("CreateFont", Int,vFontHeight, Int,0, Int,0, Int,0
, Int,vFontWeight, UInt,0, UInt,0 ,UInt,0
, UInt,0, UInt,0, UInt,0, UInt,0
, UInt,0, Str,vFontName)
}

WinWait, %vJeeInputBoxTitle% ahk_class #32770 ahk_pid %vPIDAhk%
hWnd := WinExist() ;hWnd of window from WinWait (last found window)
WinSet, AlwaysOnTop, On, ahk_id %hWnd%
WinActivate, ahk_id %hWnd%

PostMessage, 0x30, % vJeeInputBoxHFont, 0, Static1, ahk_id %hWnd% ;WM_SETFONT
PostMessage, 0x30, % vJeeInputBoxHFont, 0, Edit1, ahk_id %hWnd% ;WM_SETFONT
PostMessage, 0x30, % vJeeInputBoxHFont, 0, Button1, ahk_id %hWnd% ;WM_SETFONT
PostMessage, 0x30, % vJeeInputBoxHFont, 0, Button2, ahk_id %hWnd% ;WM_SETFONT

ControlGetPos, vPosX, vPosY, vPosW, vPosH, Edit1, ahk_id %hWnd%
ControlMove, Edit1, % vPosX, % vPosY-20, % vPosW, % vPosH+20, ahk_id %hWnd%
ControlGetPos, vPosX, vPosY, vPosW, vPosH, Button1, ahk_id %hWnd%
ControlMove, Button1, % vPosX-20, % vPosY-5, % vPosW+40, % vPosH+10, ahk_id %hWnd%
ControlGetPos, vPosX, vPosY, vPosW, vPosH, Button2, ahk_id %hWnd%
ControlMove, Button2, % vPosX-20, % vPosY-5, % vPosW+40, % vPosH+10, ahk_id %hWnd%
ControlGetPos, vPosX, vPosY, vPosW, vPosH, Static1, ahk_id %hWnd%
ControlMove, Static1, % vPosX, % vPosY, % vPosW, % vPosH-20, ahk_id %hWnd%

vPosX := 448, vPosY := 238, vPosW := 384, vPosH := 204
WinMove, ahk_id %hWnd%, , % vPosX, % vPosY, % vPosW, % vPosH
Return
PROBLEMS REGARDING INPUTBOX AND ALTERNATIVES:
- InputBox cannot take a font name/size/weight or an HFONT,
and there is a delay in the window appearing in this script.
- GUI commands make scripts Persistent, inappropriate for a library function.
- GUI via functions using DllCall would have the 'Thread, Priority' issue,
and quite possibly require looking after the WndProc and using global variables.
- I can use a second script with an InputBox GUI but this has delay issues.

I have previously put letting InputBox take an HFONT on my wish list,
there is already a parameter there, which was never made functional.

==================================================

[EDIT:]
[400th post!]

@4GForce
Regarding: Gui +OwnDialogs,
I came across that when experimenting a long time ago,
but that makes the boxes modal which is really undesirable,
but it's well worth pointing out here.
Even always-on-top has its disadvantages.
Plus the Gui command causes Persistent which is why none of my libraries use it.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
GitHub: 4GForce

Re: MsgBox/InputBox gets hidden under another window

14 Feb 2017, 14:22

jeeswg wrote:[400th post!]
:happybday:

Well, if modal is undesired there is the 'owner' option, but since its not available directly on msgbox and inputbox I was thinking that it may be set via dllcall ?
Would that work ?
garry
Posts: 1860
Joined: 22 Dec 2013, 12:50

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 14:37

https://autohotkey.com/boards/viewtopic.php?t=6928
about msgboxcreator from 'thalon' , can select :
-Task Modal
-System Modal
-Always on Top
I didn't tried , I most used 'always on top'
User avatar
jeeswg
Posts: 6645
Joined: 19 Dec 2016, 01:58
Location: UK

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 15:07

Hahaha birthdays come around faster on
the AHK forum.

Hmm, regarding 'Owner', I'm not sure what you have in my mind.
If there is some way of setting always-on-top/modal
for MsgBox (and InputBox) throughout the script,
without setting parameters each time, by putting something in the auto-execute section
that might be interesting.

I might consider a script that just sets MsgBox/InputBoxes
to always-on-top, for when I make scripts to share,
that don't use my custom functions.

Btw, an example of a modal InputBox:
Modal InputBox? - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/3989 ... -inputbox/

Regarding modal: blocking windows is not something I ever want to do,
but always-on-top isn't too bad.

@garry
Thanks, those 3 items probably relate to the Options table, here:
(That I've only just become familiar with!)
(It was lucky I had a way to find fragment identifiers to generate this link:)
https://autohotkey.com/docs/MsgBox.htm#Timeout

==================================================

It's the font issue that I've been reminded of,
that's my main concern now.
If it's possible to hack the AHK exe or AHK process
address space to change the InputBox font size, that
would be very interesting. I did try to edit the exe
with Resource Hacker but it didn't work.
Actually ... I'd like to create my own custom MsgBox anyway,
because if you change the MsgBox font, it affects the whole
system, but if I create custom MsgBoxes via DllCall
(I would not use GUI commands because of Persistent)
I get the 'Thread, Priority' issue that I mentioned.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
GitHub: 4GForce

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 16:02

jeeswg wrote:Hmm, regarding 'Owner', I'm not sure what you have in my mind.
Well a owned window is always on top of its owner.
Gui SomeGui:+OwnerAnotherGui
So it would probably be possible to set the inputbox owner using this https://msdn.microsoft.com/en-us/librar ... owner.aspx

Overwritting or extending the msgbox and inputbox method might also be possible.
I'm too newb at ahk to know how but that would be the ultimate solution.

Or something like this

Code: Select all

msgbox(options, title, text, timeout, specialSettings) {
	msgbox, %options%, %title%, %text%, %timeout%
	; get the msgbox window handle and apply specialSettings
	; ...
}
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
GitHub: qwerty12

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 18:01

SetWindowsHook might be one way of doing it:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.

CallWndProc(nCode, wParam, lParam)
{
	Critical 666
	global vJeeInputBoxHFont
	if (nCode >= 0) { ; HC_ACTION
		;cwplParam := NumGet(lParam+0) ; type is dependent on cwpmessage
		;cwpwParam := NumGet(lParam+0, A_PtrSize)
		cwpmessage := NumGet(lParam+0, A_PtrSize * 2, "UInt")
		hWnd := NumGet(lParam+0, A_PtrSize * 3, "Ptr")

		WinGetClass hwndClass, ahk_id %hWnd%
		if (hwndClass == "#32770") {
			propHandle := DllCall("GetProp", "Ptr", hwnd, "Str", "hookSentinel", "Ptr")
			if (cwpmessage == 0x007F && !propHandle) {
				DllCall("SetProp", "Ptr", hWnd, "Str", "hookSentinel", "Ptr", True)
				if (!vJeeInputBoxHFont) {
					vFontName := "Arial"
					vFontSize := 20
					vFontWeight := 400
					vFontHeight := -Round(vFontSize*A_ScreenDPI/72)
					vJeeInputBoxHFont := DllCall("CreateFont", Int,vFontHeight, Int,0, Int,0, Int,0
					, Int,vFontWeight, UInt,0, UInt,0 ,UInt,0
					, UInt,0, UInt,0, UInt,0, UInt,0
					, UInt,0, Str,vFontName,"Ptr")
				}

				WinSet, AlwaysOnTop, On, ahk_id %hWnd%

				PostMessage, 0x30, % vJeeInputBoxHFont, 0, Static1, ahk_id %hWnd% ;WM_SETFONT
				PostMessage, 0x30, % vJeeInputBoxHFont, 0, Edit1, ahk_id %hWnd% ;WM_SETFONT
				PostMessage, 0x30, % vJeeInputBoxHFont, 0, Button1, ahk_id %hWnd% ;WM_SETFONT
				PostMessage, 0x30, % vJeeInputBoxHFont, 0, Button2, ahk_id %hWnd% ;WM_SETFONT

				ControlGetPos, vPosX, vPosY, vPosW, vPosH, Edit1, ahk_id %hWnd%
				ControlMove, Edit1, % vPosX, % vPosY-20, % vPosW, % vPosH+20, ahk_id %hWnd%
				ControlGetPos, vPosX, vPosY, vPosW, vPosH, Button1, ahk_id %hWnd%
				ControlMove, Button1, % vPosX-20, % vPosY-5, % vPosW+40, % vPosH+10, ahk_id %hWnd%
				ControlGetPos, vPosX, vPosY, vPosW, vPosH, Button2, ahk_id %hWnd%
				ControlMove, Button2, % vPosX-20, % vPosY-5, % vPosW+40, % vPosH+10, ahk_id %hWnd%
				ControlGetPos, vPosX, vPosY, vPosW, vPosH, Static1, ahk_id %hWnd%
				ControlMove, Static1, % vPosX, % vPosY, % vPosW, % vPosH-20, ahk_id %hWnd%

				vPosX := 448, vPosY := 238, vPosW := 384, vPosH := 204
				WinMove, ahk_id %hWnd%, , % vPosX, % vPosY, % vPosW, % vPosH
			} else if (cwpmessage == 0x0082 && propHandle) {
				DllCall("RemoveProp", "Ptr", hWnd, "Str", "hookSentinel")
			}
		}
	}
	return DllCall("CallNextHookEx", "ptr", 0, "Int", nCode, "Ptr", wParam, "Ptr", lParam, "Ptr")
}

AtExit()
{
	global wndhook, wndlpfn
	if (wndhook)
		DllCall("UnhookWindowsHookEx", "Ptr", wndhook), wndhook := 0
	if (wndlpfn)
		DllCall("GlobalFree", "Ptr", wndlpfn, "Ptr"), wndlpfn := 0	
	return 0
}

OnExit("AtExit")

q::
Thread, Priority, 2 
DetectHiddenWindows, On
SplitPath, A_ScriptName, , , , vNameNoExt
vJeeInputBoxTitle := vNameNoExt
if (!wndhook)
	wndhook := DllCall("SetWindowsHookEx", "Int", WH_CALLWNDPROC := 4, "Ptr", wndlpfn := RegisterCallback("CallWndProc", ""), "Ptr", 0, "UInt", DllCall("GetCurrentThreadId", "UInt"), "Ptr")
InputBox, vInput, % vJeeInputBoxTitle, % "prompt", , , , , , , , % "default"
Return
The issues with this:
  • Hooking AutoHotkey's message queue might not be desired
  • I couldn't really find a message that's sent once when displaying an InputBox so I improvised a little
  • The class name #32770 is the class name for all dialog boxes, apparently. See what happens when calling MsgBox with the hook active... You might want to unset the hook after the call to InputBox or add good detection logic to the hook procedure
User avatar
jeeswg
Posts: 6645
Joined: 19 Dec 2016, 01:58
Location: UK

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 19:41

Tested ...
Omg did I just see big InputBox and 'Thread, Priority, 2' together.
(And no SetTimer.)
This looks really good.
Hmm, GetProp, SetProp, RemoveProp, I don't know these,
I will investigate.
Well 10 Internet points to you Mr. Q., fonts and GUI,
have been a problem for me since I first started AutoHotkey.
I used to use a Progress window with big font over a MsgBox/InputBox
in the early days. I often use AHK from a television.
(Sometimes I have a Progress window, that shows the contents
of the current Edit control in big for programs generally.)
Definitely one of my 'holy grail' problems that I really wanted sorting.
To be honest I think it's the last one I had.

It looks like it's taking somewhat of a similar approach to
ToolTipFont / ToolTipColor - options for the ToolTip command - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=4777
Which is something I had thought of to try and do,
I can't remember if I had a problem somewhere down the line.
However by the nature of what it was trying to do,
the ToolTip script was a little bit 'crashy' unfortunately,
and I had to stop using it. I mean it didn't crash AHK I think
but there were some minor side effects that I can't recall
and it didn't always work.
If I have any problems with the InputBox script, it's
not a problem, we'll just see how it goes.

Theoretically you could change the font
at the right moment/place and then AutoHotkey
would adjust the InputBox window/control sizes according to the font,
rather than having to do it manually.

To make this perfect I will have to get out
DrawTextEx to work out the required window/control sizes.

Regarding MsgBox v. InputBox.
A distinguishing feature is that
MsgBoxes don't have an Edit control,
InputBoxes do.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
GitHub: qwerty12

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 19:55

jeeswg wrote:Hmm, GetProp, SetProp, RemoveProp, I don't know these,
I will investigate.
Neither do I, I just wanted a quick way of "marking" a window so that the hook wouldn't keep modifying the window... I don't really know if it's the becoming thing to do, but I'll chalk it up to laziness. The same could be done locally by storing the hwnd in an array and removing it when WM_DESTROY is received in the hook.
It looks like it's taking somewhat of a similar approach to
ToolTipFont / ToolTipColor - options for the ToolTip command - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=4777
Yes, I don't think SetWindowsHookEx is a new trick around these parts (I learnt of it personally when I was writing my hook for Google Chrome), but I'm glad because I'd probably overlook calling Critical myself...
However by the nature of what it was trying to do,
the ToolTip script was a little bit 'crashy' unfortunately,
and I had to stop using it. I mean it didn't crash AHK I think
but there were some minor side effects that I can't recall
and it didn't always work.
If I have any problems with the InputBox script, it's
not a problem, we'll just see how it goes.
For InputBox, I don't think the hook is actually needed - OnMessage might actually work. I went for SetWindowsHookEx because MsgBox does need it - MessageBox spins up its own message loop.

[qupte]A distinguishing feature is that
MsgBoxes don't have an Edit control,
InputBoxes do.[/quote]

FileSelectFile can also show a dialog box with an Edit control present...
User avatar
jeeswg
Posts: 6645
Joined: 19 Dec 2016, 01:58
Location: UK

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 20:01

But open/save as prompts have a ComboBox.
The old style and the new style ones.
And I never use them.
But yeah there could be a #32770 window
I haven't considered!

Btw do you have any website or profile somewhere,
you've done some interesting stuff,
so anything vaguely approximating a collection
might be interesting.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
GitHub: qwerty12

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 20:17

jeeswg wrote:But open/save as prompts have a ComboBox.
The old style and the new style ones.
And I never use them.
But yeah there could be a #32770 window
I haven't considered!
That's true.
Btw do you have any website or profile somewhere,
you've done some interesting stuff,
so anything vaguely approximating a collection
might be interesting.
No, I've just posted stuff on various forums over the years, depending on what I was interested in at the time (having fun with Sony Ericsson [they're still Ericsson to me!] phones, Hackintoshing [until I realised I don't like Mac OS])... My GitHub profile has some stuff on it (though I did remove my most favourite project of recent times from there because nobody used it and I didn't want to answer support questions in the future: a hook for Windows 10's update notifier to stop it from taking over the screen if you ignore its prompts too much and for it to start the third-party WUMT program instead of that pared-down Windows Update program they include now). The thing with me is that I'm not a programmer, so I'm not an authority on anything and even posting here makes me nervous from any (absolutely deserved) scrutiny my posts may get. It's why I tend to wait a little to see if anybody else replies first and preface my posts with language like "I think" and so on...
User avatar
jeeswg
Posts: 6645
Joined: 19 Dec 2016, 01:58
Location: UK

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 20:56

Yeah a bit like me, I say that: I'm not a programmer,
but I can get a computer to do anything I want it to do.
(Thanks to AutoHotkey.)
I always say things like 'I believe', or base anything
I say on concrete things that I've experienced and double-check.
It's like Rocky, I keep trying
to retire, but I keep getting sucked in again.
Eventually instead of retiring I'll write a new
programming language called C++++.
I started off with some QBasic,
including cartoons, maths and some shapes.
Did Excel macros, and did basically everything
through that, open webpages and get info,
move files about, text stuff.
Problem is that Excel makes assumptions about things
and essentially corrupts your data.
Also, it had a limited number of rows, when I did stuff
with lists.
The stuff I do with text files now is so much faster,
and so much more versatile.
I did a bit of batch, but I could tell
batch was horrible very quickly and not the way to go,
and I did 'super user' on Explorer type things. Ooh the registry.
I wanted to save some images, that would be hard
to retrieve from Temporary Internet Files,
and wasn't 'patterny' for Free Download Manager,
so I looked around and started with AutoIt,
thinking there must be a program for sending regular
key presses/mouse clicks,
but before doing much, fairly quickly moved to AutoHotkey,
I'm not sure quite why. I've still got my careful
emerging notes on all the Send commands for AutoIt.
I know trying to add Ctrl+S
to do save as in Internet Explorer was a major thing,
(it didn't have it at the time).
I've only in the last few weeks, found the solution I was
looking for, via PostMessage, although it is doable via COM also.
One utility I liked was
Hot Key Plus to launch key files/websites. Really simple.
It's gradual, you think, OK I've sent some some clicks,
can I use Esc to cancel early, can I read/append some text,
can I put some text on the clipboard, can I get the date,
how do I know when the clipboard has finished copying/pasting,
then one day you take at look at the index of all the commands.
Then one day you've replaced RBTray with your own 'minimiser',
or you've added a universal spellchecker to all programs,
versus using MS Office, and in both cases with additions
that surpass what you had before.
Eventually I've replaced everything that I use.
Apart from WinMerge, but I'm thinking of replacing that now!
With an AutoHotkey script.
Back in the day it was really hard trying to write functions,
to interact with external listviews/listview headers/treeviews
etcetera, not supported by AutoHotkey. Many things
that would have been easy for experts, but
never got done for some reason!?
Another thing was that AutoHotkey Basic can do Unicode,
although not natively, although it can deal with UTF-8 bytes fine.
As a test, I rewrote the five or so,
key commands that I would have wanted at the time
like ControlGetText on Edit controls, to handle Unicode,
from within Basic. Address space stands out
as quite complex, it's an example of where I had no idea
quite what I was going to find under the bonnet (hood).
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
GitHub: qwerty12

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 21:47

Thanks a lot for sharing! :-)
jeeswg wrote:Yeah a bit like me, I say that: I'm not a programmer,
but I can get a computer to do anything I want it to do.
(Thanks to AutoHotkey.)
I always say things like 'I believe', or base anything
I say on concrete things that I've experienced and double-check.
It's like Rocky, I keep trying
to retire, but I keep getting sucked in again.
Absolutely. I really like the bass boost APO Windows has, which makes the music I listen to sound far better, but also makes the sound on TV shows really bad. After getting tired of opening the control panel and turning off the effects myself, I spent two weeks figuring out how the Sound control panel applet toggles the "Disable all effects" option for a device, I was able to write a script that turns off the effects and sets f.lux's movie mode option when I start PotPlayer without polling. And then undos all that when I close the last PotPlayer window. It's one of the many ways AutoHotkey saves me a ton of time.
I started off with some QBasic,
including cartoons, maths and some shapes.
Did Excel macros, and did basically everything
through that, open webpages and get info,
move files about, text stuff.
Problem is that Excel makes assumptions about things
and essentially corrupts your data.
Also, it had a limited number of rows, when I did stuff
with lists.
The stuff I do with text files now is so much faster,
and so much more versatile.
I got started writing really bad C using the GTK+ GUI toolkit. (Mind, my C still is pretty bad, but it's damn sight up from what I was writing back then...) That's good stuff - really bad maths skills is a familial trait here; I got a crash course in Excel, but not having had a reason to use it for so long, I think the only thing I remember there is your basic VLOOKUP...
I did a bit of batch, but I could tell
batch was horrible very quickly and not the way to go,
Yes, also not a fan here - I still don't know how to properly parse the output of a process you create from it. I don't like PowerShell, either - takes an eternity to start and I can't get to grips with the syntax. I wanted to write a script that exposed the full options of the Synaptics touchpad my laptop has in the settings, which involved moving keys around. PowerShell could do it (I wasn't sure if the computer had AHK installed and I don't like compiling scripts), but I couldn't work out the syntax even after a couple of hours. Found a post on a Russian AutoHotkey forum with good code on using RegCopyTree and I was done in 30 minutes.
I wanted to save some images, that would be hard
to retrieve from Temporary Internet Files,
and wasn't 'patterny' for Free Download Manager,
so I looked around and started with AutoIt,
thinking there must be a program for sending regular
key presses/mouse clicks,
but before doing much, fairly quickly moved to AutoHotkey,
I'm not sure quite why. I've still got my careful
emerging notes on all the Send commands for AutoIt.
I found out about AutoHotkey from a LifeHacker post I found when trying to wean myself of my Shift+Delete addiction (computer had a 20GB hard drive, I don't know why I didn't just turn the Recycle Bin off). For a few years, that was all I used AutoHotkey for. Then I wanted to have my laptop lock itself when I closed the lid (I still don't know why just doing that isn't an option in Windows), cannibalised the source of a program I found called Aerofoil that did just that to make a service, but decided I was better off moving it into an AutoHotkey script, which was easier to maintain. I found Linear Spoon's LidWatcher along with his really good explanations on how a GUID structure is filled in and that set me on the DllCall path I've been taking ever since.
I know trying to add Ctrl+S
to do save as in Internet Explorer was a major thing,
(it didn't have it at the time).
I've only in the last few weeks, found the solution I was
looking for, via PostMessage, although it is doable via COM also.
Heh, by the time I got on the Internet, Firefox (and AdBlock, thank %DEITY%) was around. Glad to see you worked out a solution :thumbup:
One utility I liked was
Hot Key Plus to launch key files/websites. Really simple.
It's gradual, you think, OK I've sent some some clicks,
can I use Esc to cancel early, can I read/append some text,
can I put some text on the clipboard, can I get the date,
how do I know when the clipboard has finished copying/pasting,
then one day you take at look at the index of all the commands.
Then one day you've replaced RBTray with your own 'minimiser',
or you've added a universal spellchecker to all programs,
versus using MS Office, and in both cases with additions
that surpass what you had before.
Eventually I've replaced everything that I use.
Nice :thumbup: I like to replace small utilities I find on the Internet that are actually useful, but use the .Net framework. That 20 GB computer had only 128 MB RAM on it - running programs that needed .Net was a pain. My dislike for .Net's memory usage has not been something I've been able to shake to this day. AutoHotkey, OTOH, works fast (at least to me) and also doesn't use much RAM.
Apart from WinMerge, but I'm thinking of replacing that now!
With an AutoHotkey script.
Sounds like quite the undertaking :morebeard:
Back in the day it was really hard trying to write functions,
to interact with external listviews/listview headers/treeviews
etcetera, not supported by AutoHotkey. Many things
that would have been easy for experts, but
never got done for some reason!?
Not having been around in those days, I wouldn't know :-) (Although if I were, I wouldn't have been able to do it, I know that)
Address space stands out
as quite complex, it's an example of where I had no idea
quite what I was going to find under the bonnet (hood).
Yes, it's because of AutoHotkey that I now understand how structs and arrays in C work. I'd seen many diagrams but they had never clicked with me. Until I sat down and learnt how to actually get values out of a struct with AutoHotkey.
User avatar
jeeswg
Posts: 6645
Joined: 19 Dec 2016, 01:58
Location: UK

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 22:03

'thank %DEITY%'
That's classic.

With Internet Explorer save as for the longest period time,
I sent key presses and clicks. It was sad because
it was the longest problem, and everything else
had a clean solution. When IE introduced Ctrl+S,
I still wanted a solution, COM I found (ExecWB), then recently PostMessage.

Replacing WinMerge shouldn't be too bad,
the main issue is if I can get an existing
algorithm working with AutoHotkey.
Should be the only real obstacle hopefully.
Idea for this project been around maybe some weeks now,
haven't really investigated yet.
Although I did create some highlighted html for output
which is the only other major obstacle I think.

Regarding external GUI controls, every so often, I'd find
some code, but I'd still need to do a lot of myself,
as a beginner, and no-one ever put it all together.
People kept saying it should be added into the source code,
but good functions in one place would have been fine,
which is what I'm trying to do now.
In spirit, the Forms Framework did coincide with some of these objectives.

I meant to say at one point, how nested brackets, was a big new thing when I saw it,
and hotstrings as a good paradigm, I had hoped for a good program, with multiple clipboards.

Yeah AHK cuts out the unnecessary often, so
you end up dealing with the more pure problems.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
GitHub: qwerty12

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

14 Feb 2017, 22:23

jeeswg wrote: With Internet Explorer save as for the longest period time,
I sent key presses and clicks. It was sad because
it was the longest problem, and everything else
had a clean solution. When IE introduced Ctrl+S,
I still wanted a solution, COM I found (ExecWB), then recently PostMessage.
Yeah, I saw your useful post on posting the menu identifiers to toggle the desktop's visibility. I had a quick go at trying that task with the shell API (SHGetSetSettings is the pertinent function here), but while it can retrieve the current setting and supposedly set it (the menu's checkbox state actually changed), it didn't actually refresh the desktop >.<
Replacing WinMerge shouldn't be too bad,
the main issue is if I can get an existing
algorithm working with AutoHotkey.
Should be the only real obstacle hopefully.
Idea for this project been around maybe some weeks now,
haven't really investigated yet.
Although I did create some highlighted html for output
which is the only other major obstacle I think.
Good luck with that :thumbup: (Sorry I don't have much to say, but it's not something I really know anything about)
Regarding external GUI controls, every so often, I'd find
some code, but I'd still need to do a lot of myself,
as a beginner, and no-one ever put it all together.
People kept saying it should be added into the source code,
but good functions in one place would have been fine,
which is what I'm trying to do now.
In spirit, the Forms Framework did coincide with some of these objectives.
Guilty :oops: It's why I prefer to post here instead of Scripts & Functions - any code I post here is tailored for the specific question being asked, so I don't have to worry about producing a generic solutuion...

Anyway, I won't derail your thread any longer. I am genuinely thankful to you for sharing your fascinating insights - it was fun to read.
User avatar
jeeswg
Posts: 6645
Joined: 19 Dec 2016, 01:58
Location: UK

Re: MsgBox/InputBox gets hidden under another window (+ InputBox custom font)

15 Feb 2017, 07:57

Regarding refreshing the desktop:
I think you are confusing 2 topics:
SHGetSetSettings hides/shows hidden files/extensions.
(Confusing names: SHGetSettings/SHGetSetSettings exist, 'SHSetSettings' doesn't.)
Refreshing the file explorer - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=12656

I don't know is there is a DllCall to hide/show desktop icons, I used:
PostMessage, 0x111, 29698, , SHELLDLL_DefView1, ahk_class Progman ;show desktop icons (toggle)
AutoHotkey recording - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=28061

This may refresh desktop/folder icons:
;SHCNE_ASSOCCHANGED := 0x8000000
DllCall("Shell32\SHChangeNotify", Int,0x8000000, UInt,0, Ptr,0, Ptr,0)

AutoHotkey_L v1.1.08 - Page 3 - Announcements - AutoHotkey Community
https://autohotkey.com/board/topic/8261 ... 108/page-3

Hahaha 'derail', you've saved me so much
time it's unbelievable, across at least around 6 topics.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], flyingDman, Google [Bot] and 163 guests