faldo 9 Posted November 25, 2004 Is it possible to create a "drop-down" list with GUI that lists all the windows currently active/inactive/minimized etc. and then one could select a window and move that name into a variable? If so, i'd love to get some help on how that would look RDP antihammer/blacklist generator Share this post Link to post Share on other sites
Jos 2,211 Posted November 25, 2004 Is it possible to create a "drop-down" list with GUI that lists all the windows currently active/inactive/minimized etc. and then one could select a window and move that name into a variable?If so, i'd love to get some help on how that would look <{POST_SNAPBACK}>Check here for new WinList() feature in the unstable version.: #41057 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. Share this post Link to post Share on other sites
faldo 9 Posted November 25, 2004 wow... AutoIt just gets better and better... thanx alot! =o) RDP antihammer/blacklist generator Share this post Link to post Share on other sites
faldo 9 Posted November 25, 2004 I got the script working where i could create MSGboxes that poped one after one displaying all the window titles... but how do i put that in a drop-down list? some loop in the list of some kind? :/ RDP antihammer/blacklist generator Share this post Link to post Share on other sites
Jos 2,211 Posted November 25, 2004 I got the script working where i could create MSGboxes that poped one after one displaying all the window titles... but how do i put that in a drop-down list? some loop in the list of some kind? :/<{POST_SNAPBACK}>something like this ?#include <GUIConstants.au3> $var = WinList () $Windows = "" 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 If $Windows = "" Then $Windows = $var[$i][0] Else $Windows = $Windows & "|" & $var[$i][0] EndIf EndIf Next GUICreate("test") GUICtrlCreateCombo("windows", 10, 10) GUICtrlSetData(-1, $Windows) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Func IsVisible($handle) If BitAND( WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible 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. Share this post Link to post Share on other sites
faldo 9 Posted November 25, 2004 (edited) How do i keep a text in a GUIwindow updated along with a variable?... meaning: if the variable changes, the text also changes automaticly. I tried it with GUICtrlGetState but i'm not sure i'm doing it right :/ Edited November 25, 2004 by faldo RDP antihammer/blacklist generator Share this post Link to post Share on other sites
Jos 2,211 Posted November 25, 2004 How do i keep a text in a GUIwindow updated along with a variable?... meaning: if the variable changes, the text also changes automaticly.I tried it with GUICtrlGetState but i'm not sure i'm doing it right :/<{POST_SNAPBACK}>dunno what you mean... what text do you want to update? or maybe show your code ... 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. Share this post Link to post Share on other sites
faldo 9 Posted November 25, 2004 (edited) #include <GUIConstants.au3> $var = WinList () $Windows = "test" 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 If $Windows = "" Then $Windows = $var[$i][0] Else $Windows = $Windows & "|" & $var[$i][0] EndIf EndIf Next GUICreate("Windows") $n1=GUICtrlCreateCombo("windows", 10, 10) GUICtrlSetData(-1, $Windows) GUISetState() GUICtrlCreateLabel ( GuiRead($n1), 70, 70) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Func IsVisible($handle) If BitAND( WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc;==>IsVisible I would like it to change $n1 as soon as i change $Windows... so that the label is allways updated when i change the selection in the list. Edited November 25, 2004 by faldo RDP antihammer/blacklist generator Share this post Link to post Share on other sites
Jos 2,211 Posted November 25, 2004 You need to save the handle for the label and the update that when somethiung is selected in the combo: #include <GUIConstants.au3> $var = WinList () $Windows = "test" 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 If $Windows = "" Then $Windows = $var[$i][0] Else $Windows = $Windows & "|" & $var[$i][0] EndIf EndIf Next GUICreate("Windows") $n1 = GUICtrlCreateCombo("windows", 10, 10) GUICtrlSetData(-1, $Windows) GUISetState() $selected = GUICtrlCreateLabel(GUIRead($n1), 70, 70) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $n1 Then GUICtrlSetData($selected,GUIRead($n1)) Wend Func IsVisible($handle) If BitAND( WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible 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. Share this post Link to post Share on other sites
faldo 9 Posted November 25, 2004 expandcollapse popup#include <GUIConstants.au3> $var = WinList () $Windows = "" 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 If $Windows = "" Then $Windows = $var[$i][0] Else $Windows = $Windows & "|" & $var[$i][0] EndIf EndIf Next If Random() < 0.5 Then ;Capitals $Letter1 = Chr(Random(Asc("A"), Asc("Z")+1)) $Letter2 = Chr(Random(Asc("A"), Asc("Z")+1)) $Letter3 = Chr(Random(Asc("A"), Asc("Z")+1)) $Letter4 = Chr(Random(Asc("A"), Asc("Z")+1)) $Letter5 = Chr(Random(Asc("A"), Asc("Z")+1)) $Letter6 = Chr(Random(Asc("A"), Asc("Z")+1)) Else ;Lower case $Letter1 = Chr(Random(Asc("a"), Asc("z")+1)) $Letter2 = Chr(Random(Asc("a"), Asc("z")+1)) $Letter3 = Chr(Random(Asc("a"), Asc("z")+1)) $Letter4 = Chr(Random(Asc("a"), Asc("z")+1)) $Letter5 = Chr(Random(Asc("a"), Asc("z")+1)) $Letter6 = Chr(Random(Asc("a"), Asc("z")+1)) Endif GUICreate("test") $n1=GUICtrlCreateCombo("Select a window", 10, 10) GUICtrlSetData(-1, $Windows) GUISetState() GUICtrlCreateLabel ( "Do you want to change the window-title of:", 60, 50) $selected=GUICtrlCreateLabel ( GuiRead($n1), 70, 70, 300) GUICtrlCreateLabel ( "to:", 60, 90) $changed=GUICtrlCreateLabel ( $Letter1 & $Letter2 & $Letter3 & $Letter4 & $Letter5 & $Letter6 & "?", 70, 110, 300) $cancel=GUICtrlCreateButton ("Cancel", 120, 140, 50) $yes=GUICtrlCreateButton ( "Yes", 70, -1, 50) $refresh=GUICtrlCreateButton ( "Refresh", 320, 10, 50) GUISetState () ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $n1 Then GUICtrlSetData($selected, GUIRead($n1)) If $msg = $cancel Then ExitLoop If $msg = $yes Then WinSetTitle(GuiRead($n1), "", GuiRead($changed)) If $msg = $refresh Then Wend Func IsVisible($handle) If BitAND( WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Could someone please help me with the "refresh button"? I would like to get the dropdown-list refreshed. RDP antihammer/blacklist generator Share this post Link to post Share on other sites
Jos 2,211 Posted November 25, 2004 Could someone please help me with the "refresh button"? I would like to get the dropdown-list refreshed.<{POST_SNAPBACK}>moved the winlist into a function and call that everytime the button is pressed...something like:expandcollapse popup#include <GUIConstants.au3> If Random() < 0.5 Then ;Capitals $Letter1 = Chr(Random(Asc("A"), Asc("Z") + 1)) $Letter2 = Chr(Random(Asc("A"), Asc("Z") + 1)) $Letter3 = Chr(Random(Asc("A"), Asc("Z") + 1)) $Letter4 = Chr(Random(Asc("A"), Asc("Z") + 1)) $Letter5 = Chr(Random(Asc("A"), Asc("Z") + 1)) $Letter6 = Chr(Random(Asc("A"), Asc("Z") + 1)) Else ;Lower case $Letter1 = Chr(Random(Asc("a"), Asc("z") + 1)) $Letter2 = Chr(Random(Asc("a"), Asc("z") + 1)) $Letter3 = Chr(Random(Asc("a"), Asc("z") + 1)) $Letter4 = Chr(Random(Asc("a"), Asc("z") + 1)) $Letter5 = Chr(Random(Asc("a"), Asc("z") + 1)) $Letter6 = Chr(Random(Asc("a"), Asc("z") + 1)) EndIf GUICreate("test") $n1 = GUICtrlCreateCombo("Select a window", 10, 10) GUICtrlSetData(-1, getWindows()) GUISetState() GUICtrlCreateLabel("Do you want to change the window-title of:", 60, 50) $selected = GUICtrlCreateLabel(GUIRead($n1), 70, 70, 300) GUICtrlCreateLabel("to:", 60, 90) $changed = GUICtrlCreateLabel($Letter1 & $Letter2 & $Letter3 & $Letter4 & $Letter5 & $Letter6 & "?", 70, 110, 300) $cancel = GUICtrlCreateButton("Cancel", 120, 140, 50) $yes = GUICtrlCreateButton("Yes", 70, -1, 50) $refresh = GUICtrlCreateButton("Refresh", 320, 10, 50) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $n1 Then GUICtrlSetData($selected, GUIRead($n1)) If $msg = $cancel Then ExitLoop If $msg = $yes Then WinSetTitle(GUIRead($n1), "", GUIRead($changed)) If $msg = $refresh Then GUICtrlSetData($n1, getWindows()) Wend ; Func getWindows() Local $T_Windows = "" Local $Var = WinList () 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 $T_Windows = $T_Windows & "|" & $var[$i][0] EndIf Next Return $T_Windows EndFunc ;==>getWindows ; Func IsVisible($handle) If BitAND( WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible 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. Share this post Link to post Share on other sites
faldo 9 Posted November 25, 2004 Worx great... thanx again. RDP antihammer/blacklist generator Share this post Link to post Share on other sites