the font should be big enough to see from 2 meters away etc..
![Image](https://i.imgur.com/jLLlogH.png)
can anyone help me with the code for the GUI to show that text?
Code: Select all
Gui,3: -dpiscale
Gui,3: Color, Black,Black
SS_REALSIZECONTROL := 0x40
wa:=A_screenwidth,ha:=A_screenHeight,xx=100
GUI,3:Font,s128 cWhite,Lucida Console
;----- REC-Button --
x:=(wa*2)/xx,y:=(ha*7)/xx
Gui,3:add,text ,x%x% y%y% gA1,[
Gui,3:font,cRed
x:=(wa*5)/xx
Gui,3:add,text ,x%x% y%y% gA1,●
Gui,3:font,cWhite
x:=(wa*10)/xx
Gui,3:add,text ,x%x% y%y% gA1 ,REC]
;-------------------
GUI,3:Font,s12 cGray,Lucida Console
x:=(wa*2)/xx,y:=(ha*2)/xx
Gui,3:add,text ,x%x% y%y% ,Click Button
x:=(wa*1)/xx,y:=(ha*1)/xx,w:=(wa*40)/xx,h:=(ha*25)/xx
Gui,3:Show,x%x% y%y% w%w% h%h%,RECORD-BUTTON
return
;------------------------------------------
3Guiclose:
exitapp
;------------------------------------------
A1:
msgbox,Button-REC
return
;==========================================
Code: Select all
;-[img]https://i.imgur.com/GC3853x.png[/img]
;- how to create this text in a GUI
;- https://www.autohotkey.com/boards/viewtopic.php?f=76&t=78997
Gui,3: -dpiscale
Gui,3: Color, Black,Black
SS_REALSIZECONTROL := 0x40
wa:=A_screenwidth,ha:=A_screenHeight,xx=100
;------------
f1=%a_scriptdir%\recordbutton2.png
url:="https://i.imgur.com/GC3853x.png"
ifnotexist,%f1%
urldownloadtofile,%url%,%f1%
;------------
x:=(wa*2)/xx,y:=(ha*7)/xx,w:=(wa*30)/xx,h:=(ha*20)/xx
Gui,3:add,picture,x%x% y%y% w%w% h%h% gA1,%f1%
;------------
GUI,3:Font,s12 cGray,Lucida Console
x:=(wa*2)/xx,y:=(ha*2)/xx
Gui,3:add,text ,x%x% y%y% ,Click Picture
x:=(wa*1)/xx,y:=(ha*1)/xx,w:=(wa*40)/xx,h:=(ha*30)/xx
Gui,3:Show,x%x% y%y% w%w% h%h%,RECORD-BUTTON
return
;------------------------------------------
3Guiclose:
exitapp
;------------------------------------------
A1:
msgbox,Button-REC
return
;==========================================
Code: Select all
gui, +LastFound -Caption -Border +E0x08000000 +alwaysontop DPIScale ; +E0x08000000 to be set in conjunction with NoActivate
gui, Color, 808081
WinSet, TransColor, 808081
gui, Font,s75 Bold, arial
gui, Add, Text, x0 y38 cblack left, [ REC]
gui, Font,s135 Bold, arial
gui, Add, Text, x30 y-5 cred left, •
loop { ; replace the loop with "gui, show, NoActivate"
gui, show, % (toggle := !toggle) ? "NoActivate" : "hide"
sleep, 800
}
return
esc::
exitapp
awesome work, great job!flyingDman wrote: ↑24 Jul 2020, 14:19With transparency and on-off flashing. Change font coloring to white (or any other color):This also allows you to continue to access the underlying window while flashing...Code: Select all
gui, +LastFound -Caption -Border +E0x08000000 +alwaysontop DPIScale ; +E0x08000000 to be set in conjunction with NoActivate gui, Color, 808081 WinSet, TransColor, 808081 gui, Font,s75 Bold, arial gui, Add, Text, x0 y38 cblack left, [ REC] gui, Font,s135 Bold, arial gui, Add, Text, x30 y-5 cred left, • loop { ; replace the loop with "gui, show, NoActivate" gui, show, % (toggle := !toggle) ? "NoActivate" : "hide" sleep, 800 } return esc:: exitapp
Save script in UTF-8 with BOM.
Code: Select all
gui, show, % ((toggle := !toggle) ? "NoActivate" : "hide") . "x1500 y875" ;1920x1080 screen
Interesting idea about flashing the text, I didn't think of that..flyingDman wrote: ↑24 Jul 2020, 14:19With transparency and on-off flashing. Change font coloring to white (or any other color):This also allows you to continue to access the underlying window while flashing...Code: Select all
gui, +LastFound -Caption -Border +E0x08000000 +alwaysontop DPIScale ; +E0x08000000 to be set in conjunction with NoActivate gui, Color, 808081 WinSet, TransColor, 808081 gui, Font,s75 Bold, arial gui, Add, Text, x0 y38 cblack left, [ REC] gui, Font,s135 Bold, arial gui, Add, Text, x30 y-5 cred left, • loop { ; replace the loop with "gui, show, NoActivate" gui, show, % (toggle := !toggle) ? "NoActivate" : "hide" sleep, 800 } return esc:: exitapp
Save script in UTF-8 with BOM.
Code: Select all
gui, Color, 000000
;WinSet, TransColor, 000000
The screen resolution might differ, so a more dynamic method would be advised, like (untested):flyingDman wrote: ↑24 Jul 2020, 16:39Thanks @Maestr0 !
You might want to use it in the bottom right corner of your screen using:Also play with with DPIscale or -DPIscale and the space between "[" and "REC" depending on the font and the font size you use.Code: Select all
gui, show, % ((toggle := !toggle) ? "NoActivate" : "hide") . "x1500 y875" ;1920x1080 screen
Code: Select all
gui, show, % ((toggle := !toggle) ? "NoActivate" : "hide") . "x" . A_Screenwidth - 420 . " y" . A_Screenheight - 205
how do I change the size of the window when I make the back black?Maestr0 wrote: ↑16 Aug 2020, 04:16The screen resolution might differ, so a more dynamic method would be advised, like (untested):flyingDman wrote: ↑24 Jul 2020, 16:39Thanks @Maestr0 !
You might want to use it in the bottom right corner of your screen using:Also play with with DPIscale or -DPIscale and the space between "[" and "REC" depending on the font and the font size you use.Code: Select all
gui, show, % ((toggle := !toggle) ? "NoActivate" : "hide") . "x1500 y875" ;1920x1080 screen
Code: Select all
gui, show, % ((toggle := !toggle) ? "NoActivate" : "hide") . "x" . A_Screenwidth - 420 . " y" . A_Screenheight - 205
Code: Select all
Gui, -Caption +AlwaysOnTop +Owner +LastFound +E0x20 ;0x20 = WS_EX_CLICKTHROUGH
Gui, Margin, 10, 0
Gui, Color, 000000
GuiAddText("s75 , arial", "cWhite y-5" , "[ ]")
GuiAddText("s135 Bold, arial", "cRed xp+34 y-37" , "•")
GuiAddText("s60 Bold, arial", "cWhite x+3 yp+52", "REC")
Gui, Show, NoActivate h120 x10 y10
WinSet, Transparent, 200
SetTimer, ShowHideDot, 600
return
GuiAddText(Font, Options, Text) {
f := StrSplit(Font, ",", " ")
Gui, Font, % f[1], % f[2]
Gui, Add, Text, %Options%, %Text%
}
ShowHideDot() {
static toggle
GuiControl, % (toggle := !toggle) ? "Hide" : "Show", Static2
}
esc::exitapp
Wow this is the closest match to the real REC OSDtmplinshi wrote: ↑21 Aug 2020, 08:01Code: Select all
Gui, -Caption +AlwaysOnTop +Owner +LastFound +E0x20 ;0x20 = WS_EX_CLICKTHROUGH Gui, Margin, 10, 0 Gui, Color, 000000 GuiAddText("s75 , arial", "cWhite y-5" , "[ ]") GuiAddText("s135 Bold, arial", "cRed xp+34 y-37" , "•") GuiAddText("s60 Bold, arial", "cWhite x+3 yp+52", "REC") Gui, Show, NoActivate h120 x10 y10 WinSet, Transparent, 200 SetTimer, ShowHideDot, 600 return GuiAddText(Font, Options, Text) { f := StrSplit(Font, ",", " ") Gui, Font, % f[1], % f[2] Gui, Add, Text, %Options%, %Text% } ShowHideDot() { static toggle GuiControl, % (toggle := !toggle) ? "Hide" : "Show", Static2 } esc::exitapp
Code: Select all
Gui, -Caption +AlwaysOnTop +Owner +LastFound +E0x20 ;0x20 = WS_EX_CLICKTHROUGH
Gui, Margin, 8, 0
Gui, Color, 000000
GuiAddText("s75 , arial", "cWhite y-4" , "[ ]")
GuiAddText("s150 Bold, arial", "cRed xp+32 y-49" , "•")
GuiAddText("s60 Bold, arial", "cWhite x+1 yp+64", "REC")
Gui, Show, NoActivate h120
WinSet, Transparent, 200
SetTimer, ShowHideDot, 600
Sleep, 5000 ; disappear after 5 seconds
ExitApp
GuiAddText(Font, Options, Text) {
f := StrSplit(Font, ",", " ")
Gui, Font, % f[1], % f[2]
Gui, Add, Text, %Options%, %Text%
}
ShowHideDot() {
static toggle
GuiControl, % (toggle := !toggle) ? "Hide" : "Show", Static2
}
The script is working great (ie REC OSD is in the center and disappears after some seconds) however I encounter a major problemtmplinshi wrote: ↑22 Aug 2020, 22:58If you still feel something is not perfect, try to modify the font size and x y positions yourself.Code: Select all
Gui, -Caption +AlwaysOnTop +Owner +LastFound +E0x20 ;0x20 = WS_EX_CLICKTHROUGH Gui, Margin, 8, 0 Gui, Color, 000000 GuiAddText("s75 , arial", "cWhite y-4" , "[ ]") GuiAddText("s150 Bold, arial", "cRed xp+32 y-49" , "•") GuiAddText("s60 Bold, arial", "cWhite x+1 yp+64", "REC") Gui, Show, NoActivate h120 WinSet, Transparent, 200 SetTimer, ShowHideDot, 600 Sleep, 5000 ; disappear after 5 seconds ExitApp GuiAddText(Font, Options, Text) { f := StrSplit(Font, ",", " ") Gui, Font, % f[1], % f[2] Gui, Add, Text, %Options%, %Text% } ShowHideDot() { static toggle GuiControl, % (toggle := !toggle) ? "Hide" : "Show", Static2 }
![]()
Code: Select all
;PVR
;-------------------------
;Record TV
^r::
space::
Send, ^r
;YOUR CODE
Gui, -Caption +AlwaysOnTop +Owner +LastFound +E0x20 ;0x20 = WS_EX_CLICKTHROUGH
Gui, Margin, 8, 0
Gui, Color, 000000
GuiAddText("s75 , arial", "cWhite y-4" , "[ ]")
GuiAddText("s150 Bold, arial", "cRed xp+32 y-49" , "•")
GuiAddText("s60 Bold, arial", "cWhite x+1 yp+64", "REC")
Gui, Show, NoActivate h120
WinSet, Transparent, 200
SetTimer, ShowHideDot, 600
Sleep, 5000 ; disappear after 5 seconds
ExitApp
GuiAddText(Font, Options, Text) {
f := StrSplit(Font, ",", " ")
Gui, Font, % f[1], % f[2]
Gui, Add, Text, %Options%, %Text%
}
ShowHideDot() {
static toggle
GuiControl, % (toggle := !toggle) ? "Hide" : "Show", Static2
}
Send, {Enter}
return
Code: Select all
Sleep, 5000 ; disappear after 5 seconds
ExitApp
Code: Select all
Sleep, 5000 ; disappear after 5 seconds
SetTimer, ShowHideDot, Off
Gui, Destroy
Code: Select all
DisplayREC() ; Display 5 seconds, and wait..
DisplayREC(3, false) ; Display 3 seconds, and continue running the code below
MsgBox
return
DisplayREC(Seconds := 5, Wait := true)
{
static hGUI, toggle, dotHwnd
if hGUI
return
Gui, New, -Caption +AlwaysOnTop +Owner +LastFound +HWNDhGUI +E0x20 ;0x20 = WS_EX_CLICKTHROUGH
Gui, Margin, 8, 0
Gui, Color, 000000
Gui, Font, s75, arial
Gui, Add, Text, cWhite y-4, [ ]
Gui, Font, s150 Bold, arial
Gui, Add, Text, cRed xp+32 y-49 HWNDdotHwnd, •
Gui, Font, s60 Bold, arial
Gui, Add, Text, cWhite x+1 yp+64, REC
Gui, Show, NoActivate h120
WinSet, Transparent, 200
SetTimer, ShowHideDot , 600
SetTimer, StopDisplayREC, % -1 * Seconds * 1000
if Wait
WinWaitClose, ahk_id %hGUI%
Return
ShowHideDot:
GuiControl, % (toggle := !toggle) ? "Hide" : "Show", %dotHwnd%
Return
StopDisplayREC:
SetTimer, ShowHideDot, Delete
SetTimer,, Delete
Gui, %hGUI%:Destroy
hGUI := toggle := dotHwnd := ""
Return
}
thanks for function as well as the fixed code...tmplinshi wrote: ↑23 Aug 2020, 06:31Change it to:Or use this function instead:Code: Select all
Sleep, 5000 ; disappear after 5 seconds SetTimer, ShowHideDot, Off Gui, Destroy
Code: Select all
DisplayREC() ; Display 5 seconds, and wait.. DisplayREC(3, false) ; Display 3 seconds, and continue running the code below MsgBox return DisplayREC(Seconds := 5, Wait := true) { static hGUI, toggle, dotHwnd if hGUI return Gui, New, -Caption +AlwaysOnTop +Owner +LastFound +HWNDhGUI +E0x20 ;0x20 = WS_EX_CLICKTHROUGH Gui, Margin, 8, 0 Gui, Color, 000000 Gui, Font, s75, arial Gui, Add, Text, cWhite y-4, [ ] Gui, Font, s150 Bold, arial Gui, Add, Text, cRed xp+32 y-49 HWNDdotHwnd, • Gui, Font, s60 Bold, arial Gui, Add, Text, cWhite x+1 yp+64, REC Gui, Show, NoActivate h120 WinSet, Transparent, 200 SetTimer, ShowHideDot , 600 SetTimer, StopDisplayREC, % -1 * Seconds * 1000 if Wait WinWaitClose, ahk_id %hGUI% Return ShowHideDot: GuiControl, % (toggle := !toggle) ? "Hide" : "Show", %dotHwnd% Return StopDisplayREC: SetTimer, ShowHideDot, Delete SetTimer,, Delete Gui, %hGUI%:Destroy hGUI := toggle := dotHwnd := "" Return }
Code: Select all
Gui, Add, Text, cWhite y-4, [ ]
Gui, Font, s150 Bold, arial
Gui, Add, Text, cRed xp+32 y-49 HWNDdotHwnd, •
Gui, Font, s60 Bold, arial
Gui, Add, Text, cWhite x+1 yp+64, REC
Code: Select all
Gui, Font, s40, arial
Gui, Add, Text, x+30 cBlue, % Chr(0x23EE)
Gui, Add, Text, x+30 cBlue, ⏮
Gui, Font, s40, webdings ; Change font to webdings
Gui, Add, Text, x+30 cRed, 9
Gui, Add, Text, x+30 cRed, % Chr(0x39) ; Same character as above
Gui, Show
Simple example:How would you make a function that can accept as input e.g. Media_KEY_OSD (TEXT, symbol)
Code: Select all
Media_KEY_OSD(TEXT, symbol) {
Gui, Font, s40, arial
Gui, Add, Text, , %TEXT%
Gui, Font, s50, webdings ; Change font to webdings
Gui, Add, Text, x+10, %symbol%
Gui, Show
}
Media_KEY_OSD("PLAY", "4")
; Media_KEY_OSD("PLAY", Chr(0x34))
; Media_KEY_OSD("media symbols:", "4;<789:")
See https://www.autohotkey.com/docs/commands/Gui.htm#PosSizeWhat is it mean xp+32?
What is the original X, Y position in your script?
see https://www.autohotkey.com/docs/Variables.htm#date, for example:can you add a time code (like a stopwatch) and current date/time on the screen that appears when the REC OSD is showing on the screen?
Code: Select all
Gui, Add, Text, vDT, %A_Min%:%A_Sec%
Gui, Show, w400 h100
SetTimer, UpdateDateTime, 1000 ; Update every second
return
UpdateDateTime:
GuiControl,, DT, %A_Min%:%A_Sec%
Return
It's just two examples. Try to read the comments and run it again to see the difference.What is the purpose of calling the displayREC function twice and the msgBox?
Users browsing this forum: Google [Bot], Marium0505, mcl and 358 guests