Delta01 Posted October 26, 2007 Share Posted October 26, 2007 Hi, My problem is that I can't get my script to separate two windows with the same name and process name. Eg, I have 2 Firefox's open, I need to send different commands to each without renaming the window. Is there anyway I can do that? Get a PID on start up or something? Thanks Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 26, 2007 Share Posted October 26, 2007 Hi,My problem is that I can't get my script to separate two windows with the same name and process name. Eg, I have 2 Firefox's open, I need to send different commands to each without renaming the window.Is there anyway I can do that? Get a PID on start up or something?ThanksUse WinList() or WinGetHandle() and work with the handles. They remain unique and specific. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Delta01 Posted October 26, 2007 Author Share Posted October 26, 2007 Use WinList() or WinGetHandle() and work with the handles. They remain unique and specific. I looked them both up, I can get WinGetHandle to work after a bit of fiddling, but WinList confuses me. I looked it up and the help file code is $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 MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1]) EndIf Next Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc It gets all visable windows, but, is there a way I can get it to just get a window with a certain name, not all visable ones. Eg, FireFox Link to comment Share on other sites More sharing options...
Sardith Posted October 27, 2007 Share Posted October 27, 2007 $List = WinList() $Program = "FireFox" For $i = 1 to $List[0][0] ; Only display visble windows that have a title If $List[$i][0] <> "" AND StringInStr($List[$i][0], $Program)Then MsgBox(0, "Details", "Title=" & $List[$i][0] & @LF & "Handle=" & $List[$i][1]) EndIf Next Is this what you wanted? [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 27, 2007 Share Posted October 27, 2007 It gets all visable windows, but, is there a way I can get it to just get a window with a certain name, not all visable ones. Eg, FireFox This should list only instances of Firefox. It uses the Window class to find it, and the array lists the titles and handles: #include <array.au3> $avFirefoxes = WinList("[CLASS:MozillaUIWindowClass]") _ArrayDisplay($avFirefoxes, "Firefox Windows") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Sardith Posted October 27, 2007 Share Posted October 27, 2007 =). Learn something new everyday. Never would have thought of that sadly. [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Delta01 Posted October 27, 2007 Author Share Posted October 27, 2007 Thanks for your help, got it working great now! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 27, 2007 Moderators Share Posted October 27, 2007 $List = WinList() $Program = "FireFox" For $i = 1 to $List[0][0] ; Only display visble windows that have a title If $List[$i][0] <> "" AND StringInStr($List[$i][0], $Program)Then MsgBox(0, "Details", "Title=" & $List[$i][0] & @LF & "Handle=" & $List[$i][1]) EndIf Next Is this what you wanted?This does not retrieve only the visible windows as suggested by the comment... you do know that right? BitAnd(WinGetState($List[$i]), 2) << is missing. 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...
Sardith Posted October 27, 2007 Share Posted October 27, 2007 This does not retrieve only the visible windows as suggested by the comment... you do know that right? BitAnd(WinGetState($List[$i]), 2) << is missing. If you were only right there my friend. "but, is there a way I can get it to just get a window with a certain name, not all visable ones. Eg, FireFox" "NOT ALL VISABLE ONES" [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 27, 2007 Share Posted October 27, 2007 Perhaps you meant "Not only just the visible ones" Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 27, 2007 Moderators Share Posted October 27, 2007 If you were only right there my friend."but, is there a way I can get it to just get a window with a certain name, not all visable ones. Eg, FireFox""NOT ALL VISABLE ONES"You added a little ebonics in there that completely threw me off.WinList("Name Of Window") is what I'm going to assume you are saying. 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...
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