jimmer Posted October 23, 2005 Share Posted October 23, 2005 I would like autoit to display text on top of all my windows. Lets say... the middle of the screen, no matter what window I'm in, the text should still be floating in the middle of the screen. I'm not sure if this is possible, if my wording is just very bad, or if this is just the wrong forum section? if it is, sorry thx in advanced if anyone can help me p.s. I stopped using autoit for a few months, so I am very - very rusty. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 23, 2005 Moderators Share Posted October 23, 2005 Take a look at quaizzywabbit's AnyGUI , or do a search for it. This may be what your looking for... Good Luck and welcome back! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
BigDod Posted October 23, 2005 Share Posted October 23, 2005 I don't know if it is something like this you want #include <GuiConstants.au3> GuiCreate("My message box", 400, 78,(@DesktopWidth-400)/2, (@DesktopHeight-78)/2, $WS_POPUP + $WS_DLGFRAME) WinSetTrans("My message box", "", 150) WinSetOnTop("My message box", "", 1) $Button_1 = GuiCtrlCreateButton("OK", 340, 20, 50, 30) $Label_2 = GuiCtrlCreateLabel("Here is some text", 20, 20, 300, 40) GUICtrlSetFont($Label_2, 24) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $Button_1 ExitLoop EndSelect WEnd Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
GaryFrost Posted October 23, 2005 Share Posted October 23, 2005 (edited) This requires beta, you create a bitmap of your text, and you can set a transparent color Example bitmap included with example. Edit: see my post below for source and example Edited October 23, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
jimmer Posted October 23, 2005 Author Share Posted October 23, 2005 #include <GuiConstants.au3>GuiCreate("My message box", 400, 78,(@DesktopWidth-400)/2, (@DesktopHeight-78)/2, $WS_POPUP + $WS_DLGFRAME)WinSetTrans("My message box", "", 150)WinSetOnTop("My message box", "", 1)$Button_1 = GuiCtrlCreateButton("OK", 340, 20, 50, 30)$Label_2 = GuiCtrlCreateLabel("Here is some text", 20, 20, 300, 40)GUICtrlSetFont($Label_2, 24)GuiSetState()While 1 $msg = GuiGetMsg() Select Case $msg = $Button_1 ExitLoop EndSelectWEndThat is somewhat what I am looking for, I would prefer if there wasn't a box, if possible?I attached an image to give an example of what I hope to achieve-thanks Link to comment Share on other sites More sharing options...
GaryFrost Posted October 23, 2005 Share Posted October 23, 2005 Here's an example like the one I did above, only it is a number bmp GaryTransparent.zip SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
jimmer Posted October 23, 2005 Author Share Posted October 23, 2005 thanks Link to comment Share on other sites More sharing options...
/dev/null Posted October 23, 2005 Share Posted October 23, 2005 I would like autoit to display text on top of all my windows. Lets say... the middle of the screen, no matter what window I'm in, the text should still be floating in the middle of the screen.I'm not sure if this is possible, if my wording is just very bad, or if this is just the wrong forum section?if it is, sorrythx in advanced if anyone can help me p.s. I stopped using autoit for a few months, so I am very - very rusty.gafrost sent you already a brilliant example (i really like that one)! However, here are two more ways to do what you want, with AutoIT internal commands.From help file of SplashImageOn() and SplashTextOn():$destination = @Systemdir & "\oobe\images\mslogo.jpg" SplashImageOn("Splash Screen", $destination,250,50,default,default,1) Sleep(5000) SplashOff() SplashTextOn("Title", "Message goes here.", 200, 80, -1, -1, 1, "", 24) Sleep(5000) SplashOff()CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
GaryFrost Posted October 23, 2005 Share Posted October 23, 2005 gafrost sent you already a brilliant example (i really like that one)! However, here are two more ways to do what you want, with AutoIT internal commands.From help file of SplashImageOn() and SplashTextOn():$destination = @Systemdir & "\oobe\images\mslogo.jpg" SplashImageOn("Splash Screen", $destination,250,50,default,default,1) Sleep(5000) SplashOff() SplashTextOn("Title", "Message goes here.", 200, 80, -1, -1, 1, "", 24) Sleep(5000) SplashOff()CheersKurt need replace the default keywords unless your using the beta.@Kurt, don't think that what they are looking for, was wanting no box around the characters, but if they don't want to use beta, well..... Gary SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
greensky Posted November 20, 2005 Share Posted November 20, 2005 I need something similar to the code that gafrost posted above, but for displaying *text* instead of bitmaps. I mean, in my script, the text changes sometimes and is user-defined. gafrost, can you help me? Are there any Windows API functions for displaying text on top of everything -- without a box around the text -- or just a box with transparent background and no border -- so only the text shows? Please help! I need this very much. And all help is appreciated. Link to comment Share on other sites More sharing options...
AgentSmith15 Posted December 11, 2005 Share Posted December 11, 2005 Is there a way to instead of using .bmp to use .png? [center][/center] Link to comment Share on other sites More sharing options...
Zach Posted December 21, 2005 Share Posted December 21, 2005 Maybe I missed something - but wouldnt a tooltip do this? Link to comment Share on other sites More sharing options...
greensky Posted December 21, 2005 Share Posted December 21, 2005 Maybe I missed something - but wouldnt a tooltip do this?No. I think not. 'Cause I just want the text -- no background, i.e. transparent background, and no border. Link to comment Share on other sites More sharing options...
greensky Posted December 22, 2005 Share Posted December 22, 2005 Wow! Beautiful! Many, many, many thanks, Larry! Link to comment Share on other sites More sharing options...
PartyPooper Posted December 23, 2005 Share Posted December 23, 2005 Very nice piece of code Larry. Besides being very useful, it's helping me understand how to pass variables to and from functions (something I've yet to get my head around). Link to comment Share on other sites More sharing options...
Valuater Posted December 23, 2005 Share Posted December 23, 2005 Nice one Larry lots of work for a 3 second display.... but appreciated by many 8) Link to comment Share on other sites More sharing options...
PartyPooper Posted December 23, 2005 Share Posted December 23, 2005 Here's a slight mod that overlays the window on top of all other windows and it will remain active until closed. Still trying to work out why pressing ESC doesn't close the window though... expandcollapse popup#region -- Declarations ;****************************************************************************** Dim $Text = "Larry Rocks!" Dim $Width = 600 Dim $Height = 40 Dim $Xposn = 10 Dim $Yposn = @DesktopHeight - 75 Dim $Color = "0xFF0000" Dim $Font = "Microsoft Sans Serif" Dim $FontWeight = 1000 Dim $Title = "Overlayed Window" Dim $GUI ;****************************************************************************** #endregion #region -- Includes ;****************************************************************************** #include <GUIConstants.au3> ;****************************************************************************** #endregion #region -- Processor Instructions ;****************************************************************************** ;#NoTrayIcon opt("GUIOnEventMode", 1) opt("MustDeclareVars", 1) opt("GUICloseOnESC", 1) opt("RunErrorsFatal", 0) ;****************************************************************************** #endregion #region -- Script Loop ;****************************************************************************** MainGUI() Do Sleep(250) Until 0 ;****************************************************************************** #endregion #region -- MainGUI() ;****************************************************************************** Func MainGUI() TextWindow($Title, $Text, $Width, $Height, $Font, $FontWeight, $Xposn, $Yposn, $Color) GUISetState(@SW_SHOW) EndFunc ;****************************************************************************** #endregion #region -- TextWindow() ;****************************************************************************** Func TextWindow($zTitle, $zText, $zWidth, $zHeight, $zFont, $zWeight, $zHorizontal, $zVertical, $zColor) Local Const $ANSI_CHARSET = 0 Local Const $OUT_CHARACTER_PRECIS = 2 Local Const $CLIP_DEFAULT_PRECIS = 0 Local Const $PROOF_QUALITY = 2 Local Const $FIXED_PITCH = 1 Local Const $RGN_XOR = 3 $GUI = GUICreate($zTitle, $zWidth, $zHeight, $zHorizontal, $zVertical, $WS_POPUPWINDOW, BitOR($WS_EX_APPWINDOW, $WS_EX_TOPMOST)) GUISetBkColor($zColor) Local $hDC = DllCall("user32.dll", "int", "GetDC", "hwnd", $GUI) Local $hMyFont = DllCall("gdi32.dll", "hwnd", "CreateFont", "int", $zHeight, _ "int", 0, "int", 0, "int", 0, "int", $zWeight, "int", 0, _ "int", 0, "int", 0, "int", $ANSI_CHARSET, _ "int", $OUT_CHARACTER_PRECIS, "int", $CLIP_DEFAULT_PRECIS, _ "int", $PROOF_QUALITY, "int", $FIXED_PITCH, "str", $zFont) Local $hOldFont = DllCall("gdi32.dll", "hwnd", "SelectObject", "int", $hDC[0], _ "hwnd", $hMyFont[0]) DllCall("gdi32.dll", "int", "BeginPath", "int", $hDC[0]) DllCall("gdi32.dll", "int", "TextOut", "int", $hDC[0], "int", 0, "int", 0, _ "str", $zText, "int", StringLen($zText)) DllCall("gdi32.dll", "int", "EndPath", "int", $hDC[0]) Local $hRgn1 = DllCall("gdi32.dll", "hwnd", "PathToRegion", "int", $hDC[0]) Local $rc = DllStructCreate("int;int;int;int") DllCall("gdi32.dll", "int", "GetRgnBox", "hwnd", $hRgn1[0], _ "ptr", DllStructGetPtr($rc)) Local $hRgn2 = DllCall("gdi32.dll", "hwnd", "CreateRectRgnIndirect", _ "ptr", DllStructGetPtr($rc)) DllCall("gdi32.dll", "int", "CombineRgn", "hwnd", $hRgn2[0], "hwnd", $hRgn2[0], _ "hwnd", $hRgn1[0], "int", $RGN_XOR) DllCall("gdi32.dll", "int", "DeleteObject", "hwnd", $hRgn1[0]) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $GUI, "int", $hDC[0]) DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $GUI, "hwnd", $hRgn2[0], "int", 1) DllCall("gdi32.dll", "int", "SelectObject", "int", $hDC[0], "hwnd", $hOldFont[0]) Return $GUI EndFunc ;****************************************************************************** #endregion #region -- OnExit() ;****************************************************************************** Func OnExit() If @GUI_WinHandle = $GUI Then Exit EndFunc ;****************************************************************************** #endregion Link to comment Share on other sites More sharing options...
GaryFrost Posted December 23, 2005 Share Posted December 23, 2005 (edited) some minor modifications, added the consts that can be used, showed use of italics and underline etc... expandcollapse popup#region -- Declarations ;****************************************************************************** Dim $Text = "Larry Rocks!" Dim $Height = 50 Dim $Width = $Height * 6; depends on the font used Dim $Xposn = (@DesktopWidth / 2) - ($Width / 2) Dim $Yposn = -1 Dim $Color = "0x00008B" ;~ Dim $Font = "Microsoft Sans Serif" Dim $Font = "Times New Roman" Dim $FontWeight = 1000 Dim $Title = "AutoIt Overlayed Window" Dim $GUI, $msg ;****************************************************************************** #endregion #region -- Includes ;****************************************************************************** #include <GUIConstants.au3> ;****************************************************************************** #endregion #region -- Processor Instructions ;****************************************************************************** ;#NoTrayIcon opt("MustDeclareVars", 1) opt("RunErrorsFatal", 0) ;****************************************************************************** #endregion #region -- Script Loop ;****************************************************************************** MainGUI() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd ;****************************************************************************** #endregion #region -- MainGUI() ;****************************************************************************** Func MainGUI() TextWindow($Title, $Text, $Width, $Height, $Font, $FontWeight, $Xposn, $Yposn, $Color) GUISetState(@SW_SHOW) EndFunc ;==>MainGUI ;****************************************************************************** #endregion #region -- TextWindow() ;****************************************************************************** Func TextWindow($zTitle, $zText, $zWidth, $zHeight, $zFont, $zWeight, $zHorizontal, $zVertical, $zColor) Local Const $Use_Italic = 1 Local Const $Use_Underline = 1 Local Const $Use_StrikeOut = 0 Local Const $ANSI_CHARSET = 0 Local Const $BALTIC_CHARSET = 186 Local Const $CHINESEBIG5_CHARSET = 136 Local Const $DEFAULT_CHARSET = 1 Local Const $EASTEUROPE_CHARSET = 238 Local Const $GB2312_CHARSET = 134 Local Const $GREEK_CHARSET = 161 Local Const $HANGUL_CHARSET = 129 Local Const $MAC_CHARSET = 77 Local Const $OEM_CHARSET = 255 Local Const $RUSSIAN_CHARSET = 204 Local Const $SHIFTJIS_CHARSET = 128 Local Const $SYMBOL_CHARSET = 2 Local Const $TURKISH_CHARSET = 162 Local Const $VIETNAMESE_CHARSET = 163 Local Const $JOHAB_CHARSET = 130 Local Const $ARABIC_CHARSET = 178 Local Const $HEBREW_CHARSET = 177 Local Const $THAI_CHARSET = 222 Local Const $OUT_CHARACTER_PRECIS = 2; Not used. Local Const $OUT_DEFAULT_PRECIS = 0; Specifies the default font mapper behavior. Local Const $OUT_DEVICE_PRECIS = 5; Instructs the font mapper to choose a Device font when the system contains multiple fonts with the same name. Local Const $OUT_OUTLINE_PRECIS = 8; Windows NT/2000/XP: This value instructs the font mapper to choose from TrueType and other outline-based fonts. Local Const $OUT_PS_ONLY_PRECIS = 10; Windows 2000/XP: Instructs the font mapper to choose from only PostScript fonts. If there are no PostScript fonts installed in the system, the font mapper returns to default behavior. Local Const $OUT_RASTER_PRECIS = 6; Instructs the font mapper to choose a raster font when the system contains multiple fonts with the same name. Local Const $OUT_STRING_PRECIS = 1; This value is not used by the font mapper, but it is returned when raster fonts are enumerated. Local Const $OUT_STROKE_PRECIS = 3; Windows NT/2000/XP: This value is not used by the font mapper, but it is returned when TrueType, other outline-based fonts, and vector fonts are enumerated. ; Windows 95/98/Me: This value is used to map vector fonts, and is returned when TrueType or vector fonts are enumerated. Local Const $OUT_TT_ONLY_PRECIS = 7; Instructs the font mapper to choose from only TrueType fonts. If there are no TrueType fonts installed in the system, the font mapper returns to default behavior. Local Const $OUT_TT_PRECIS = 4; Instructs the font mapper to choose a TrueType font when the system contains multiple fonts with the same name. Local Const $CLIP_CHARACTER_PRECIS = 1; Not used. Local Const $CLIP_DEFAULT_PRECIS = 0; Specifies default clipping behavior. Local Const $CLIP_EMBEDDED = 128; You must specify this flag to use an embedded read-only font. Local Const $CLIP_LH_ANGLES = 16; When this value is used, the rotation for all fonts depends on whether the orientation of the coordinate system is left-handed or right-handed. ; If not used, device fonts always rotate counterclockwise, but the rotation of other fonts is dependent on the orientation of the coordinate system. Local Const $CLIP_MASK = 0xF; Not used. Local Const $CLIP_STROKE_PRECIS = 2; Not used by the font mapper, but is returned when raster, vector, or TrueType fonts are enumerated. ; Windows NT/2000/XP: For compatibility, this value is always returned when enumerating fonts. Local Const $CLIP_TT_ALWAYS = 32; Not used. Local Const $ANTIALIASED_QUALITY = 4; Windows NT 4.0 and later: Font is antialiased, or smoothed, if the font supports it and the size of the font is not too small or too large. ; Windows 95 with Plus!, Windows 98/Me: The display must greater than 8-bit color, it must be a single plane device, it cannot be a palette display, and it cannot be in a multiple display monitor setup. In addition, you must select a TrueType font into a screen DC prior to using it in a DIBSection, otherwise antialiasing does not happen. Local Const $CLEAR_RN_PENDING = 0x20; Windows XP: If set, text is rendered (when possible) using ClearType antialiasing method. See Remarks for more information. Local Const $DEFAULT_QUALITY = 0; Appearance of the font does not matter. Local Const $DRAFT_QUALITY = 1; Appearance of the font is less important than when the PROOF_QUALITY value is used. For GDI raster fonts, scaling is enabled, which means that more font sizes are available, but the quality may be lower. Bold, italic, underline, and strikeout fonts are synthesized, if necessary. Local Const $NONANTIALIASED_QUALITY = 3; Windows 95 with Plus!, Windows 98/Me, Windows NT 4.0 and later: Font is never antialiased, that is, font smoothing is not done. Local Const $PROOF_QUALITY = 2; Character quality of the font is more important than exact matching of the logical-font attributes. For GDI raster fonts, scaling is disabled and the font closest in size is chosen. Although the chosen font size may not be mapped exactly when PROOF_QUALITY is used, the quality of the font is high and there is no distortion of appearance. Bold, italic, underline, and strikeout fonts are synthesized, if necessary. ; low order bits Local Const $DEFAULT_PITCH = 0 Local Const $FIXED_PITCH = 1 Local Const $VARIABLE_PITCH = 2 ; high order bits Local Const $FF_DECORATIVE = 80 Local Const $FF_DONTCARE = 0 Local Const $FF_MODERN = 48 Local Const $FF_ROMAN = 16 Local Const $FF_SCRIPT = 64 Local Const $FF_SWISS = 32 Local Const $RGN_XOR = 3 $GUI = GUICreate($zTitle, $zWidth, $zHeight, $zHorizontal, $zVertical, $WS_POPUPWINDOW, BitOR($WS_EX_APPWINDOW, $WS_EX_TOPMOST)) GUISetBkColor($zColor) Local $hDC = DllCall("user32.dll", "int", "GetDC", "hwnd", $GUI) Local $hMyFont = DllCall("gdi32.dll", "hwnd", "CreateFont", "int", $zHeight, _ "int", 0, "int", 0, "int", 0, "int", $zWeight, "int", $Use_Italic, _ "int", $Use_Underline, "int", $Use_StrikeOut, "int", $DEFAULT_CHARSET, _ "int", $OUT_DEVICE_PRECIS, "int", $CLIP_DEFAULT_PRECIS, _ "int", $PROOF_QUALITY, "int", $FF_DONTCARE * 65535 + $DEFAULT_PITCH, "str", $zFont) Local $hOldFont = DllCall("gdi32.dll", "hwnd", "SelectObject", "int", $hDC[0], _ "hwnd", $hMyFont[0]) DllCall("gdi32.dll", "int", "BeginPath", "int", $hDC[0]) DllCall("gdi32.dll", "int", "TextOut", "int", $hDC[0], "int", 0, "int", 0, _ "str", $zText, "int", StringLen($zText)) DllCall("gdi32.dll", "int", "EndPath", "int", $hDC[0]) Local $hRgn1 = DllCall("gdi32.dll", "hwnd", "PathToRegion", "int", $hDC[0]) Local $rc = DllStructCreate("int;int;int;int") DllCall("gdi32.dll", "int", "GetRgnBox", "hwnd", $hRgn1[0], _ "ptr", DllStructGetPtr($rc)) Local $hRgn2 = DllCall("gdi32.dll", "hwnd", "CreateRectRgnIndirect", _ "ptr", DllStructGetPtr($rc)) DllCall("gdi32.dll", "int", "CombineRgn", "hwnd", $hRgn2[0], "hwnd", $hRgn2[0], _ "hwnd", $hRgn1[0], "int", $RGN_XOR) DllCall("gdi32.dll", "int", "DeleteObject", "hwnd", $hRgn1[0]) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $GUI, "int", $hDC[0]) DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $GUI, "hwnd", $hRgn2[0], "int", 1) DllCall("gdi32.dll", "int", "SelectObject", "int", $hDC[0], "hwnd", $hOldFont[0]) Return $GUI EndFunc ;==>TextWindow ;****************************************************************************** #endregion #region -- OnExit() ;****************************************************************************** Func OnExit() If @GUI_WinHandle = $GUI Then Exit EndFunc ;==>OnExit ;****************************************************************************** #endregion Edited December 23, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
thefluxster Posted December 29, 2005 Share Posted December 29, 2005 Maybe I'm just thinking a little narrow mindedly, but what would the use of this type of script be? I'm big into automation and all, don't get me wrong, but I'm having difficulty seeing the value of this bit of code. BTW, Larry, AMAZING, truly amazing. “Efficiency is doing things right; effectiveness is doing the right things.”-Peter F. Drucker Link to comment Share on other sites More sharing options...
PartyPooper Posted December 30, 2005 Share Posted December 30, 2005 I can think of heaps of uses, for example: - you can have it unobtrusively display on your desktop, the number of logins from your web site, - you can use it as a desktop reminder eg. "Keep out of the fridge you fat bastard" - you can have it display important information from another application while working in full screen mode The list is endless. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now