maqleod Posted May 31, 2007 Share Posted May 31, 2007 (edited) First off, thanks to Larry and PaulIA for their guidance on the shading function, I couldn't have finished this without their help.Thanks to rakudave for his virtual desktop script from which I borrowed some lines, and thanks to JoshDB for his expose script which I borrowed in it's entirety, and last thanks to smstroble for posting the polished script for the wallpaper changer from which I borrowed some lines.If you want the shading to work properly and don't want to use the installer, you will need Larry's hook.dll in the same directory as the script, you can get it here:http://www.autoitscript.com/forum/index.ph...amp;hl=hook.dllFinally finished most of the big functions, so far it can do the following:Mac-like expose (using the "`" hotkey)Virtual Desktop Management (between 2 desktops) (hotkeys are "Alt+1" and "Alt+2" to switch)Set transparency for any or all windowsSet on-top flag for any windowHide/Show any windowChange any window titleSet ignore rule for window (so it won't adversely affect windows that may cause problems)Middle-click shading of all windowsDocks to screen sidesChange desktop wallpaper for each desktop, window master will remember which wallpaper was set last for each desktop.Installs all program with all registry settings and dependencies.if you just want the script source, it's belowTo Do list:Tile visable windowsMinimize any window to trayAny feedback, as in how well it works, functions that could add well to it, bugs you experience, or just what you think of it, would be greatly appreciated.expandcollapse popup#include <GUIConstants.au3> #include <A3LGDIPlus.au3> #include <A3LWinAPI.au3> #include <math.au3> #include <Misc.au3> #include <guilist.au3> Opt("MustDeclareVars", 0) HotKeySet('`','Handler') HotKeySet('!1','_ShowDesktop1') HotKeySet('!2','_ShowDesktop2') Global $activedesk = 1,$winlist[500] $selectdir = @MyDocumentsDir _winget() Const $WH_MOUSE = 7 Const $WM_AUTOITMBUTTONDOWN = 0x1400 + 0x0A32 Const $WM_AUTOITMDBLCLK = 0x1400 + 0x0C32 $background = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM", "Background") $xpos = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM", "Xpos") $ypos = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM", "Ypos") if $xpos = -32000 then RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Xpos","REG_SZ",-1) $xpos = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM", "Xpos") endif if $ypos = -32000 then RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Ypos","REG_SZ",-1) $ypos = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM", "Ypos") endif $name = "Window Master v.1.2" $newcolor = "" $masterswitch = 0 Global $POINT = DllStructCreate("int;int") $parent = GUICreate($name,200,110,$xpos,$ypos) GUISetBkColor($background) Opt("RunErrorsFatal", 0) Opt("TrayAutoPause", 0) Opt("TrayMenuMode",1) Opt("TrayIconHide", 0) Opt("TrayOnEventMode", 0) TraySetClick(9) Global $DLLinst = DLLCall("kernel32.dll","hwnd","LoadLibrary","str",".\hook.dll") Global $mouseHOOKproc = DLLCall("kernel32.dll","hwnd","GetProcAddress","hwnd",$DLLInst[0],"str","MouseProc") Global $hhMouse = DLLCall("user32.dll","hwnd","SetWindowsHookEx","int",$WH_MOUSE, _ "hwnd",$mouseHOOKproc[0],"hwnd",$DLLinst[0],"int",0) DLLCall(".\hook.dll","int","SetValuesMouse","hwnd",$parent,"hwnd",$hhMouse[0]) GUIRegisterMsg($WM_AUTOITMBUTTONDOWN,"GetMouseInfo") GUIRegisterMsg($WM_AUTOITMDBLCLK,"GetMouseInfo") $fileopt = GUICtrlCreateMenu("&File") $toggleitem = GUICtrlCreateMenuItem ("Start On Boot",$fileopt) $reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "WM") if $reg = @ScriptFullPath then GUICtrlSetState(-1,$GUI_CHECKED) elseif $reg <> @ScriptFullPath then GUICtrlSetState(-1,$GUI_UNCHECKED) endif $ontopitem = GUICtrlCreateMenuItem("Always On Top",$fileopt) $top = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM", "AlwaysOnTop") if $top = 0 then GUICtrlSetState(-1,$GUI_UNCHECKED) WinSetOnTop($name, "", 0) elseif $top = 1 then GUICtrlSetState(-1,$GUI_CHECKED) WinSetOnTop($name, "", 1) endif $exititem = GUICtrlCreateMenuItem ("Exit",$fileopt) $helpopt = GUICtrlCreateMenu ("About") $aboutitem = GUICtrlCreateMenuItem ("About",$helpopt) $restore = TrayCreateItem("Show Gui") TrayItemSetState(-1, $TRAY_DEFAULT) $transtray = TrayCreateItem("Set Window Transparency") $ontoptray = TrayCreateItem("Set Window On Top") $titletray = TrayCreateItem("Set Window Title") $ignoretray = TrayCreateItem("Edit Window Ignore List") $showhidetray = TrayCreateItem("Show/Hide Window") $optionstray = TrayCreateItem("Options") TrayCreateItem("") $wallpapertray = TrayCreateItem("Change Desktop Wallpaper") $desktop1tray = TrayCreateItem("Desktop 1") $desktop1check = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM", "Desktop1") if $desktop1check = 0 then TrayItemSetState($desktop1tray,$TRAY_UNCHECKED) elseif $desktop1check = 1 then TrayItemSetState($desktop1tray,$TRAY_CHECKED) endif $desktop2tray = TrayCreateItem("Desktop 2") $desktop2check = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM", "Desktop2") if $desktop2check = 0 then TrayItemSetState($desktop2tray,$TRAY_UNCHECKED) elseif $desktop2check = 1 then TrayItemSetState($desktop2tray,$TRAY_CHECKED) endif TrayCreateItem("") $exittray = TrayCreateItem("Exit") $contextmenu = GUICtrlCreateContextMenu() $trans = GuiCtrlCreateMenuItem("Set Window Transparency",$contextmenu) $ontop = GuiCtrlCreateMenuItem("Set Window On Top",$contextmenu) $title = GuiCtrlCreateMenuItem("Set Window Title",$contextmenu) $ignore = GuiCtrlCreateMenuItem("Edit Window Ignore List",$contextmenu) $showhide = GuiCtrlCreateMenuItem("Show/Hide Window",$contextmenu) $options = GuiCtrlCreateMenuItem("Options",$contextmenu) $wallpaper = GuiCtrlCreateMenuItem("Change Desktop Wallpaper",$contextmenu) $minimizecheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM","Minimize") if $minimizecheck = 1 then $parenthandle = WinGetHandle($name,"") GuiSetState($SW_HIDE,$parenthandle) elseif $minimizecheck = 0 then GUISetState() endif TraySetState() $desktop1 = GuiCtrlCreateButton("Desktop 1",15,5,80,80) GuiCtrlSetState(-1,$GUI_DISABLE) $desktop2 = GuiCtrlCreateButton("Desktop 2",105,5,80,80) Do $msg = GUIGetMsg() $msga = TrayGetMsg() _DockToScreenSide($name) if $msg = $trans or $msga = $transtray then $child2 = GUICreate("Set Window Transparency",500, 300,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) Opt("RunErrorsFatal", 0) GUISetBkColor($background) $listview = GUICtrlCreateListView("Window Title |Window Handle|Process ID",20,20,475,175,$LVS_REPORT) $windows = WinList() GUICtrlCreateListViewItem("All Windows|",$listview) For $i = 1 To $windows[0][0] $winprocess = WinGetProcess($windows[$i][0],"") $regcheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM\Ignore",$windows[$i][0]) if $windows[$i][0] <> "" AND IsVisible($windows[$i][1]) AND $regcheck <> 1 then $appicon = GUICtrlCreateListViewItem($windows[$i][0] & "|" & $windows[$i][1] & "|" & $winprocess,$listview) GUICtrlSetImage($appicon,$windows[$i][0] & ".exe") endif Next GuiCtrlCreateLabel("1",20,225,10,25) $transslider = GUICtrlCreateSlider (35,220,200,20) GUICtrlSetLimit(-1,255,0) GuiCtrlCreateLabel("255",240,225,25,25) $oktrans = GUICtrlCreateButton ("Apply", 290, 220, 75,25) GUISetState() GUICtrlSetData($transslider,180) Do $msg2 = GUIGetMsg() if $msg2 = $oktrans then $split = StringSplit(GUICtrlRead(GUICtrlRead($listview)),"|") if $split[1] = "All Windows" then $windows = WinList() For $i = 1 To $windows[0][0] $regcheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM\Ignore",$windows[$i][0]) if $windows[$i][0] <> "" AND IsVisible($windows[$i][1]) AND $regcheck <> 1 then WinSetTrans($windows[$i][0],"",(GuiCtrlRead($transslider))) endif Next else WinSetTrans($split[1],"",(GuiCtrlRead($transslider))) endif endif Until $msg2 = $GUI_EVENT_CLOSE GUIDelete($child2) endif if $msg = $ontop or $msga = $ontoptray then $child3 = GUICreate("Set Window On Top",500, 300,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) $listview = GUICtrlCreateListView("Window Title |Window Handle|Process ID",20,20,475,175,$LVS_REPORT) Opt("RunErrorsFatal", 0) GUISetBkColor($background) $windows = WinList() For $i = 1 To $windows[0][0] $winprocess = WinGetProcess($windows[$i][0],"") $regcheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM\Ignore",$windows[$i][0]) if $windows[$i][0] <> "" AND IsVisible($windows[$i][1]) AND $regcheck <> 1 then GUICtrlCreateListViewItem($windows[$i][0] & "|" & $windows[$i][1] & "|" & $winprocess,$listview) endif Next $okontop = GUICtrlCreateButton ("Set", 90, 220, 75,25) $removeontop = GUICtrlCreateButton ("Remove", 170, 220, 75,25) GUISetState() Do $msg3 = GUIGetMsg() if $msg3 = $okontop then $split = StringSplit(GUICtrlRead(GUICtrlRead($listview)),"|") WinSetOnTop($split[1],"",1) endif if $msg3 = $removeontop then $split = StringSplit(GUICtrlRead(GUICtrlRead($listview)),"|") WinSetOnTop($split[1],"",0) endif Until $msg3 = $GUI_EVENT_CLOSE GUIDelete($child3) endif if $msg = $title or $msga = $titletray then $child4 = GUICreate("Set Window Title",500, 300,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) Opt("RunErrorsFatal", 0) GUISetBkColor($background) $listview = GUICtrlCreateListView("Window Title |Window Handle|Process ID",20,20,475,175,$LVS_REPORT) $windows = WinList() For $i = 1 To $windows[0][0] $winprocess = WinGetProcess($windows[$i][0],"") $regcheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM\Ignore",$windows[$i][0]) if $windows[$i][0] <> "" AND IsVisible($windows[$i][1]) AND $regcheck <> 1 then GUICtrlCreateListViewItem($windows[$i][0] & "|" & $windows[$i][1] & "|" & $winprocess,$listview) endif Next GuiCtrlCreateLabel("New Title:",10,225,55,25) $newtitle = GuiCtrlCreateInput("",70,220,150,25) $oktitle = GUICtrlCreateButton ("Apply", 250, 220, 75,25) GUISetState() Do $msg4 = GUIGetMsg() if $msg4 = $oktitle then $split = StringSplit(GUICtrlRead(GUICtrlRead($listview)),"|") WinSetTitle($split[1],"",(GuiCtrlRead($newtitle))) endif Until $msg4 = $GUI_EVENT_CLOSE GUIDelete($child4) endif if $msg = $ignore or $msga = $ignoretray then $child5 = GUICreate("Set Window Ignore List",750, 300,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) Opt("RunErrorsFatal", 0) GUISetBkColor($background) $listview1 = GUICtrlCreateListView("Window Title |Window Handle|Process ID",20,20,325,175,$LVS_REPORT) $listview2 = GUICtrlCreateListView("Ignored Windows |Window Handle|Process ID",400,20,325,175,$LVS_REPORT) $windows = WinList() For $i = 1 To $windows[0][0] $winprocess = WinGetProcess($windows[$i][0],"") $regcheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM\Ignore",$windows[$i][0]) if $windows[$i][0] <> "" AND IsVisible($windows[$i][1]) AND $regcheck <> 1 then GUICtrlCreateListViewItem($windows[$i][0] & "|" & $windows[$i][1] & "|" & $winprocess,$listview1) elseif $windows[$i][0] <> "" AND IsVisible($windows[$i][1]) AND $regcheck = 1 then GUICtrlCreateListViewItem($windows[$i][0] & "|" & $windows[$i][1] & "|" & $winprocess,$listview2) endif Next $add = GUICtrlCreateButton ("->", 360, 60, 25,25) $delete = GUICtrlCreateButton ("<-", 360, 120, 25,25) GuiCtrlCreateLabel("Window Title:",225,225,75,25) $ignoreinput = GuiCtrlCreateInput("",300,220,150,25) $addignore = GUICtrlCreateButton ("Add", 475, 220, 75,25) GUISetState() Do $msg5 = GUIGetMsg() if $msg5 = $add then $split = StringSplit(GUICtrlRead(GUICtrlRead($listview1)),"|") GUICtrlCreateListViewItem($split[1] & "|" & $split[2] & "|" & $split[3],$listview2) GuiCtrlDelete(GUICtrlRead($listview1)) RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM\Ignore", $split[1], "REG_SZ", 1) endif if $msg5 = $delete then $split = StringSplit(GUICtrlRead(GUICtrlRead($listview2)),"|") GUICtrlCreateListViewItem($split[1] & "|" & $split[2] & "|" & $split[3],$listview1) GuiCtrlDelete(GUICtrlRead($listview2)) RegDelete("HKEY_CURRENT_USER\SOFTWARE\WM\Ignore", $split[1]) endif if $msg5 = $addignore then endif Until $msg5 = $GUI_EVENT_CLOSE GUIDelete($child5) endif if $msg = $options or $msga = $optionstray then $shadecheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM","Shading") $minimizecheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM","Minimize") $alwaysontopcheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM","AlwaysOnTop") $startonbootcheck = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","WM") $child6 = GUICreate("Options",300, 300,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) Opt("RunErrorsFatal", 0) $color = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM", "Color") GUISetBkColor($background) GuiCtrlCreateLabel("Change Background Color:",20,25,150,25) $bkcolorchange = GUICtrlCreateCombo ("Black", 160, 20, 75,20,$CBS_DROPDOWNLIST) GUICtrlSetData(-1,"Blue|Red|Green|Yellow|Purple|Gray|White|Orange",$color) $shading = GuiCtrlCreateCheckBox("Enable Middle-Click Shading",20,70,175,25) if $shadecheck = 1 then GuiCtrlSetState($shading,$GUI_CHECKED) elseif $shadecheck = 0 then GuiCtrlSetState($shading,$GUI_UNCHECKED) endif $minimize = GuiCtrlCreateCheckBox("Start Minimized to Tray",20,110,175,25) if $minimizecheck = 1 then GuiCtrlSetState($minimize,$GUI_CHECKED) elseif $minimizecheck = 0 then GuiCtrlSetState($minimize,$GUI_UNCHECKED) endif $alwaysontop = GuiCtrlCreateCheckBox("Always On Top",20,150,175,25) if $alwaysontopcheck = 1 then GuiCtrlSetState($alwaysontop,$GUI_CHECKED) elseif $alwaysontopcheck = 0 then GuiCtrlSetState($alwaysontop,$GUI_UNCHECKED) endif $startonboot = GuiCtrlCreateCheckBox("Start On Boot",20,190,175,25) if $startonbootcheck = @ScriptFullPath then GuiCtrlSetState($startonboot,$GUI_CHECKED) elseif $startonbootcheck <> @ScriptFullPath then GuiCtrlSetState($startonboot,$GUI_UNCHECKED) endif $apply = GUICtrlCreateButton ("Apply", 80, 250, 75,25) $close = GUICtrlCreateButton ("Close", 170, 250, 75,25) GUISetState() Do $msg6 = GUIGetMsg() if $msg6 = $apply then if GUICtrlRead($bkcolorchange) = "Black" then Assign("newcolor","0x000000") elseif GUICtrlRead($bkcolorchange) = "Blue" then Assign("newcolor","0x0000FF") elseif GUICtrlRead($bkcolorchange) = "Red" then Assign("newcolor","0xFF0000") elseif GUICtrlRead($bkcolorchange) = "Green" then Assign("newcolor","0x009900") elseif GUICtrlRead($bkcolorchange) = "Yellow" then Assign("newcolor","0xFFFF00") elseif GUICtrlRead($bkcolorchange) = "Purple" then Assign("newcolor","0x660099") elseif GUICtrlRead($bkcolorchange) = "Gray" then Assign("newcolor","0x999999") elseif GUICtrlRead($bkcolorchange) = "White" then Assign("newcolor","0xFFFFFF") elseif GUICtrlRead($bkcolorchange) = "Orange" then Assign("newcolor","0xFF9900") endif RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Background","REG_SZ",$newcolor) RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Color","REG_SZ",GUICtrlRead($bkcolorchange)) if GuiCtrlRead($shading) = $GUI_CHECKED then RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Shading","REG_SZ",1) elseif GuiCtrlRead($shading) = $GUI_UNCHECKED then RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Shading","REG_SZ",0) endif if GuiCtrlRead($minimize) = $GUI_CHECKED then RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Minimize","REG_SZ",1) elseif GuiCtrlRead($minimize) = $GUI_UNCHECKED then RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Minimize","REG_SZ",0) endif if GuiCtrlRead($alwaysontop) = $GUI_CHECKED then RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","AlwaysOnTop","REG_SZ",1) GUICtrlSetState($ontopitem,$GUI_CHECKED) elseif GuiCtrlRead($alwaysontop) = $GUI_UNCHECKED then RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","AlwaysOnTop","REG_SZ",0) GUICtrlSetState($ontopitem,$GUI_UNCHECKED) endif if GuiCtrlRead($startonboot) = $GUI_CHECKED then RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","WM","REG_SZ",@ScriptFullPath) GuiCtrlSetState($toggleitem,$GUI_CHECKED) elseif GuiCtrlRead($startonboot) = $GUI_UNCHECKED then RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","WM") GuiCtrlSetState($toggleitem,$GUI_UNCHECKED) endif endif if $msg6 = $close then ExitLoop endif Until $msg6 = $GUI_EVENT_CLOSE GUIDelete($child6) endif if $msg = $showhide or $msga = $showhidetray then $child7 = GUICreate("Show/Hide Windows",750, 300,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) Opt("RunErrorsFatal", 0) GUISetBkColor($background) $listview1 = GUICtrlCreateListView("Visable Windows |Window Handle|Process ID",20,20,325,175,$LVS_REPORT) $listview2 = GUICtrlCreateListView("Hidden Windows |Window Handle|Process ID",400,20,325,175,$LVS_REPORT) $windows = WinList() For $i = 1 To $windows[0][0] $winprocess = WinGetProcess($windows[$i][0],"") $regcheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM\Ignore",$windows[$i][0]) $hiddencheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM\Hidden",$windows[$i][0]) if $windows[$i][0] <> "" AND IsVisible($windows[$i][1]) AND $regcheck <> 1 then GUICtrlCreateListViewItem($windows[$i][0] & "|" & $windows[$i][1] & "|" & $winprocess,$listview1) elseif $regcheck <> 1 AND $hiddencheck = 1 then GUICtrlCreateListViewItem($windows[$i][0] & "|" & $windows[$i][1] & "|" & $winprocess,$listview2) endif Next $addhidden = GUICtrlCreateButton ("->", 360, 60, 25,25) $deletehidden = GUICtrlCreateButton ("<-", 360, 120, 25,25) GUISetState() Do $msg7 = GUIGetMsg() if $msg7 = $addhidden then $split = StringSplit(GUICtrlRead(GUICtrlRead($listview1)),"|") GUICtrlCreateListViewItem($split[1] & "|" & $split[2] & "|" & $split[3],$listview2) GuiCtrlDelete(GUICtrlRead($listview1)) WinSetState($split[1], "", @SW_HIDE) RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM\Hidden", $split[1], "REG_SZ", 1) endif if $msg7 = $deletehidden then $split = StringSplit(GUICtrlRead(GUICtrlRead($listview2)),"|") GUICtrlCreateListViewItem($split[1] & "|" & $split[2] & "|" & $split[3],$listview1) GuiCtrlDelete(GUICtrlRead($listview2)) WinSetState($split[1], "", @SW_SHOW) RegDelete("HKEY_CURRENT_USER\SOFTWARE\WM\Hidden", $split[1]) endif Until $msg7 = $GUI_EVENT_CLOSE GUIDelete($child7) endif if $msg = $wallpaper or $msga = $wallpapertray then $previewpaper = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper") $child8 = GUICreate("Change Wallpaper",650, 350,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) Opt("RunErrorsFatal", 0) GUISetBkColor($background) GUICtrlCreateLabel("Preview", 324, 15, 57, 17) $preview = GUICtrlCreatePic($previewpaper, 320, 31, 320, 256, BitOR($WS_GROUP,$WS_THICKFRAME)) $paperlist = GUICtrlCreateList("", 24, 31, 209, 292) $paperlistitem = IniReadSection(@scriptdir & "\filelist.ini","Files") For $i = 2 to $paperlistitem[0][0] $split = StringSplit($paperlistitem[$i][0], "\") GUICtrlSetData($paperlist, $split[$split[0]]) Next $oldlist = GUICtrlRead($paperlist) GUICtrlCreateLabel("Wallpapers", 24, 15, 57, 17) $new = GUICtrlCreateButton("New", 240, 39, 75, 25, 0) $delete = GUICtrlCreateButton("Delete", 240, 71, 75, 25, 0) $setpaper = GUICtrlCreateButton("Set", 240, 103, 75, 25, 0) $radio1 = GUICtrlCreateCheckbox("Tile", 336, 293, 41, 17) $radio2 = GUICtrlCreateCheckbox("Center", 392, 293, 57, 17) $radio3 = GUICtrlCreateCheckbox("Stretch", 464, 293, 73, 17) $oldlist = GUICtrlRead($paperlist) GUICtrlSetState($radio3, $GUI_CHECKED) GUISetState() Do $newlist = GUICtrlRead($paperlist) if $newlist <> $oldlist Then $previewitem = IniReadSection(@scriptdir & "\filelist.ini","Files") For $i = 2 to $previewitem[0][0] $previewsplit = StringSplit($previewitem[$i][0], "\") if $previewsplit[$previewsplit[0]] = GUICtrlRead($paperlist) then GUICtrlSetImage($preview, $previewitem[$i][0]) endif Next $oldlist = $newlist EndIf $msg8 = GUIGetMsg() if $msg8 = $radio1 then GUICtrlSetState($radio2, $GUI_UNCHECKED) GUICtrlSetState($radio3, $GUI_UNCHECKED) endif if $msg8 = $radio2 then GUICtrlSetState($radio1, $GUI_UNCHECKED) GUICtrlSetState($radio3, $GUI_UNCHECKED) endif if $msg8 = $radio3 then GUICtrlSetState($radio1, $GUI_UNCHECKED) GUICtrlSetState($radio2, $GUI_UNCHECKED) endif if $msg8 = $new then paperselect() endif if $msg8 = $delete then $paperlistitem = IniReadSection(@scriptdir & "\filelist.ini","Files") For $i = 2 to $paperlistitem[0][0] $split = StringSplit($paperlistitem[$i][0], "\") if $split[$split[0]] = GUICtrlRead($paperlist) then IniDelete(@scriptdir & "\filelist.ini","Files",$paperlistitem[$i][0]) endif Next $selected = _GUICtrlListSelectedIndex($paperlist) _GUICtrlListDeleteItem($paperlist, $selected) endif if $msg8 = $setpaper then $paperlistitem = IniReadSection(@scriptdir & "\filelist.ini","Files") For $i = 2 to $paperlistitem[0][0] $split = StringSplit($paperlistitem[$i][0], "\") if $split[$split[0]] = GUICtrlRead($paperlist) then If GUICtrlRead($radio1) = $GUI_CHECKED Then $style = 1 $tile = 1 applyimage($paperlistitem[$i][0],$style,$tile) ElseIf GUICtrlRead($radio2) = $GUI_CHECKED Then $style = 1 $tile = 0 applyimage($paperlistitem[$i][0],$style,$tile) ElseIf GUICtrlRead($radio3) = $GUI_CHECKED Then $style = 2 $tile = 0 applyimage($paperlistitem[$i][0],$style,$tile) Else MsgBox(0, "Error", "Please Select Display Style") endif endif Next endif Until $msg8 = $GUI_EVENT_CLOSE GUIDelete($child8) endif if $msg = $desktop1 or $msga = $desktop1tray then _ShowDesktop1() endif if $msg = $desktop2 or $msga = $desktop2tray then _ShowDesktop2() endif if $msg = $toggleitem then if BitAnd(GUICtrlRead($toggleitem),$GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($toggleitem,$GUI_UNCHECKED) RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "WM") else GUICtrlSetState($toggleitem,$GUI_CHECKED) RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "WM", "REG_SZ", @ScriptFullPath) endif endif if $msg = $ontopitem then if BitAnd(GUICtrlRead($ontopitem),$GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($ontopitem,$GUI_UNCHECKED) RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","AlwaysOnTop","REG_SZ", "0") WinSetOnTop("", "", 0) else GUICtrlSetState($ontopitem,$GUI_CHECKED) RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","AlwaysOnTop","REG_SZ", "1") WinSetOnTop("", "", 1) endif endif if $msg = $aboutitem then $child1 = GUICreate("About",220, 220,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) Opt("RunErrorsFatal", 0) GUISetBkColor($background) $font = "Ariel" Opt("RunErrorsFatal", 0) GUICtrlCreateLabel ($name, 50, 30, 150,30) GUICtrlSetFont (-1,10, 400, $font) GUICtrlCreateIcon("icons\windows.ico",-1,85,60,48,48) GUICtrlCreateLabel ("Written by MaQleod", 55, 120, 150,30) GUICtrlSetFont (-1,10, 400, $font) $aboutok = GUICtrlCreateButton ("OK", 75, 170, 75,25) GUISetState() Do $msg1 = GUIGetMsg() if $msg1 = $aboutok then ExitLoop endif Until $msg1 = $GUI_EVENT_CLOSE GUIDelete($child1) endif if $msg = $exititem or $msga = $exittray then ExitLoop endif If $msga = $restore Then GuiSetState(@SW_SHOW,$parent) GuiSetState(@SW_RESTORE,$parent) Opt("TrayIconHide", 0) EndIf If $msg = $GUI_EVENT_MINIMIZE Then GuiSetState(@SW_HIDE) EndIf Until $msg = $GUI_EVENT_CLOSE $newpos = WinGetPos($name,"") RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Xpos","REG_SZ",$newpos[0]) RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Ypos","REG_SZ",$newpos[1]) RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Desktop1","REG_SZ", "1") RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Desktop2","REG_SZ", "0") GUIDelete() Call("OnExit") Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Func _WinGetTrans($sTitle, $sText = "") Local $hWnd = WinGetHandle($sTitle, $sText) If Not $hWnd Then Return -1 Local $aRet = DllCall("user32.dll", "int", "GetLayeredWindowAttributes", "hwnd", $hWnd, "ptr", 0, "int_ptr", 0, "ptr", 0) If @error Or Not $aRet[0] Then Return -1 Return $aRet[3] EndFunc Func GetMouseInfo($hWndGUI, $MsgID, $WParam, $LParam) $shadecheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM\","Shading") Local $POINT = DllStructCreate("int;int") DllStructSetData($POINT,1,_LoWord($LParam)) DllStructSetData($POINT,2,_HiWord($LParam)) DLLCall("user32.dll","int","ScreenToClient","hwnd",HWnd($WParam),"ptr",DllStructGetPtr($POINT)) if DllStructGetData($POINT,2) < 0 and $shadecheck = 1 then $winhandle = $WParam $winstats = WinGetPos($winhandle,"") if $winstats[3] = 35 then $unshaded = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM\Shaded",$winhandle) WinMove(HWnd($winhandle),"",$winstats[0],$winstats[1],$winstats[2],$unshaded) else RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM\Shaded",$winhandle,"REG_SZ", $winstats[3]) WinMove(HWnd($winhandle),"",$winstats[0],$winstats[1],$winstats[2],35) endif else endif EndFunc Func OnExit() DLLCall("user32.dll","int","UnhookWindowsHookEx","hwnd",$hhMouse[0]) DLLCall("kernel32.dll","int","FreeLibrary","hwnd",$DLLinst[0]) EndFunc Func _HiWord(ByRef $x) Return BitShift($x, 16) EndFunc ; _HiWord() Func _LoWord(ByRef $x) Return BitAnd($x, 0xFFFF) EndFunc ; _LoWord() Func Handler() If $masterswitch = 0 Then $masterswitch = 1 Arrange() Else $masterswitch = 2 EndIf EndFunc Func Arrange() $window1 = -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] $regcheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM\Ignore",$window[$i][0]) If $window[$i][0] <> "" AND IsVisible($window[$i][1]) AND $regcheck <> 1 AND NOT StringInStr($window[$i][0],'Program Manager') Then $window1 = $window1 + 1 $win_title[$window1] = $window[$i][0] $win_size = WinGetPos($window[$i][0]) $win_0[$window1] = $win_size[0] $win_1[$window1] = $win_size[1] $win_2[$window1] = $win_size[2] $win_3[$window1] = $win_size[3] EndIf Next $x = 0 $y = 0 $winsx = 2 $winsy = 2 $switch = 0 For $i = 0 To $window1 - 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 If $masterswitch < 2 Then For $i = 0 to $window1 If $x = $winsx Then $x = 0 $y = $y + 1 EndIf 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 $window1 WinSetTrans($win_title[$i],'',$t) Next Next $win_under = '' While $masterswitch < 2 $MousePos = MouseGetPos() For $i = 0 To $window1 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 For $i = 0 to $window1 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 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 Func _showwins() $var = IniReadSection("desktops.ini", $activedesk) If @error Then return Else For $x = 1 To $var[0][0] WinSetState($var[($var[0][0] +1) -$x][0],"",@SW_SHOW) Next EndIf EndFunc Func _hidewins() $var = IniReadSection("desktops.ini", $activedesk) If @error Then return Else For $x = 1 To $var[0][0] WinSetState($var[($var[0][0] +1) -$x][0],"",@SW_HIDE) Next EndIf EndFunc Func _winget() $y = 0 $var = WinList() IniDelete("desktops.ini",$activedesk) For $x = 1 to $var[0][0] $ignorecheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM\Ignore",$var[$x][0]) If $var[$x][0] <> "" AND IsVisible($var[$x][1]) AND $var[$x][0] <> "Program Manager" AND $var[$x][0] <> "Desktop 1" AND $var[$x][0] <> "Desktop 2" and $ignorecheck <> 1 Then Iniwrite("desktops.ini",$activedesk,$var[$x][0],$var[$x][1]) $y = $y + 1 $winlist[$y] = $var[$x][0] EndIf Next $winlist[0] = $y EndFunc Func _ShowDesktop2() if $activedesk = 2 then elseif $activedesk = 1 then _winget() _hidewins() $activedesk = 2 _showwins() RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Desktop1","REG_SZ", "0") RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Desktop2","REG_SZ", "1") TrayItemSetState($desktop2tray,$TRAY_CHECKED) TrayItemSetState($desktop1tray,$TRAY_UNCHECKED) GuiCtrlSetState($desktop2,$GUI_DISABLE) GuiCtrlSetState($desktop1,$GUI_ENABLE) endif $newdesktop = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM","Wallpaper2") $newtile = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM","Tile2") $newstyle = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM","Style2") applyimage($newdesktop,$newstyle,$newtile) EndFunc Func _ShowDesktop1() if $activedesk = 1 then elseif $activedesk = 2 then _winget() _hidewins() $activedesk = 1 _showwins() RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Desktop1","REG_SZ", "1") RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Desktop2","REG_SZ", "0") TrayItemSetState($desktop1tray,$TRAY_CHECKED) TrayItemSetState($desktop2tray,$TRAY_UNCHECKED) GuiCtrlSetState($desktop1,$GUI_DISABLE) GuiCtrlSetState($desktop2,$GUI_ENABLE) endif $newdesktop = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM","Wallpaper1") $newtile = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM","Tile1") $newstyle = RegRead("HKEY_CURRENT_USER\SOFTWARE\WM","Style1") applyimage($newdesktop,$newstyle,$newtile) EndFunc Func _DockToScreenSide($hWindow) $hPos = WinGetPos($hWindow,"") if $hPos[0] + $hPos[2] > @DesktopWidth then WinMove($hWindow,"",@DesktopWidth - $hPos[2],$hPos[1]) endif if $hPos[1] + $hPos[3] > @DesktopHeight then WinMove($hWindow,"",$hPos[0],@DesktopHeight - $hPos[3]) endif if $hPos[0] < 1 then WinMove($hWindow,"",1,$hPos[1]) endif if $hPos[1] < 1 then WinMove($hWindow,"",$hPos[0],1) endif EndFunc Func paperselect() ;select new wallpaer and add to wallpapaer list in GUI $fileopened = FileOpenDialog("Select Wallpaper", $selectdir, "Images (*.jpg;*.jpeg;*.bmp;*.png;*.pic;*.img;*.gif)", 5) $split = StringSplit($fileopened, "\") GUICtrlSetData($paperlist, $split[$split[0]]) IniWrite(@scriptdir & "\filelist.ini","Files",$fileopened,1) EndFunc Func applyimage($s_path, $s_style, $s_tile) if $activedesk = 1 then RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Wallpaper1","REG_SZ",$s_path) RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Style1","REG_SZ",$s_style) RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Tile1","REG_SZ",$s_tile) elseif $activedesk = 2 then RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Wallpaper2","REG_SZ",$s_path) RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Style2","REG_SZ",$s_style) RegWrite("HKEY_CURRENT_USER\SOFTWARE\WM","Tile2","REG_SZ",$s_tile) endif $apply_type = StringRight($s_path, 4) If $apply_type = ".jpg" Or _ $apply_type = "jpeg" Or _ $apply_type = ".gif" Or _ $apply_type = ".pic" Or _ $apply_type = ".img" Or _ $apply_type = ".png" Then FileDelete(@WindowsDir & "\xwall.bmp") _GDI_StartUp() $hImage = _GDI_LoadFromFile($s_path) $sCLSID = _GDI_GetEncoderClsID("BMP") _GDI_SaveToFile($hImage, @ScriptDir & "\xwall.bmp", $sCLSID) _GDI_ShutDown() Else FileCopy($s_path, @ScriptDir & "\xwall.bmp", 1) EndIf RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", $s_style) RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", $s_tile) Sleep(250) RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","Wallpaper","REG_SZ",@ScriptDir & "\xwall.bmp") DllCall("User32.dll", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", @ScriptDir & "\xwall.bmp", "int", 0) Return(0) EndFunc Edited June 28, 2007 by maqleod [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
SleepyXtreme Posted May 31, 2007 Share Posted May 31, 2007 hate to be the bearer of bad news but this was already done http://www.autoitscript.com/forum/index.php?showtopic=46388 Link to comment Share on other sites More sharing options...
maqleod Posted May 31, 2007 Author Share Posted May 31, 2007 hate to be the bearer of bad news but this was already done http://www.autoitscript.com/forum/index.php?showtopic=46388that may be so, and it was only released a few days prior, but it doesn't do quite everything or serve quite the same purpose as the scropt I wrote, it's a lot more bulky for those who just simply want window management. [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
maqleod Posted June 11, 2007 Author Share Posted June 11, 2007 just added new features [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
maqleod Posted June 28, 2007 Author Share Posted June 28, 2007 new wallpaper management features added [u]You can download my projects at:[/u] Pulsar Software 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