Jump to content

Multiple Desktop


Ghastly_MIB
 Share

Recommended Posts

Hey,

I've ones started to make a program to have 2 desktops.

You can switch between them with a key... I wan't to give the basic script to that..

Use the NUMPAD - to chance the desktop. Use is a your own risk, but it works :P;):mad2:

$titel = "Boss protections"
#include <Constants.au3>
;~ Opt("WinTitleMatchMode", 4)
Opt("WinWaitDelay", 0)
Dim $desktop = 0
Global $bezig_desktop=0, $desktop2_nr=0, $desktop1_nr=0
HotKeySet("{NUMPADSUB}", "desktops")
While 1
    Sleep(1000)
Wend

Func desktops()
    If $bezig_desktop = 1 Then Return
    $bezig_desktop = 1
    $list = WinList()
    If $desktop2_nr = 0 Then
        For $n=1 To $list[0][0]
            $RetVal = WinGetState($list[$n][1])
            If $list[$n][0] <> "" AND $list[$n][0] <> "Program Manager" AND BitAND($RetVal, 2) Then
                $desktop2_nr = $desktop2_nr+1
                Assign("desktop2"&$desktop2_nr, $list[$n][1], 2)
                WInSetState($list[$n][1], "", @SW_HIDE)
            EndIf
        Next
        For $n = 1 To $desktop1_nr
            WInSetState(Eval("desktop1"&$n), "", @SW_SHOW)
        Next
        $desktop1_nr = 0
    Else
        For $n=1 To $list[0][0]
            $RetVal = WinGetState($list[$n][1])
            If $list[$n][0] <> "" AND $list[$n][0] <> "Program Manager" AND BitAND($RetVal, 2) Then
                $desktop1_nr = $desktop1_nr+1
                Assign("desktop1"&$desktop1_nr, $list[$n][1], 2)
                WInSetState($list[$n][1], "", @SW_HIDE)
            EndIf
        Next
        For $n = 1 To $desktop2_nr
            WInSetState(Eval("desktop2"&$n), "", @SW_SHOW)
        Next
        $desktop2_nr = 0
    EndIf
    $bezig_desktop = 0
EndFunc
Link to comment
Share on other sites

@TK: Each time - is pressed it hides all visable windows and displays the ones it previously hid

@Nuffilein805: You could set up both configurations the way you want it. Some windows shown here. Some windows shown there. Each time you press - it will switch between them.

Edited by gamerman2360
Link to comment
Share on other sites

Added more junk to it ;):

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:         Ghastly_MIB, Edited...
;
; Script Function:
;    Hides your windows and replaces them with another set of windows.
; 
;   HotKeys: CTRL + Numberpad{-} = Switch windows, CTRL + ALT + ESC = Exit
;   (The exit hotkey only works[when you configure it to beta] after exit is
;   clicked in the tray icon menu, the other option is part of it's disguise.
;   It's disguised so it looks like it's supposed to put the date in your clipboard.)
;
; ----------------------------------------------------------------------------
opt("WinTitleMatchMode", 2)
opt("WinWaitDelay", 0)
Global $desktop2_nr = 0, $desktop1_nr = 0, $exitready
HotKeySet("^{NUMPADSUB}", "Hide");CTRL(^) + NUMPADSUB
;Comment this(below) if you don't use beta(Disguises the tray ico)
    opt("TrayMenuMode", 1)
    $DayOWeek = StringSplit("Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday", "|")
    $MonthOYear = StringSplit("January|February|March|April|May|June|July|August|September|October|November|December", "|")
    TraySetToolTip($DayOWeek[@WDAY] & ", " & $MonthOYear[@MON] & " " & @MDAY & ", " & @YEAR)
    TraySetClick(8)
    TraySetIcon("C:\WINDOWS\system32\shell32.dll", 167)
    $traygettime = TrayCreateItem("Get Date")
    TrayCreateItem("")
    $trayexit = TrayCreateItem("Exit")
;Uncomment this(below) if you dont use beta(Makes sure it can't close easily)
;Break(0)
;HotKeySet("^!{ESC}", "Terminate");CTRL(^) + ALT(!) + ESC (Confirms Exit)
;You must have had one of the last 2 sections uncommented and the other commented

While 1
    $tray = TrayGetMsg()
    Select
    Case $tray = $trayexit
        If $exitready Then
            HotKeySet("^!{ESC}")
            TrayItemSetState($trayexit, 4)
            $exitready = 0
        Else
            HotKeySet("^!{ESC}", "Terminate");CTRL(^) + ALT(!) + ESC (Confirms Exit)
            TrayItemSetState($trayexit, 1)
            $exitready = 1
        EndIf
    Case $tray = $traygettime
        ClipPut($DayOWeek[@WDAY] & ", " & $MonthOYear[@MON] & " " & @MDAY & ", " & @YEAR)
    EndSelect
;Comment the top part of the While if you don't have beta and uncomment the Sleep() below
;Sleep(30000)
WEnd

Func Hide()
    HotKeySet("{NUMPADSUB}")
    $list = WinList()
    If $desktop2_nr = 0 Then
        For $n = 1 To $list[0][0]
            If $list[$n][0] <> "" And $list[$n][0] <> "Program Manager" And BitAND(WinGetState($list[$n][1]), 2) Then
                $desktop2_nr = $desktop2_nr + 1
                Assign("desktop2" & $desktop2_nr, $list[$n][1], 2)
                WinSetState($list[$n][1], "", @SW_HIDE)
            EndIf
        Next
        For $n = 1 To $desktop1_nr
            WinSetState(Eval("desktop1" & $n), "", @SW_SHOW)
        Next
        $desktop1_nr = 0
    Else
        For $n = 1 To $list[0][0]
            If $list[$n][0] <> "" And $list[$n][0] <> "Program Manager" And BitAND(WinGetState($list[$n][1]), 2) Then
                $desktop1_nr = $desktop1_nr + 1
                Assign("desktop1" & $desktop1_nr, $list[$n][1], 2)
                WinSetState($list[$n][1], "", @SW_HIDE)
            EndIf
        Next
        For $n = 1 To $desktop2_nr
            WinSetState(Eval("desktop2" & $n), "", @SW_SHOW)
        Next
        $desktop2_nr = 0
    EndIf
    HotKeySet("^{NUMPADSUB}", "Hide")
EndFunc  ;==>Switch

Func OnAutoItExit()
    For $n = 1 To $desktop1_nr
        WinSetState(Eval("desktop1" & $n), "", @SW_SHOW)
    Next
    For $n = 1 To $desktop2_nr
        WinSetState(Eval("desktop2" & $n), "", @SW_SHOW)
    Next
EndFunc

Func Terminate()
    Exit
EndFunc
Edited by gamerman2360
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...