beestinga Posted October 9, 2007 Share Posted October 9, 2007 Usage:Run the program, hit f9 - this will tile all of your windows so that all open visible windows will be simultaneously visible. When you see the window you want, click on it - this will maximize your target window and return all other windows to their previous positions.Problems:It is very slow. It may take 3-4 seconds to tile all of the windows and then that long or longer to return them all to their original positions and maximize your target. This code can be improved upon by anyone who would care to do so. I just whipped this together yesterday afternoon because a buddy of mine was saying that windows needs a feature like expose.expandcollapse popup#include <Math.au3> #include <Array.au3> HotKeySet("{F9}","doit") while 1 sleep(500) WEnd Func doit() $var = WinList() global $count=0 For $i = 1 to $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" AND IsVisible($var[$i][1]) And $var[$i][0] <> "Program Manager" Then $count +=1 EndIf Next Global $windows[$count+1][2], $backuppos[$count+1][5] $windows[0][0]=$count $j=1 For $i = 1 to $var[0] [0] ; Only display visble windows that have a title If $var[$i][0] <> "" AND IsVisible($var[$i][1]) And $var[$i][0] <> "Program Manager" Then $windows[$j][0]=$var[$i][0] $j +=1 EndIf Next $numwindows=$windows[0][0] If _MathCheckDiv($numwindows,2)=2 Then $columns=$numwindows/2 $evodd=1 EndIf If _MathCheckDiv($numwindows,2)=1 Then $numwindows=$numwindows+1 $columns=$numwindows/2 $numwindows=$numwindows-1 $evodd=2 EndIf ;create row 1 $x=0 $counter=1 while $counter <= $columns $array= wingetpos($windows[$counter][0]) $backuppos[$counter][0]=$array[0] $backuppos[$counter][1]=$array[1] $backuppos[$counter][2]=$array[2] $backuppos[$counter][3]=$array[3] $backuppos[$counter][4]=$windows[$counter][0] winsetstate($windows[$counter][0],"",@SW_RESTORE) WinMove($windows[$counter][0],"",$x,0,@DesktopWidth/$columns,@desktopheight/2) $counter=$counter+1 $temp=@DesktopWidth/$columns $x=$x+$temp WEnd ;create row 2 $counter=1 $x=0 If $evodd=2 Then While $counter < $columns $array= wingetpos($windows[$counter+$columns][0]) $backuppos[$counter+$columns][0]=$array[0] $backuppos[$counter+$columns][1]=$array[1] $backuppos[$counter+$columns][2]=$array[2] $backuppos[$counter+$columns][3]=$array[3] $backuppos[$counter+$columns][4]=$windows[$counter+$columns][0] winsetstate($windows[$counter+$columns][0],"",@SW_RESTORE) WinMove($windows[$counter+$columns][0],"",$x,@desktopheight/2,@DesktopWidth/$columns,@desktopheight/2) $counter=$counter+1 $temp=@DesktopWidth/$columns $x=$x+$temp WEnd Else While $counter <= $columns $array= wingetpos($windows[$counter+$columns][0]) $backuppos[$counter+$columns][0]=$array[0] $backuppos[$counter+$columns][1]=$array[1] $backuppos[$counter+$columns][2]=$array[2] $backuppos[$counter+$columns][3]=$array[3] $backuppos[$counter+$columns][4]=$windows[$counter+$columns][0] winsetstate($windows[$counter+$columns][0],"",@SW_RESTORE) WinMove($windows[$counter+$columns][0],"",$x,@desktopheight/2,@DesktopWidth/$columns,@desktopheight/2) $counter=$counter+1 $temp=@DesktopWidth/$columns $x=$x+$temp WEnd EndIf winactivate("Program Manager") winwaitnotactive("Program Manager") $used = wingettitle("") $counter=1 While $counter <= $numwindows If $backuppos[$counter][0] >= 0 Then WinMove($windows[$counter][0],"",$backuppos[$counter][0],$backuppos[$counter][1],$backuppos[$counter][2],$backuppos[$counter][3]) ElseIf $backuppos[$counter][0] = -3200 Then WinSetState($windows[$counter][0],"",@SW_MINIMIZE) ElseIf $backuppos[$counter][0] = -4 Then WinSetState($windows[$counter][0],"",@SW_MAXIMIZE) Else WinSetState($windows[$counter][0],"",@SW_MINIMIZE) EndIf $counter += 1 WEnd WinActivate($used) winsetstate($used,"",@SW_MAXIMIZE) EndFunc Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Link to comment Share on other sites More sharing options...
JohnBailey Posted October 9, 2007 Share Posted October 9, 2007 cool idea... too bad about the time delay A decision is a powerful thing Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 9, 2007 Moderators Share Posted October 9, 2007 You do know there's an API call to tile windows and or cascade them right?Maybe you can merge your idea with these options:http://www.autoitscript.com/forum/index.ph...st&p=398889 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...
beestinga Posted October 10, 2007 Author Share Posted October 10, 2007 yowza, guess that might've been easier. Oh well. 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