I just want to show a simple square, possibly transparent, of my size, my location , with my text inside of it. Can you give me a simple code snippet illustrates how to do this?
thanks.
simple square of my size, my location with my text
-
- Posts: 7
- Joined: 08 Dec 2021, 05:52
Re: simple square of my size, my location with my text
Code: Select all
square1 := square(100, 100, 200, "Yellow", "My text" , 20, 150)
square2 := square(500, 500, 100, "Red" , "Red square", 10)
square(x, y, boxEdge, color, text, fontSize, transparency := 255) { ; Show a colored square with text
; https://www.autohotkey.com/boards/viewtopic.php?p=433517#p433517
textY := (boxEdge - fontSize * A_ScreenDPI / 72) / 2
Gui, New, -Caption -Border +LastFound +HwndhWnd
Gui, Font, s%fontSize%
Gui, Margin, 0, 0
Gui, Add, Progress, w%boxEdge% h%boxEdge% c%color%, 100
Gui, Add, Text , xm y%textY% wp BackgroundTrans Center, %text%
Gui, Show, x%x% y%y%, Square
WinSet, Transparent, %transparency%
Return hWnd
}
-
- Posts: 7
- Joined: 08 Dec 2021, 05:52
Re: simple square of my size, my location with my text
Can I make it without ?
mikeyww wrote: ↑08 Dec 2021, 06:32Code: Select all
square1 := square(100, 100, 200, "Yellow", "My text" , 20, 150) square2 := square(500, 500, 100, "Red" , "Red square", 10) square(x, y, boxEdge, color, text, fontSize, transparency := 255) { ; Show a colored square with text ; https://www.autohotkey.com/boards/viewtopic.php?p=433517#p433517 textY := (boxEdge - fontSize * A_ScreenDPI / 72) / 2 Gui, New, -Caption -Border +LastFound +HwndhWnd Gui, Font, s%fontSize% Gui, Margin, 0, 0 Gui, Add, Progress, w%boxEdge% h%boxEdge% c%color%, 100 Gui, Add, Text , xm y%textY% wp BackgroundTrans Center, %text% Gui, Show, x%x% y%y%, Square WinSet, Transparent, %transparency% Return hWnd }
-
- Posts: 7
- Joined: 08 Dec 2021, 05:52
Re: simple square of my size, my location with my text
i Want different sqaures show at the same time. How Can i do that?
mikeyww wrote: ↑08 Dec 2021, 06:32Code: Select all
square1 := square(100, 100, 200, "Yellow", "My text" , 20, 150) square2 := square(500, 500, 100, "Red" , "Red square", 10) square(x, y, boxEdge, color, text, fontSize, transparency := 255) { ; Show a colored square with text ; https://www.autohotkey.com/boards/viewtopic.php?p=433517#p433517 textY := (boxEdge - fontSize * A_ScreenDPI / 72) / 2 Gui, New, -Caption -Border +LastFound +HwndhWnd Gui, Font, s%fontSize% Gui, Margin, 0, 0 Gui, Add, Progress, w%boxEdge% h%boxEdge% c%color%, 100 Gui, Add, Text , xm y%textY% wp BackgroundTrans Center, %text% Gui, Show, x%x% y%y%, Square WinSet, Transparent, %transparency% Return hWnd }
Re: simple square of my size, my location with my text
Try running this script by itself as a first step.
Code: Select all
square1 := square(100, 100, 200, "Yellow", "My text" , 20, 150)
square2 := square(500, 500, 100, "Red" , "Red square", 10)
square(x, y, boxEdge, color, text, fontSize, transparency := 255) { ; Show a colored square with text
; https://www.autohotkey.com/boards/viewtopic.php?p=433517#p433517
textY := (boxEdge - fontSize * A_ScreenDPI / 72) / 2
Gui, New, -Caption -Border +LastFound +HwndhWnd +Owner
Gui, Font, s%fontSize%
Gui, Margin, 0, 0
Gui, Add, Progress, w%boxEdge% h%boxEdge% c%color%, 100
Gui, Add, Text , xm y%textY% wp BackgroundTrans Center, %text%
Gui, Show, x%x% y%y%, Square
WinSet, Transparent, %transparency%
Return hWnd
}
-
- Posts: 7
- Joined: 08 Dec 2021, 05:52
Re: simple square of my size, my location with my text
In that case, If I add more and more squares, than the former squares appear fisrt. For example square1 apperas first than square2
Re: simple square of my size, my location with my text
You can change the order to be whatever you want. What the script does: "i Want different sqaures show at the same time."
Who is online
Users browsing this forum: No registered users and 128 guests