JoshDB Posted April 11, 2007 Posted April 11, 2007 (edited) This code could definitely be made more efficient, but I like it anyways. Check it out and give me some feedback, if you would: EDIT: 5 mins after post and already a new 'feature', albeit one that should've been in at posting time - It's mere convenience, but it's a nice touch that ends some bugs. It does, however, clutter up the code a bit... A small price to pay. Now you can use the hotkey again to exit the view, instead of you having to click on your original window! This also solves a problem that was caused when you used the hotkey twice or more. Basically, it wasn't pretty. Now it is. Rejoice! expandcollapse popup#include <math.au3> #Include <Misc.au3> HotKeySet('`','Handler') $masterswitch = 0 While 1 WEnd Func Handler() If $masterswitch = 0 Then $masterswitch = 1 Arrange() Else $masterswitch = 2 EndIf EndFunc Func Arrange() $windows = -1 $window = WinList() Global $win_title[$window[0][0]] Global $win_0[$window[0][0]] Global $win_1[$window[0][0]] Global $win_2[$window[0][0]] Global $win_3[$window[0][0]] Global $wind_title[$window[0][0]] Global $wind_0[$window[0][0]] Global $wind_1[$window[0][0]] Global $wind_2[$window[0][0]] Global $wind_3[$window[0][0]] For $i = 1 to $window[0][0] If $window[$i][0] <> "" AND IsVisible($window[$i][1]) AND NOT StringInStr($window[$i][0],'Program Manager') Then $windows = $windows + 1 $win_title[$windows] = $window[$i][0] $win_size = WinGetPos($window[$i][0]) $win_0[$windows] = $win_size[0] $win_1[$windows] = $win_size[1] $win_2[$windows] = $win_size[2] $win_3[$windows] = $win_size[3] EndIf Next $x = 0 $y = 0 $winsx = 2 $winsy = 2 $switch = 0 For $i = 0 To $windows - 3 If $switch = 0 Then $winsx = $winsx + 1 $switch = 1 ElseIf $switch = 1 Then $switch = 2 ElseIf $switch = 2 Then $winsy = $winsy + 1 $switch = 0 EndIf Next ; Debug ;~ MsgBox(0,$windows,'X: ' & $winsx & @CRLF & 'Y: ' & $winsy) If $masterswitch < 2 Then ;Arrange For $i = 0 to $windows If $x = $winsx Then $x = 0 $y = $y + 1 EndIf ;Debug ;~ MsgBox(0,$winsx & ':' & $winsy,$x & ':' & $y & @CRLF & @CRLF & $win_title[$i] & @CRLF & @CRLF & 'x: ' & @DesktopWidth/$winsx*$x & @CRLF & 'y: ' & @DesktopHeight/$winsy*$y & @CRLF & @CRLF & @DesktopWidth & ' / ' & $winsx & ' * ' & $x & ' = ' & @DesktopWidth/$winsx*$x) WinMove($win_title[$i],'',@DesktopWidth/$winsx*$x,@DesktopHeight/$winsy*$y,@DesktopWidth/$winsx,@DesktopHeight/$winsy) $wind_title[$i] = $win_title[$i] $wind_0[$i] = @DesktopWidth/$winsx*$x $wind_1[$i] = @DesktopHeight/$winsy*$y $wind_2[$i] = @DesktopWidth/$winsx $wind_3[$i] = @DesktopHeight/$winsy If $x < $winsx Then $x = $x + 1 EndIf Next For $t = 255 To 225 Step -1 For $i = 0 to $windows WinSetTrans($win_title[$i],'',$t) Next Next $win_under = '' While $masterswitch < 2 $MousePos = MouseGetPos() For $i = 0 To $windows If $MousePos[0] >= $wind_0[$i] AND $MousePos[0] <= $wind_0[$i] + $wind_2[$i] AND $MousePos[1] >= $wind_1[$i] AND $MousePos[1] <= $wind_1[$i] + $wind_3[$i] Then If $win_under <> $wind_title[$i] Then For $t = 255 To 225 Step -1 WinSetTrans($win_under,'',$t) Next For $t = 225 To 255 WinSetTrans($wind_title[$i],'',$t) Next EndIf $win_under = $wind_title[$i] EndIf Next If _IsPressed("01") Then ExitLoop EndIf WEnd EndIf ;Put them back For $i = 0 to $windows WinMove($win_title[$i],'',$win_0[$i],$win_1[$i],$win_2[$i],$win_3[$i]) WinSetTrans($win_title[$i],'',255) Next If $masterswitch < 2 Then WinActivate($win_under) $masterswitch = 0 EndFunc Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Func Even($I_Var) $I_Result = _MathCheckDiv($I_Var, 2) If $I_Result = -1 Or @error = 1 Then Return -1 ElseIf $I_Result = 1 Then Return 0 ElseIf $I_Result = 2 Then Return 1 Else Return -1 EndIf EndFunc Edited April 11, 2007 by JoshDB Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
XxXFaNtA Posted April 11, 2007 Posted April 11, 2007 It's nice, though there is no way to make it back to the original... And that really isn't good ... But nevertheless, still very nice FaNtA /[center][/center]
JoshDB Posted April 11, 2007 Author Posted April 11, 2007 I edited my post just as you replied. So, that's fixed. Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
therks Posted April 11, 2007 Posted April 11, 2007 (edited) It broke my Winamp window, and even exiting and restarting didn't fix it.Full mode:Winshade mode:*Edit: Finally got it fixed. Ended up having to use AutoIt to resize the window to it's usual size. Edited April 11, 2007 by Saunders My AutoIt Stuff | My Github
WeMartiansAreFriendly Posted April 12, 2007 Posted April 12, 2007 its a pretty cool affect, expect the transparency part , i had to close all open windows because windows got REALLY slow. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
JoshDB Posted April 12, 2007 Author Posted April 12, 2007 I think I'll work on this a bit more, and add some options: Transparency actually does slow down windows, and it's only effect is to give emphasis on the window under your mouse - It makes it harder to read, etc., so overall I think it's a user preference. More to come I guess... Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
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