MerkurAlex Posted August 20, 2007 Share Posted August 20, 2007 is it possible to get the title of the window i just clicked on in autoit code? i cant seem to figure it out. [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
Achilles Posted August 20, 2007 Share Posted August 20, 2007 (edited) is it possible to get the title of the window i just clicked on in autoit code? i cant seem to figure it out. Not sure if this works in all cases but could you get the top most window? Because if you clicked on it it should be the topmost... I think you use WinList to do that.. HotKeySet('t', '_GetTopMost') While 1 Sleep(1000) WEnd Func _GetTopMost() Local $temp = Winlist() For $a = 1 to $temp[0][0] If $temp[$a][0] <> "" and _IsVisible($temp[$a][1]) then Msgbox(0, 'Topmost window is...', $temp[$a][0]) ExitLoop EndIf Next EndFunc Func _IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Edited August 20, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
MerkurAlex Posted August 20, 2007 Author Share Posted August 20, 2007 Not sure if this works in all cases but could you get the top most window? Because if you clicked on it it should be the topmost... I think you use WinList to do that.. I'll post something in a bitspeaking of winlist i figured out a way to do what i want for now but i need some help why does this crash #include <GuiConstants.au3> #include <Array.au3> #Include <GuiList.au3> $gui=guicreate("lol") $list=guictrlcreatelist("",0,0,250,400) $on=guictrlcreatebutton("Ontop",255,0,100) $not=guictrlcreatebutton("Not Ontop",255,30,100) guisetstate(@SW_SHOW) $listw=winlist() ;_arraydisplay($listw) for $i=0 to $listw[0][0] _guictrllistadditem($list,$listw[$i][0]) Next while 1 $msg=guigetmsg() if $msg=$GUI_EVENT_CLOSE then exit if $msg=$on Then winsetontop(guictrlread($list),"",1) EndIf WEnd im really tired so i cant think about why this wouldnt work :/ [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
Achilles Posted August 20, 2007 Share Posted August 20, 2007 #include <GuiConstants.au3> #include <Array.au3> #Include <GuiList.au3> $gui=guicreate("lol") $list=guictrlcreatelist("",0,0,250,400) $on=guictrlcreatebutton("Ontop",255,0,100) $not=guictrlcreatebutton("Not Ontop",255,30,100) guisetstate(@SW_SHOW) $listw=winlist() ;_arraydisplay($listw) for $i=1 to $listw[0][0];Changed this from 0 to 1, I think that was causing your main problem If $listw[$i][0] <> "" and _IsVisible($listw[$i][1]) then _GuictrllistAdditem($list,$listw[$i][0]) ;this part just makes sure the window name is valid and that's is visible... Next While 1 $msg=guigetmsg() if $msg=$GUI_EVENT_CLOSE then exit if $msg=$on Then winsetontop(guictrlread($list),"",1) EndIf WEnd Func _IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] 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