Influx Posted December 30, 2008 Share Posted December 30, 2008 i am trying to read the control data in event mode control creation code: dim $x[500] $var = WinList() ConsoleWrite($var[0][0]) $c = ($width-150)/20 For $i = 1 to $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then $x[$i] = GUICtrlCreatebutton($var[$i][0], $c, 5, ($width-150)/20, 25) GUICtrlSetOnEvent(-1, "pushed") GUICtrlSetColor(-1, 0xffffff) ;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetTip(-1, $var[$i][0]) $c=$c+($width-150)/20 EndIf NextoÝ÷ Ú·v)à~éÜjëh×6func pushed() WinActivate(GUICtrlRead($x[@GUI_Ctrlid-1])) EndFunc what am i doing wrong? Link to comment Share on other sites More sharing options...
KaFu Posted December 30, 2008 Share Posted December 30, 2008 Maybe WinActivate(GUICtrlRead(@GUI_Ctrlid)) will work. Otherwise supply a code capable of running ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Influx Posted December 30, 2008 Author Share Posted December 30, 2008 that is a code capable of running, just add a while loop at the end and a guicreate() at the start. that doesn't work btw. Link to comment Share on other sites More sharing options...
azure Posted December 30, 2008 Share Posted December 30, 2008 that is a code capable of running, just add a while loop at the end and a guicreate() at the start. that doesn't work btw. It wasn't really capable of running as is.. by the way. But I tinkered a bit with it. Try this: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Opt("GUIOnEventMode",1) $width = 800 $height = 300 $Form1 = GUICreate("Form1", $width, $height, 193, 115) dim $x[500] $var = WinList() ConsoleWrite($var[0][0]) $c = ($width-150)/20 For $i = 1 to $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" AND _WinAPI_IsWindowVisible($var[$i][1]) Then $x[$i] = GUICtrlCreatebutton($var[$i][0], $c, 5, ($width-150)/20, 25) GUICtrlSetOnEvent(-1, "pushed") GUICtrlSetColor(-1, 0xffffff) ;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ;GUICtrlSetTip(-1, $var[$i][0]) Commented out because winactive falsely detects your form instead. $c=$c+($width-150)/20 EndIf Next GUISetState(@SW_SHOW) While 1 WEnd func pushed() ;MsgBox(0, "Pressed", "GuiCtrlRead=" & ControlGetText("","",@GUI_CtrlID) & "ID=" & @GUI_CtrlID & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle) WinActivate("[TITLE:"&ControlGetText("","",@GUI_CtrlID)&"]") EndFunc Link to comment Share on other sites More sharing options...
KaFu Posted December 30, 2008 Share Posted December 30, 2008 that is a code capable of running, just add a while loop at the end and a guicreate() at the start.~130 of my 150 posts are replies to help-requests, think I'll have to spent 1 minute adding some code to every reply, would have cost me more than 2 hours to do so, and than look at the post count of some others here... next time you don't have to add it... but it sure will raise the probability of a helpful reply... btw... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Influx Posted December 31, 2008 Author Share Posted December 31, 2008 (edited) Thanks for the help, however is there any way to left align the named (not have them centered) also is there any way to give it a tooltip?(so hovering over it will show full name) maybe using a different method, is there some kind of on_hover object? also it includes windows not open (such as my username, proccess manager, and the start bar, desktop and start menu, is there anyway to exclude those? Thanks so much fo rall your help, Influx Edited December 31, 2008 by Influx 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