FinalVersion Posted March 31, 2010 Share Posted March 31, 2010 The following script is suppose to wait for you to change the active window, and then resize it. If you can tell me what's wrong, I'd appreciate it. $aList = WinList() Local $sActiveWindow For $i = 1 To $aList[0][0] If WinGetState($aList[$i][0]) = 8 Then $sActiveWindow = $aList[$i][0] ConsoleWrite($sActiveWindow) EndIf Next While 1 $aList = WinList() For $x = 1 To $aList[$x][0] If WinGetState($aList[$x][0]) = 8 Then If Not $sActiveWindow = $aList[$x][0] Then WinMove("[active]", "", 50, 50, @DesktopWidth - 100, @DesktopHeight - 125) ExitLoop EndIf EndIf Next WEnd [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 31, 2010 Share Posted March 31, 2010 Try displaying the window states to see your problem: $aList = WinList() For $i = 1 To $aList[0][0] $iState = WinGetState($aList[$i][0]) ConsoleWrite($i & ": Title = " & $aList[$i][0] & "; Hwnd = " & $aList[$i][1] & "; State = " & $iState & @LF) Next How many 8's do you see? 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...
FinalVersion Posted April 1, 2010 Author Share Posted April 1, 2010 Oh, well I tried using BitAND and BitOR, but neither worked. How can I solve this? $aList = WinList() Local $sActiveWindow For $i = 1 To $aList[0][0] $iState = WinGetState($aList[$i][0]) If BitAND($iState, 8) Then $sActiveWindow = $aList[$i][0] ConsoleWrite($sActiveWindow) EndIf Next While 1 $aList = WinList() For $x = 1 To $aList[$x][0] If WinGetState($aList[$x][0]) = 8 Then If Not $sActiveWindow = $aList[$x][0] Then WinMove("[active]", "", 50, 50, @DesktopWidth - 100, @DesktopHeight - 125) ExitLoop EndIf EndIf Next WEnd [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 1, 2010 Share Posted April 1, 2010 So, didn't your first For/Next loop work correctly with the BitAnd()? You could make it more reliable by using the Hwnd (window handle) instead of the title, which is $aList[$i][1] vice $aList[$i][0]. There might be multiple windows with the same title, but every window has a unique Hwnd, so it is the preferred way to ID a window. Your second For/Next loop is all screwed up, but only because you didn't fix it like the first. 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...
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