Dampe Posted October 16, 2010 Share Posted October 16, 2010 Wrote it to use at work. Change the hotkeys at the top. expandcollapse popup#include <array.au3> Local $Win_Max_Number = 4 Local $Key_Forward = "{PAUSE}" Local $Key_Backward = "{HOME}" Local $Window_Array[5][25] Local $Window_Current_Arr = 1 Local $Window_Current_Active = 1 Local $Dll_User_32 = DllOpen("user32.dll") HotKeySet($Key_Forward, "_ScreenForward") HotKeySet($Key_Backward, "_ScreenBackward") _GenerateWindowArray() While 1 Sleep(50) _UpdateWindowArray() WEnd Func _GenerateWindowArray() $var = WinList() For $i = 1 To $var[0][0] If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then $Window_Array[$Window_Current_Active][$Window_Current_Arr] = $var[$i][1] $Window_Current_Arr += 1 EndIf Next EndFunc ;==>_GenerateWindowArray Func _UpdateWindowArray() For $x = 1 to 4 For $i = 1 to 24 If not WinExists ($Window_Array[$x][$i]) Then $Window_Array[$x][$i] = "" $Window_Current_Arr -= 1 EndIf Next Next $var = WinList() For $i = 1 To $var[0][0] If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then If _ArraySearch($Window_Array, $var[$i][1]) = -1 Then $Window_Array[$Window_Current_Active][$Window_Current_Arr] = $var[$i][1] $Window_Current_Arr += 1 EndIf EndIf Next EndFunc Func _ScreenForward() If $Window_Current_Active < $Win_Max_Number Then $Window_Current_Active += 1 ConsoleWrite ("Screen #: " & $Window_Current_Active & @CRLF) For $i = 1 to 24 If $Window_Array[$Window_Current_Active-1][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active-1][$i], 0) EndIf Next For $i = 1 to 24 If $Window_Array[$Window_Current_Active][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active][$i], 1) EndIf Next EndIf EndFunc ;==>_ScreenForward Func _ScreenBackward() If $Window_Current_Active > 1 Then $Window_Current_Active -= 1 ConsoleWrite ("Screen #: " & $Window_Current_Active & @CRLF) For $i = 1 to 24 If $Window_Array[$Window_Current_Active+1][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active+1][$i], 0) EndIf Next For $i = 1 to 24 If $Window_Array[$Window_Current_Active][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active][$i], 1) EndIf Next EndIf EndFunc ;==>_ScreenBackward Func _SetWindowState($hWnd, $sCode) DllCall($Dll_User_32, "bool", "ShowWindow", "HWND", $hWnd, "int", $sCode) EndFunc ;==>_SetWindowState Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Link to comment Share on other sites More sharing options...
Realm Posted October 16, 2010 Share Posted October 16, 2010 Hello Dampe, Nice idea for certain occasions or quick profile swapping. However I have found a couple problems. Minor Problems 1. on the other virtual desktops, the desktop icons disappear. 2. once the start screen has been opened, it leaves a minor shadow behind when closed. Major Problem: I closed the script while on a Virtual Desktop, Now all of my desktop icons and configuration is gone. Not to worry for me, I back up my desktop. Maybe should include an exit function, that will deliver you back to the main desktop, or a way to duplicate desktop on the virtual desktops. Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. Link to comment Share on other sites More sharing options...
FireFox Posted October 16, 2010 Share Posted October 16, 2010 @Dampe I've already tried to do it on win7 with an other method and it does not work. FireFox. Link to comment Share on other sites More sharing options...
Dampe Posted October 17, 2010 Author Share Posted October 17, 2010 @Dampe I've already tried to do it on win7 with an other method and it does not work. FireFox. What? Yes it does. I fixed the script here. expandcollapse popup#include <array.au3> Local $Win_Max_Number = 4 Local $Key_Forward = "{PAUSE}" Local $Key_Backward = "{HOME}" Local $Window_Array[5][25] Local $Window_Current_Arr = 1 Local $Window_Current_Active = 1 OnAutoItExitRegister( "_Au3Exit" ) Local $Dll_User_32 = DllOpen("user32.dll") HotKeySet($Key_Forward, "_ScreenForward") HotKeySet($Key_Backward, "_ScreenBackward") _GenerateWindowArray() While 1 Sleep(50) _UpdateWindowArray() WEnd Func _GenerateWindowArray() $var = WinList() For $i = 1 To $var[0][0] If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then If $var[$i][0] <> "Start" AND $var[$i][0] <> "Program Manager" Then $Window_Array[$Window_Current_Active][$Window_Current_Arr] = $var[$i][1] $Window_Current_Arr += 1 EndIf EndIf Next EndFunc ;==>_GenerateWindowArray Func _UpdateWindowArray() For $x = 1 to 4 For $i = 1 to 24 If not WinExists ($Window_Array[$x][$i]) Then $Window_Array[$x][$i] = "" $Window_Current_Arr -= 1 EndIf Next Next $var = WinList() For $i = 1 To $var[0][0] If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then If $var[$i][0] <> "Start" AND $var[$i][0] <> "Program Manager" Then If _ArraySearch($Window_Array, $var[$i][1]) = -1 Then $Window_Array[$Window_Current_Active][$Window_Current_Arr] = $var[$i][1] $Window_Current_Arr += 1 EndIf EndIf EndIf Next EndFunc Func _ScreenForward() If $Window_Current_Active < $Win_Max_Number Then $Window_Current_Active += 1 ConsoleWrite ("Screen #: " & $Window_Current_Active & @CRLF) For $i = 1 to 24 If $Window_Array[$Window_Current_Active-1][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active-1][$i], 0) EndIf Next For $i = 1 to 24 If $Window_Array[$Window_Current_Active][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active][$i], 1) EndIf Next EndIf EndFunc ;==>_ScreenForward Func _ScreenBackward() If $Window_Current_Active > 1 Then $Window_Current_Active -= 1 ConsoleWrite ("Screen #: " & $Window_Current_Active & @CRLF) For $i = 1 to 24 If $Window_Array[$Window_Current_Active+1][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active+1][$i], 0) EndIf Next For $i = 1 to 24 If $Window_Array[$Window_Current_Active][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active][$i], 1) EndIf Next EndIf EndFunc ;==>_ScreenBackward Func _SetWindowState($hWnd, $sCode) DllCall($Dll_User_32, "bool", "ShowWindow", "HWND", $hWnd, "int", $sCode) EndFunc ;==>_SetWindowState Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Func _Au3Exit() For $x = 1 to $Win_Max_Number For $i = 1 to 24 _SetWindowState($Window_Array[$x][$i], 1) Next Next DllClose ($Dll_User_32) EndFunc Link to comment Share on other sites More sharing options...
Damein Posted October 19, 2010 Share Posted October 19, 2010 Hmmm, I got a suggestion, dunno if its possible. Maybe a PIP function? Like on TV's, where you can view 1 channel in most of the screen size and a second in a small section in the bottom right? I like watching movies while doing something and this could be handy if I could watch it on one VD and do other things on the other while still viewing that screen. Thanks, love the script by the way, how'd you come up with this and figure out the commands? Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
Dampe Posted October 19, 2010 Author Share Posted October 19, 2010 Hmmm, I got a suggestion, dunno if its possible.Maybe a PIP function?Like on TV's, where you can view 1 channel in most of the screen size and a second in a small section in the bottom right?I like watching movies while doing something and this could be handy if I could watch it on one VD and do other things on the other while still viewing that screen.Thanks, love the script by the way, how'd you come up with this and figure out the commands?I guess it would be possible but pretty impracticable.If you want to watch a movie at the same time, have a look at VLC Media player.Pretty sure you can right click and set window to be always on top which would allow you to do other things on the computer whilst watching a movie..I use linux at home and quite a few linux desktop enviroments support virtual desktops, so I wanted one for work.I guess I learn the commands from years of programming and knowledge of the windows internal functions.I was originally using the autoit setwindowstate() function but it was too slow, hence using the user_32.dll function instead.Peace Link to comment Share on other sites More sharing options...
trancexx Posted October 19, 2010 Share Posted October 19, 2010 (edited) I was originally using the autoit setwindowstate() function but it was too slow, hence using the user_32.dll function instead.Slow how? It should be faster than any UD function made for similar purposes. You probably should have add Opt("WinWaitDelay", 0) because that function, WinSetState that is, obeys this option setting. Edited October 19, 2010 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Dampe Posted October 19, 2010 Author Share Posted October 19, 2010 Slow how? It should be faster than any UD function made for similar purposes. You probably should have add Opt("WinWaitDelay", 0) because that function, WinSetState that is, obeys this option setting.Ah that would make sense Link to comment Share on other sites More sharing options...
Damein Posted October 20, 2010 Share Posted October 20, 2010 Hmm, that sucks, I was looking forward to that Maybe one day I can try and do it myself. Either way, nice script. Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
disposable Posted May 30, 2011 Share Posted May 30, 2011 Had the exact same problem with making a virtual desktop switcher and I couldn't figure out why hiding and showing ~5 open windows would take ~2 seconds. Set the Winwait delay to 0 and everything worked like a charm! 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