How to create an edit controls with transparent background? - autohotkey

While reading the AutoHotkey docs i could find these commands: WinSet, Transparent WinSet, Transcolor
WinSet, Transparent makes the control disappear.
WinSet, Transcolor makes the control background transparent, however if the GUI has any other color than default, it causes glitches in the text.
Example:
Gui, Color, 0
Gui, Add, Edit, w200 h30 hWndTest, Test
Gui, Show, w400 h200
Return
F2::
WinSet, Transparent, , ahk_id %Test%
Return
F3::
WinSet, Transcolor, ffffff, ahk_id %Test%
Return
Would like to ask if someone knows how to create an edit control with background transparent without 'glitches'?

Related

AHK How to completely hide ApplicationFrameHost.exe window (such as Windows 10 Settings, Photos, Mail)

I have tried WinHide but it only hides the window and the taskbar icon remains.
Before WinHide
After WinHide
Here's my code:
WinHide, ahk_class ApplicationFrameWindow ahk_exe ApplicationFrameHost.exe, Settings
MsgBox, Hidden but the taskbar icon remains
WinShow, ahk_class ApplicationFrameWindow ahk_exe ApplicationFrameHost.exe, Settings
MsgBox, Shown

How to enable the maximize button in the gui?

When i create a GUI her maximize button is grayed out/disabled, how can i enable it?
Example:
Gui, Add, Button, w100 h30, Button
Gui, Show, w400 h300
I was reading the docs and found this parameter Maximize: Maximizes and activates the window.
It does maximize the GUI as soon its launched:
Gui, Show, Maximize w400 h300
However, i would like to enable maximizing/restoring upon clicking the maximize button.
You need to add the flag +Resize
From docs:
Resize: Makes the window resizable and enables its maximize button in the title bar. To avoid enabling the maximize button, specify +Resize -MaximizeBox.

Cant move gui after removing her 'caption'

Maybe someone knows if it is possible to move GUI while -caption is enabled?
Since the toolbar is removed with GUI -caption, now I can not move GUI with the mouse.
All that is necessary to add to your scripts is the OnMessage line and the WM_LBUTTON function in the script below to allow you to move the GUI:
OnMessage(0x0201, "WM_LBUTTONDOWN")
Gui, -Caption
Gui, Show, w500 h200
return
WM_LBUTTONDOWN() {
PostMessage, 0xA1, 2,,, A
}
Esc::ExitApp

Make borderless window behaves alwaysontop [Autohotkey]

I want to create a borderless window, but alwaysontop didn't work if the window is borderless, how to make borderless window behave alwaysontop ?
gui, Tool: add, button, x0 y0 h20 w140 gxub, TOOLS
gui, Tool: show, w150, TOOLS
WinGet, id1, ID, A ; GET ahk_id of active window
WinSet, Style, -0xC00000, A ; hide title bar
Winset, Alwaysontop, ON, ahk_id %id1%
Adding one line on the top will satisfy your need
gui, +alwaysontop

GUI Buttons creating text 4 times

I am trying to create my 1st GUI. I just started using AHK today and for the most part have found it very simple to use. I am stuck on one thing though. I created this GUI to display buttons and then depending on what is selected certain text will be typed. When I select the button it is typing the correct text, but it is typing it four times. I have taken off one of the buttons, so there were only three, but it would still type it four times. What do I need to do to make sure it only types it once?
MyGUI:
#SingleInstance Force
Gui, +LastFound +AlwaysOnTop
GUI, Add, Button, x10 y10 w75 h25 gClick1, Button &1
GUI, Add, Button, x95 y10 w75 h25 gClick2, Button &2
GUI, Add, Button, x10 y45 w75 h25 gClick3, ButtonS &3
GUI, Add, Button, x95 y45 w75 h25 gClickCancel, &Cancel
GUI, Show, w200 h100,My GUI
Return
Click1:
Send The first button was selected
Gui Hide
Return
Click2:
Send The second button was selected
Gui Hide
Return
Click3:
Send The third button was selected
Gui Hide
Return
ClickCancel:
Send The cancel button was selected
Gui Hide
Return
I have not tested it yet, but it could be that your send is initiating this. remember that you first send a keyboard sequence and then hide the GUI, so in your situation the GUI is still active at the moment you send! Try to first hide the GUI and then send or initially replace send by MsgBox to test. You could also first send an !{Esc} to switch the focus back to the previous application before sending your data, That way you don't need to hide the GUI.
OK just tested my assumptions, add the !{Esc} and it works as expected.
#SingleInstance Force
Gui, +LastFound +AlwaysOnTop
GUI, Add, Button, x10 y10 w75 h25 gClick1, Button &1
GUI, Add, Button, x95 y10 w75 h25 gClick2, Button &2
GUI, Add, Button, x10 y45 w75 h25 gClick3, ButtonS &3
GUI, Add, Button, x95 y45 w75 h25 gClickCancel, &Cancel
GUI, Show, w200 h100,My GUI
Return
Click1:
Send, !{Esc}
Send, The first button was selected
;Gui Hide
Return
Click2:
Send, !{Esc}
MsgBox, The second button was selected
;Gui Hide
Return
Click3:
Send, !{Esc}
MsgBox, The third button was selected
;Gui Hide
Return
ClickCancel:
Send, !{Esc}
MsgBox, The cancel button was selected
;Gui Hide
Return