How to enable the maximize button in the gui? - autohotkey

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.

Related

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

Multiple keystrokes as autohotkey shortcut

I'm new to AutoHotkey.
I have a specfic need to be achieved in Powerpoint using autohotkey.
Let's say in Powerpoint, I want to change font color.
The normal steps are:
Select the text
Click "Home" > Click "Font Color" > The Font palette gets expanded and I select the color.
Now, I want to make this process quicker as below
Select the text
Press FC (as shortcut from keyboard) and autohotkey should press the following keys Alt+H+FC (Very importantly, if I don't press C immediately after F, then it should get typed as replaced text of highlighted text)
So, my code goes as like this
#SingleInstance, Force
#IfWinActive ahk_exe POWERPNT.EXE ; check whether ppt is the active window
f::
#if keypress c
send, !HFC
#if
return
But, this doesn't work.
I don't where am I making mistake. Could someone help, please
I know this is an autohotkey question, but the quick access toolbar (QAT) in PowerPoint may solve your problem out of the box.
The QAT assigns Alt+1 to the first feature, alt+2 to the second, etc. By customizing the order of buttons on the QAT, you can access features you use often with one key combination.
Instructions
First add the font color button to the QAT: right click the 'font color' button, and click 'add to quick access toolbar'
Change the order of features in the QAT: right click on the QAT - customize quick access toolbar). Use the arrow buttons on the right side to change the ordering.
This is the order I use myself:
This allows me to very quickly align objects on a slide, change background color, outline, and text color, all initiated from the keyboard.

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

accessible, but out of tabstop sequence

Is there a way to get an edit control accessible, but out of the tabstop sequence? Eg I have
Gui, Add, Text, &a
Gui, Add, Edit, -Tabstop ReadOnly
I cannot tab to it (which is good) but i also cannot use alt-a to reach it nor can I reach it by mouse clicking it. This is a problem as the user cannot scroll and peruse its contents.
If one changes the - to a + one can reach it by tabs and alt-a. However I do not want it to be in the tabstop sequence. From the "GUI Styles" page of the AutoHotkey Help/manual these appear to be the only relevant styles for an edit command...
How can I have that control reachable, but outside the tab sequence?
If you turn Alt-a into a hotkey, this is how you get the requested result
Gui, Add, Text, ,&a
Gui, Add, Edit, -Tabstop Readonly vMyEdit, My Content
Gui, Add, Edit
Gui, Show
return
!a::
GuiControl,focus, MyEdit
return

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