ReFran Posted November 27, 2008 Share Posted November 27, 2008 (edited) Hi, with using WinList() I store a Winhandle ($handle = 0x00270492) in a listview. Later on I will use it in WinActivate($handle). But that doesn't work. For testing I wrote the given handle ($handleSaved = "0x00270492") manual in and use it in WinActivate. That also doesn't work. If I compare via Winlist the actual given handle from Winlist with $handleSaved I get the result: both are the same. But if I use in WinActivate the actual given handle it works, if I use $handleSaved it doesn't work. Attached the (poor) testing script. Let it rune once to note a $handleSaved. In the second run it should activate the saved window. best regards, Reinhard PS: I know that I can activate the Window bay using the comparison and WinList() again, but I think there is a more direct way. $var = WinList() $handleSaved = "0x00040440";"0x00270492" $Test = "N" 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 $handle = $var[$i][1] consolewrite($handle &@LF) if $handleSaved = $handle then $Test = "Y" $OK = MsgBox(1, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1] &@lf&@lf _ &"WinActivate?"&" "&isbinary($handle)&":"&isHWND($handle)&":"&$Test) if $OK = 1 then WinActivate($handleSaved) $Test = "N" EndIf Next Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Edited November 27, 2008 by ReFran Link to comment Share on other sites More sharing options...
BrettF Posted November 27, 2008 Share Posted November 27, 2008 I can't replicate cause I'm not sure what this line is... WinActivate($handleSE) Whats $handleSE meant to be? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
ReFran Posted November 27, 2008 Author Share Posted November 27, 2008 I can't replicate cause I'm not sure what this line is... WinActivate($handleSE)Whats $handleSE meant to be?Excuse me.I used $handleSE in my origin, but thought on a public basic $handleSaved is better.I change it in above script.Thanks, Reinhard Link to comment Share on other sites More sharing options...
ReFran Posted November 27, 2008 Author Share Posted November 27, 2008 Mmmh, is it my bad explanation/english or does that really not work. Also negative answers are welcome. br, Reinhard Link to comment Share on other sites More sharing options...
dbzfanatic Posted November 27, 2008 Share Posted November 27, 2008 You need to remember the handle changes every time you close/open the window. I'm not sure if this is your problem but I usually check the PID of the process against the returned info (handle/title). If it is the same then I store that handle in a Global variable. This may also be your problem. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
ReFran Posted November 27, 2008 Author Share Posted November 27, 2008 That's not the problem. The process is running, the comparison part say the values are equal, but I don't get the stored or typed in value to act as HWnd. I can set up a workaround, but I think it's a bug, or? br, Reinhard Attached some more testing: ;;; 0x0066055C = Running process of Total commander Opt ("WinTitleMatchMode", 4) GLOBAL $handleGlobal = 0x0066055C $handle = "0x0066055C" ; Winactivate($handleGlobal); as goblal - don't work ; WinActivate(0x0066055C); manual typed in - don't work ; WinActivate($handle);as saved string - don't work $handleBin = Binary($handle) ; Winactivate($handleBin);dont work Link to comment Share on other sites More sharing options...
dbzfanatic Posted November 27, 2008 Share Posted November 27, 2008 Here's what I do, it might help you out. I don' have the program you're using so I can't test myself but this might give you a hint or something. Hope it helps somehow. $list = WinList("Total commander") For $i = 1 To $list[0][0] If WinGetProcess($list[$i][0]) = $PID Then Global $handle = $list[$i][1] EndIf Next Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
ReFran Posted November 27, 2008 Author Share Posted November 27, 2008 Mmmh, that works somehow. Will test it more and then see if I use that or my workaround (reactivate handle value to hwnd). It drives me crazy if I think I can write it in some few minutes and then I need hours to get it to work. Thank you very much for your testing and solution, have to go out for some fresh air ;-) Reinhard Link to comment Share on other sites More sharing options...
dbzfanatic Posted November 27, 2008 Share Posted November 27, 2008 You're very welcome. I'm glad I could help. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] 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