Hemrry Posted April 12, 2020 Share Posted April 12, 2020 (edited) Buenas soy nuevo con Autoit mi proyecto es crear una venta de Ping Flotante que este transparente solo el fondo y que el Ping permanezca completamente Visible la intención es crear una venta Fija y que solo varié el Ping sin que parpadee la Vetana completa. Ok realice dos pruebas que seria Hi, I am new with Autoit. My project is to create a Floating Ping GUI that has a transparent background and that the Ping remains completely visible. The intention is to create a fixed window and that only the Ping changes without blinking the entire GUI. Ok. I have made two tests that would be: HotKeySet("{ESC}", "Terminate") While 1 WinSetTrans("Medidor", "", 100) Local $iPing = Ping("www.google.es", "") SplashTextOn("Medidor", $iPing & "ms." , 80, 40, 422, 17, 1+2+16,"Comic Sans MS","10") WinSetTrans("Medidor", "", 100) Sleep(100) WEnd Func Terminate() Exit 0 EndFunc Y este otro que es con Ventanas GUI para fijar la ventana y darle transparencia pero aun no consigo colocar el texto en este caso el ping es dicha coordenada And this other one that uses a Windows GUI to fix the window and give it transparency but I still can't put the text. In this case the ping is at a given coordinate #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "Terminate") WinSetTrans("Conexion", "", 100) GUICreate("Conexion", 80, 40, 422, 17, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0xE0FFFF) Local $idPic = GUICtrlCreatePic("..\GUI\mslogo.jpg", 80, 40, 422, 17) WinSetTrans("Conexion", "", 100) GUISetState(@SW_SHOW) While 1 Local $iPing = Ping("www.google.es", "") Sleep(100) WEnd Func Terminate() Exit 0 EndFunc Muchas gracias por la ayudar. Thanks a lot for any help Edited April 12, 2020 by Melba23 Added translation and code tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 12, 2020 Moderators Share Posted April 12, 2020 Moved to the appropriate forum. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 12, 2020 Moderators Share Posted April 12, 2020 Hemrry, Welcome to the AutoIt forums. But we speak English here and although I think I can understand your request (although a bit more punctuation would help!) not everyone else will. Please use Google Translate or similar in future. Thanks in advance for your cooperation. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Danyfirex Posted April 12, 2020 Share Posted April 12, 2020 Hello Hemrry(I speak Spanish ☺️) Nice to see Spanish user. Here an example to play with. (Aqui te dejo un ejemplo con el que puedes jugar/modificar) expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <WinAPI.au3> HotKeySet("{ESC}", "Terminate") Global $hGUI = 0, $hGraphics = 0, $hBrush = 0, $hFormat = 0, $hFamily = 0, $hFont = 0, $tLayout = 0 $hGUI = GUICreate("MyGUI", 250, 50, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) GUISetBkColor(0x000000) _WinAPI_SetLayeredWindowAttributes($hGUI, 0x000000) GUISetState(@SW_SHOW, $hGUI) _GDIPlus_Startup() $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBrush = _GDIPlus_BrushCreateSolid(0xFF00FF00) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 17, 1) $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0) While Sleep(100) Local $iPing = Ping("www.google.es") If $iPing Then _GDIPlus_GraphicsClear($hGraphics) _GDIPlus_GraphicsDrawStringEx($hGraphics, $iPing & " ms.", $hFont, $tLayout, $hFormat, $hBrush) EndIf WEnd Func Terminate() _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hGUI) Exit 0 EndFunc ;==>Terminate Saludos Gianni and Hemrry 2 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Gianni Posted April 12, 2020 Share Posted April 12, 2020 nice script @Danyfirex P.S. by adding this line just below the GuiCreate, will also allows you to drag that around on the screen... GUICtrlCreateLabel('', 0, 0, 250, 50, -1, $GUI_WS_EX_PARENTDRAG) Danyfirex 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Nine Posted April 12, 2020 Share Posted April 12, 2020 Using @Chimp suggestion, you can combine both solutions into a single approach : #include <Constants.au3> #include <GUIConstants.au3> #include <FontConstants.au3> #include <WinAPI.au3> HotKeySet("{ESC}", "Terminate") Local $hGUI = GUICreate("MyGUI", 250, 50, -1, -1, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_LAYERED) GUISetBkColor(0x000000) _WinAPI_SetLayeredWindowAttributes($hGUI, 0x000000) Local $idLabel = GUICtrlCreateLabel ("", 0, 0,250, 50, $SS_CENTER+$SS_CENTERIMAGE, $GUI_WS_EX_PARENTDRAG) GUICtrlSetColor (-1,0x101010) GUICtrlSetFont (-1, 17, $FW_SEMIBOLD) GUISetState(@SW_SHOW, $hGUI) Local $iPing, $iPrev While Sleep(100) $iPing = Ping("www.google.ca") If $iPing <> $iPrev Then GUICtrlSetData ($idLabel, $iPing & " ms.") $iPrev = $iPing EndIf WEnd Func Terminate() Exit EndFunc ;==>Terminate Danyfirex and Hemrry 1 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Hemrry Posted April 13, 2020 Author Share Posted April 13, 2020 Muchas gracias por el aporte. Funcionó muy bien. Te lo agradezco. Inserté la función para poder moverla por toda la pantalla y que el bucle se ejecute constantemente para que no se conecte a Internet #include <Constants.au3> #include <GUIConstants.au3> #include <FontConstants.au3> #include <WinAPI.au3> #include <WinAPISysWin.au3> HotKeySet("^{SPACE}", "Terminate") Local $hGUI = GUICreate("MyGUI",80 , 34, 1700, 2, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) GUISetBkColor(0x000000) _WinAPI_SetLayeredWindowAttributes($hGUI, 0x000000) Local $idLabel = GUICtrlCreateLabel ("", 0, 0,80, 40, $SS_CENTER+$SS_CENTERIMAGE, $GUI_WS_EX_PARENTDRAG) GUICtrlSetColor (-1,0x34eb41) GUICtrlSetFont (-1, 13, $FW_NORMAL, $GUI_FONTNORMAL, "Comic Sans MS") GUISetState(@SW_SHOW, $hGUI) Local $iPing While Sleep(90) $iPing = Ping("www.google.es", "") GUICtrlSetData ($idLabel, $iPing & " ms") WEnd Func Terminate() Exit EndFunc ;==>Terminate Link to comment Share on other sites More sharing options...
Developers Jos Posted April 13, 2020 Developers Share Posted April 13, 2020 3 hours ago, Hemrry said: Muchas gracias por el aporte. Funcionó muy bien. Te lo agradezco. Please use English only as requested! Thanks, Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Hemrry Posted April 14, 2020 Author Share Posted April 14, 2020 Good afternoon, I am adjusting the latest modifications but I am having problems with the conditions or the variables, I am not sure yet, because when applying the variable, it limits the ping to drop below the amount I place, I explain. If I put that when it is below 100 it turns green and when it is above 100 it turns red. Even if you have a ping of 40 or 80, this bone red always remains static. Could you please help me. expandcollapse popup#include <Constants.au3> #include <GUIConstants.au3> #include <FontConstants.au3> #include <WinAPI.au3> #include <WinAPISysWin.au3> HotKeySet("^{SPACE}", "Terminate") Local $hGUI = GUICreate("MyGUI",100 , 35, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) GUISetBkColor(0x000000) _WinAPI_SetLayeredWindowAttributes($hGUI, 0x000000) Local $idLabel = GUICtrlCreateLabel ("", 0, 0,100, 35, $SS_CENTER+$SS_CENTERIMAGE, $GUI_WS_EX_PARENTDRAG) GUICtrlSetColor (-1,0x34eb41) GUICtrlSetFont (-1, 14, $FW_NORMAL, $GUI_FONTNORMAL, "Comic Sans MS") GUISetState(@SW_SHOW, $hGUI) Local $2idLabel = GUICtrlCreateLabel ("", 0, 0,100, 35, $SS_CENTER+$SS_CENTERIMAGE, $GUI_WS_EX_PARENTDRAG) GUICtrlSetColor (-1,0xfa0707) GUICtrlSetFont (-1, 14, $FW_NORMAL, $GUI_FONTNORMAL, "Comic Sans MS") GUISetState(@SW_SHOW, $hGUI) While 1 Local $iPing Local $var $iPing = Ping("www.google.es", "") $var = 100 If $iPing < $var Then GUICtrlSetData ($idLabel, $iPing & " ms") ElseIf $iPing > $var Then GUICtrlSetData ($2idLabel, $iPing & " ms") EndIf WEnd Func Terminate() Exit EndFunc ;==>Terminate Link to comment Share on other sites More sharing options...
TheXman Posted April 14, 2020 Share Posted April 14, 2020 (edited) Here's an over-simplified example that shows you some basic concepts involved in achieving your goal: (Press ESC to Exit) Change the threshold value to meet your needs. For me, the ping value is around 6ms. That allows me to see it turn red every once in a while when it exceeds 6ms. I didn't take into account any of the transparency stuff, just the pinging and changing the color of the value when the threshold is exceeded. expandcollapse popupGlobal $frmMain = GUICreate("Ping Test", 196, 96, -1, -1) Global $Label1 = GUICtrlCreateLabel("Ping (ms):", 8, 16, 60, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $lblPingTime = GUICtrlCreateLabel("", 72, 16, 68, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $Label2 = GUICtrlCreateLabel("ESC to QUIT", 8, 60, 150, 17) Global Const $PING_THRESHOLD_MS = 7 ;<== Change threshhold to meet needs Global $iPingMs = 0 HotKeySet("{esc}", terminate) GUISetState(@SW_SHOW) While 1 ;Ping host $iPingMs = Ping("www.google.es") If @error Then ConsoleWrite("Ping error - @error = " & @error & @CRLF) ExitLoop EndIf ;Update ping label GUICtrlSetData($lblPingTime, $iPingMs) ;Set label color based on whether threshhold is exceeded If $iPingMs > $PING_THRESHOLD_MS Then GUICtrlSetColor($lblPingTime, 0xFF0000) ;Red Else GUICtrlSetColor($lblPingTime, 0x06722E) ;Dark Green EndIf ;Wait a bit before next loop Sleep(500) WEnd Func terminate() Exit EndFunc Edited April 14, 2020 by TheXman FrancescoDiMuro 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman 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