SmartAlert(Title, Message) {
global intellij_id
WinGetPos, iX, iY, iW, iH, ahk_id %intellij_id%
; 1. Configuration
BoxWidth := 800 ; You can change this to any size now
ButtonWidth := 100 ; Slightly wider button for the bigger box
; 2. Centering Math
; Calculate horizontal center for the box on screen
PosX := iX + (iW / 2) - (BoxWidth / 2)
PosY := iY + (iH / 2) - 100
; Calculate horizontal center for the button inside the box
; Formula: (BoxWidth / 2) - (ButtonWidth / 2)
BtnX := (BoxWidth / 2) - (ButtonWidth / 2)
; 3. Build the GUI
Gui, Alert: +AlwaysOnTop -MinimizeBox +HwndAlertHwnd
Gui, Alert: Color, White
Gui, Alert: Font, s14 w700, Segoe UI ; Increased font size for the wider box
; The Text
Gui, Alert: Add, Text, Center w%BoxWidth%, %Message%
; The Button (Now using the calculated BtnX)
Gui, Alert: Font, s10 w400
Gui, Alert: Add, Button, gCloseAlert Default Center w%ButtonWidth% x%BtnX% y+25, OK
; 4. Show it
Gui, Alert: Show, x%PosX% y%PosY% w%BoxWidth%, %Title%
WinWaitClose, ahk_id %AlertHwnd%
return
CloseAlert:
Gui, Alert: Destroy
return
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)