Sign in to follow this  
Followers 0

Multiple Desktops - V 1.5.1

173 posts in this topic

Posted (edited)

Multiple Desktops

The point of this program: As most of you know you have a desktop. Your desktop has a wallpaper and files. This program lets you have multiple desktops.

Screenshots

Multiple Desktops Installer v1.5.1

Previous number of downloads: 1643

Multiple Desktops v1.5.1

This is for those of you that already have Multiple Desktops up and running. Just replace the Multiple Desktops.exe in your install location with this one.

Alternative Links:

Multiple Desktops Installer

Multiple Desktops.exe

Source Code

--> Go here to skip the replies about older versions of this program <--

The code for this is somewhat organized and practically not commented. Should work for 3.2.11.1, download here.

Previous number of downloads: 411

Features

  • Custom made GUI for all customizable options
  • Custom made toolbar for easy desktop transition
Important notes:
  • While not in use, the files and folder in the other desktops are stored in @AppDataDir & '\Desktops
  • Folders and files are moved with this program, if something is really important you might want a backup
  • Multiple Desktops now uses the registry
Logic Bug

The problems with having desktops, where files are constantly being moved, are annoying. For example, if you select an image for a desktop background that is the desktop half the time the image will not be where it's supposed to be so you changing the desktop wallpaper wont' work. This also means that things like .iso files that are mounted stay on the desktop no matter what (as well as things you might have downloading from the internet). My workaround of this problem was to mount all .iso files and download all files to my "My Documents". Most of the contents of "My Documents" went onto their own desktops (not my music though because that needs to always be kept in the same place).

Small notice until I make a helpfile:

If you look under Options > Windows you will notice there is "Type one" and "Type two". This refers to the way that windows are hidden. In type one, all windows in your list will be hidden when you change desktops. In type two all files except the ones on your list will be hidden. If you are using hidden windows they will only appear on the desktop that they originated from. For example: I have an AutoIt desktop, I have added "Scite" and "AutoIt Help" to my exclude list while using "Type One". If I am currently in the AutoIt desktop and have "AutoIt - Help" open then when I change desktops AutoIt help will be hidden. I will only be able to see it again if I go to the AutoIt desktop again.

To Do List

  • Make a helpfile
  • Use Windows GUI instead of my custom one for efficiency's sake
Edited by Ichigo

Share this post


Link to post
Share on other sites



Posted

i get a error

Subscript used with non-Array variable.:

For $a = 1 to $priorDesktops[0]

For $a = 1 to $priorDesktops^ ERROR

Share this post


Link to post
Share on other sites

Posted

i get a error

Subscript used with non-Array variable.:

For $a = 1 to $priorDesktops[0]

For $a = 1 to $priorDesktops^ ERROR

I fixed that just now, I realized I had left out the include <file.au3> or whatever it is...

Share this post


Link to post
Share on other sites

Posted (edited)

I like the idea.. nice , but I haven't tried your script yet...

Just a question about

RunWait(@ScriptDir & "\pvw32con.exe " & '"' & $path & '"' & " -w --oo " & '"' & @WindowsDir & "\xwall.bmp" & '"', @ScriptDir, @SW_HIDE)

pvw32con.exe is for ?

I can work out what it's for but maybe some mention of it in your post to save ppl guessing or getting errors.

If the file is not important then maybe set Opt("RunErrorsFatal", 0) or check to see if the file is there before trying to run it , if not do both maybe

Just a suggestion :shocked:

Cheers

Edited by smashly

Share this post


Link to post
Share on other sites

Posted (edited)

I made a script very similar to this one, pvw32con.exe is to convert just about any image format into .bmp because windows XP and below will only take a desktop is that a .bmp. Yes i know you can use a .jpg in the desktop properties but windows converts it to a .bmp and moves a copy to a folder in the user directory and then sets it. Supposedly Vista doesn't have this problem but i haven't been able to test it as i don't have Vista. So if you plan on applying any wallpapers that are not .bmp's you will need it.

You can get pvw32con.exe from http://www.pictview.com/pvw.htm, be sure to get the command line version.

EDIT: i am also getting For $a = 1 to $priorDesktops^ ERROR

EDIT2: i know what the problem is, if you dont have anydesktops allready in \desktops _FileListToArray returns 0 and sets @error to 4

Edited by smstroble

Share this post


Link to post
Share on other sites

Posted (edited)

I like the idea.. nice , but I haven't tried your script yet...

Just a question about

RunWait(@ScriptDir & "\pvw32con.exe " & '"' & $path & '"' & " -w --oo " & '"' & @WindowsDir & "\xwall.bmp" & '"', @ScriptDir, @SW_HIDE)

pvw32con.exe is for ?

I can work out what it's for but maybe some mention of it in your post to save ppl guessing or getting errors.

If the file is not important then maybe set Opt("RunErrorsFatal", 0) or check to see if the file is there before trying to run it , if not do both maybe

Just a suggestion :shocked:

Cheers

Hmm, not a very good post, first I leave out a line and then forget an attachment... Anyways, look at what smstrobble said. I also attached the file onto the original post! Edited by Piano_Man

Share this post


Link to post
Share on other sites

Posted

I made a script very similar to this one, pvw32con.exe is to convert just about any image format into .bmp because windows XP and below will only take a desktop is that a .bmp. Yes i know you can use a .jpg in the desktop properties but windows converts it to a .bmp and moves a copy to a folder in the user directory and then sets it. Supposedly Vista doesn't have this problem but i haven't been able to test it as i don't have Vista. So if you plan on applying any wallpapers that are not .bmp's you will need it.

You can get pvw32con.exe from http://www.pictview.com/pvw.htm, be sure to get the command line version.

EDIT: i am also getting For $a = 1 to $priorDesktops^ ERROR

EDIT2: i know what the problem is, if you dont have anydesktops allready in \desktops _FileListToArray returns 0 and sets @error to 4

Thanks for explaining what the pvw32con.exe does...

Is that error with

#Include <Array.au3>
#include <File.au3>

It needs the File one for _FileListToArray so if it's not there put it in and it should work.

Share this post


Link to post
Share on other sites

Posted

If you dont have anything allready in that folder FileListToArray will not populate $prevdesktops and this $prevdesktops[0] dosent exsist as its not an array. I made a simple fix for that by making it check if it was an array before running that part of the scipt that was having the problem and then it piled all my icons onto the same file so now i have to fix my desktop. Nice script but make shure everything works properly if you dont have any files in the desktops dir.

Share this post


Link to post
Share on other sites

Posted

Even with the include added in, I still get the same error that thenewkid did.

Share this post


Link to post
Share on other sites

Posted

gettin the error also...sry m8 :shocked:

Share this post


Link to post
Share on other sites

Posted (edited)

Ok, i got it working for me


;Thanks to xcal for the function that updates the desktop wallpaper!
#Include <Array.au3>
#include <File.au3>
#NoTrayIcon
Opt('TrayOnEventMode',1)
Opt('TrayMenuMode',1)
Opt('OnExitFunc','_Exit')

Dim $desktops[50][2]

$open = TrayCreateMenu('Open...')

$create = TrayCreateItem('Create New Desktop')
    TrayItemSetOnEvent($create, '_NewDesktop')
    TrayItemSetState($create, 512)
TrayCreateItem('')
$delete = TrayCreateItem('Delete a Desktop')
    TrayItemSetOnEvent($delete, '_Delete')
TrayCreateItem('')
$exit = TrayCreateItem('Exit')
    TrayItemSetOnEvent($exit, '_Exit')

$desktopsDir = @AppDataDir & '\Desktops'
If DirGetSize($desktopsDir, 1) > 0 then DirCreate($desktopsDir & '\Default')

$currentDesktop = IniRead($desktopsDir & '\DesktopInfo.ini', 'Startup Info', 'Last used desktop', '')
If  $currentDesktop = '' then
    IniWrite($desktopsDir & '\DesktopInfo.ini', 'Startup Info', 'Last used desktop', 'Default')
    $currentDesktop = 'Default'
EndIf

If IniRead($desktopsDir, $currentDesktop, 'Current', '') = '' then
    IniWrite($desktopsDir & '\DesktopInfo.ini', 'Background', $currentDesktop, RegRead('HKEY_CURRENT_USER\Control Panel\Desktop', 'Wallpaper'))
EndIf

$priorDesktops = _FileListToArray($desktopsDir, '**', 2)

$count = 1
If IsArray($priorDesktops) then
    If $priorDesktops[0] > 0 then
        For $a = 1 to $priorDesktops[0]
            $desktops[$a][0] = TrayCreateItem($priorDesktops[$a], $open)
                TrayItemSetOnEvent($desktops[$a][0], '_SwitchDesktop')
            $desktops[$a][1] = $priorDesktops[$a]
            If $priorDesktops[$a] = $currentDesktop then
                TrayItemSetState($desktops[$a][0], 1)
                $currentIndex = $a
            EndIf
            $count += 1
        Next   
    EndIf
Else
    $desktops[1][0] = TrayCreateItem('Default', $open)
        TrayItemSetState($desktops[1][0], 1)
        TrayItemSetOnEvent($desktops[1][0], '_SwitchDesktop')
    $desktops[1][1] = 'Default'
    $count = 2
    $currentIndex = 1
EndIf
TraySetState()

While 1
    $priorDesktops = _FileListToArray($desktopsDir, '**', 2)
   
    If IsArray($priorDesktops) then
        If $count - 1 > $priorDesktops[0] then 
            For $a = 1 to $count
                $pass = False
                For $b = 1 to $priorDesktops[0]
                    If $priorDesktops[$b] = $desktops[$a][1] then $pass = True
                Next
                If Not $pass then TrayItemDelete($desktops[$a][0])
            Next
        EndIf
    EndIf
    Sleep(200)
Wend

Func _SwitchDesktop()
    $files = _FileListToArray(@DesktopDir, "*.*", 1)
   
    _StoreDesktop('','')
       
    TrayItemSetState($desktops[$currentIndex][0], 4)
       
    For $a = 1 to $count
        If @Tray_ID = $desktops[$a][0] then
            $currentDesktop = $desktops[$a][1]
            $currentIndex = $a
        EndIf
    Next
   
    TrayItemSetState($desktops[$currentIndex][0], 1)
   
    _StoreDesktop(@DesktopDir, $desktopsDir & '\' & $currentDesktop, 0)
   
    $newWallpaper = IniRead($desktopsDir &'\DesktopInfo.ini' , 'Background', $currentDesktop, '')
    If $newWallpaper <> '' then _ChangeDesktopBackground($newWallpaper)
   
    TrayItemSetState($desktops[$a][0], 1)   
   
    WinActivate('Program Manager')
    Send('{F5}')
EndFunc

Func _StoreDesktop($to, $from, $type = 1)
    If $from = '' then $from = @DesktopDir
    If $to = '' then $to = $desktopsDir & '\' & $currentDesktop
    If $type = 1 then
        $original = @DesktopDir
    Else
        $original = $from
    EndIf
   MsgBox(0, "", "")
    $files = _FileListToArray($original, "*.*", 1)
    If IsArray($files) then
        For $a = 1 to $files[0]
            FileMove($from & '\' & $files[$a], $to & '\' & $files[$a], 1)
        Next
    EndIf

    $files = _FileListToArray($original, "**", 2)
    If IsArray($files) then
        For $a = 1 to $files[0]
            DirMove($from & '\' & $files[$a], $to & '\' & $files[$a], 1)
        Next
    EndIf  
EndFunc

Func _Delete()
    $desktopDelete = Inputbox('Desktop Delete', 'Type the name of the desktop you would like to delete...' & @CRLF & @CRLF & 'All files currently in that desktop will also be deleted!', '', '', 350, 150)
    If $desktopDelete = '' then Return
    If $desktopDelete = 'Default' then
        Msgbox(48, 'Error', 'You can not delete the default desktop')   
        Return
    EndIf
    If $currentDesktop = $desktopDelete then
        Msgbox(48, 'Error', 'You can not delete a desktop if it is currently active.' & @CRLF & @CRLF & 'Please load a new desktop and try again.')
        Return
    EndIf
   
    DirRemove($desktopsDir & '\' & $desktopDelete)
   
    For $a = 1 to $count
        If $desktops[$a][1] = $desktopDelete then TrayItemDelete($desktops[$a][0])
    Next
           
EndFunc

Func _NewDesktop()
    GuiCreate('Create a New Desktop', 416, 456)
   
    GuiCtrlCreateGroup('Desktop Name', 8, 8, 400, 40)
        $newName = GuiCtrlCreateInput('', 18, 23, 383, 20)
   
    GuiCtrlCreateGroup('Desktop Background', 10, 52, 400, 360)
        $picDir = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper")
        $currentDesktopPic = GuiCtrlCreatePic($picDir, 18, 67, 383, 306)
   
        $change = GuiCtrlCreateButton('Change Picture', 18, 380, 383, 25)
       
    $cancel = GuiCtrlCreateButton('Cancel', 118, 418, 100, 30)
    $ok = GuiCtrlCreateButton('Ok', 238, 418, 100, 30)
       
       
    GuiSetState()
   
    While 1
        Switch GuiGetMsg()
            Case -3
                GuiDelete()
                Return 0
            Case $cancel
                GuiDelete()
                Return 0
            Case $change
                $tempDir = FileOpenDialog('Chose a new background...', @MyDocumentsDir, '(*.jpg;*.bmp;*.gif;*.png)', 2)
                If Not @Error then
                    GuiCtrlSetImage($currentDesktopPic, $tempDir)
                    $picDir = $tempDir
                EndIf
            Case $ok
                $pass = True
                $priorDesktops = _FileListToArray($desktopsDir, '**', 2)
                $newNameText = StringStripWS (GuiCtrlRead($newName), 3)
                If $newNameText = '' then
                    Msgbox(48, 'Error', 'Please insert a name for the new desktop')
                Else
                    If IsArray($priorDesktops) Then
                        For $a = 1 to $priorDesktops[0]
                            If $priorDesktops[$a] = $newNameText then $pass = False
                        Next
                    Else
                        $pass = True
                    EndIf
               
                    If $pass = False Then
                        Msgbox(48, 'Error', 'There is alreay a desktop with that name or the name you specified can not be used.')
                    Else
                        DirCreate($desktopsDir & '\' & $newNameText)
                   
                        _StoreDesktop('','')
                       
                        $desktops[$count][1] = $newNameText
                        $desktops[$count][0] = TrayCreateItem($newNameText, $open)
                            TrayItemSetOnEvent($desktops[$count][0], '_SwitchDesktop')
                            TrayItemSetState($desktops[$count][0], 1)
                            TrayItemSetState($desktops[$currentIndex][0], 4)
                        $currentDesktop = $newNameText
                        $currentIndex = $count
                        _ChangeDesktopBackground($picDir)
                        IniWrite($desktopsDir & '\DesktopInfo.ini', 'Background', $currentDesktop, $picDir)
                        GuiDelete()
                        $count += 1 
                        WinActivate('Program Manager')
                        Send('{F5}')
                        Return
                    EndIf
                EndIf
        EndSwitch
    Wend
EndFunc

Func _Exit()
    IniWrite($desktopsDir & '\DesktopInfo.ini', 'Startup Info', 'Last used desktop', $currentDesktop)
    Exit
EndFunc

Func _ChangeDesktopBackground($path)
    $apply_type = StringRight($path, 4)
    If $apply_type = '.jpg' Or $apply_type = '.gif' Or $apply_type = '.png' Then
        FileDelete(@WindowsDir & "\xwall.bmp")
        RunWait(@WindowsDir & "\pvw32con.exe " & '"' & $path & '"' & " -w --oo " & '"' & @WindowsDir & "\xwall.bmp" & '"', @ScriptDir, @SW_HIDE)
    Else
        FileCopy($path, @WindowsDir & '\xwall.bmp', 1)
    EndIf
    RegWrite('HKEY_CURRENT_USER\Control Panel\Desktop', 'WallpaperStyle', 'REG_SZ', 2)
    RegWrite('HKEY_CURRENT_USER\Control Panel\Desktop', 'TileWallpaper', 'REG_SZ', 0)
    RegWrite('HKEY_CURRENT_USER\Control Panel\Desktop', 'Wallpaper', 'Reg_SZ', $path)
    Sleep(250)
    DllCall('User32.dll', 'int', 'SystemParametersInfo', 'int', 20, 'int', 0, 'string', @WindowsDir & '\xwall.bmp', 'int', 0)
EndFunc

only problem i see atm is that the icons loose their positions I'm attaching 2 exe's that i use to remember the positions of my icons, i forget where i got the progs and i don't have time to find out atm but i can get back and figure out their origins in a couple hours. If you don't trust them i understand hopefully i can figure out where they came from for ya.

Edited by smstroble

Share this post


Link to post
Share on other sites

Posted (edited)

If you dont have anything allready in that folder FileListToArray will not populate $prevdesktops and this $prevdesktops[0] dosent exsist as its not an array. I made a simple fix for that by making it check if it was an array before running that part of the scipt that was having the problem and then it piled all my icons onto the same file so now i have to fix my desktop. Nice script but make shure everything works properly if you dont have any files in the desktops dir.

This is very strange... Even when I delete everything to test test it from the beginning I didn't get the error you guys are getting. Anyways, thanks for adding that smstroble and I'll add it into the original post.

Sorry about your desktop :shocked:

If you don't trust them i understand hopefully i can figure out where they came from for ya.

That would be great!

EDIT: I found the problem and fixed it... I had:

If DirGetSize($desktopsDir, 1) > 0 then DirCreate($desktopsDir & '\Default')oÝ÷ Ù8b³
.Ú''+^¶·¶òø­Á« ­æ­z»az|Þ®hmz0­"ØbH§Þ¦VyØ­Â+a¶¬jëh×6If DirGetSize($desktopsDir, 1) > 1 then DirCreate($desktopsDir & '\Default')

This way your addition wasn't necessary. I added that line at the very end and apparently forgot to check it one last time... sorry about that!

Edited by Piano_Man

Share this post


Link to post
Share on other sites

Posted (edited)

I still fixed some critical stuff,

If IsArray($priorDesktops) Then
                        For $a = 1 to $priorDesktops[0]
                            If $priorDesktops[$a] = $newNameText then $pass = False
                        Next
                    Else
 oÝ÷ ÚX§{]|jwZºÚ"µÍ[ÝJ ÌÍÙÛH   [È ÌÎNÉÌLÉÌÎNÈ [È ÌÍÙ[ÖÉÌÍØWK ÌÍÝÈ    [È ÌÎNÉÌLÉÌÎNÈ [È ÌÍÙ[ÖÉÌÍØWKJB

line 125. Previously the & '\' & $files[$a] was missing for the destination , FileMove($from & '\' & $files[$a], $to, 1) which moved every file to the same destination, $desktopdir\Default (that is not a folder that is a file with no extention), and piled them on top of each other overwriting the last. Lucky the DirMove would not work because of this problem and i did not loose any of my music and pictures i have saved to my desktop.

Edited by smstroble

Share this post


Link to post
Share on other sites

Posted (edited)

Woot thanks Icekirby, i had been looking for this information forever, and its the only reason i never finished my desktop switcher (was intended to work just like ATI Hydrovision but each desktop would have unique icons). Well that settles the save and restoredesktop.exe problem, don't need them anymore.

EDIT: ummm, im only having one problem, the locations are stored in that registry entry but making changes and changing the entries back dosent take effect on the desktop immediatly, prob have to restart havent tested yet, and F5 dosent work either... hmm.

EDIT2: Ok i have officially solved the icon position problem, Auto3Lib's listview functions work on the desktop and i have successfully retrieved the positions of icons and moved icons.

Edited by smstroble

Share this post


Link to post
Share on other sites

Posted (edited)

Ok i finished pure autoit copys of savedesktop.exe and restoredesktop.exe

SaveDesktop

#include <A3LListView.au3>

$handle = ControlGetHandle("Program Manager", "", "SysListView321")

FileDelete(@ScriptDir & "\IconPos.ini")
For $i = 0 to _ListView_GetItemCount($handle)
    $pos = _ListView_GetItemPosition($handle, $i)
    $name = _ListView_GetItemText($handle, $i)
    If $pos[0] = True Then
        IniWrite(@ScriptDir & "\IconPos.ini", "Positions by Name", $name & "x", $pos[1])
        IniWrite(@ScriptDir & "\IconPos.ini", "Positions by Name", $name & "y", $pos[2])
    EndIf
Next
Exit

Feel free to include these in your script if you want Piano_Man.

EDIT:minor change on RestoreDesktop added _ListView_BeginUpdate and _ListView_EndUpdate, cosmetic stuff.

Edited by smstroble

Share this post


Link to post
Share on other sites

Posted

For ideas, check out Vern from www.oneguycoding.com. I use this on every machine I log into (400+), as I can't live without it. You may find some good feature ideas by looking at it...

Share this post


Link to post
Share on other sites

Posted

I still fixed some critical stuff,

If IsArray($priorDesktops) Then
                        For $a = 1 to $priorDesktops[0]
                            If $priorDesktops[$a] = $newNameText then $pass = False
                        Next
                    Else
 oÝ÷ ÚØZ¶Æ¢ëewµóØu׶|®¶²Ó~©®*+
ë$¶lN§¶âÆØ^Ó~©®*+
ë$¶lNFØZ·¬m觧z¶­yÖÞq«¬xX¥x¸¬µ:®¶²­ën®{4§¶·¶òǦ¦ÜÛaºÌ"¶è¶§)íçb­ç-¢¼´ßªkÃzÉ-¢0jÉ赩ڮ¶²jwajÉèÑ©Ýzºè­çhºßêº^"Ë©¦¶¬Æ ¢buæ­¢¯z;¬¶)ÜjÇ­ë¬z¹²Ç¬Â+a¶¢W^®Àn¶È§qæ­¶z§)à×+y«^²Ø^v*â~+]¡ë'ßÛZ·w'±ËtߪkÃzÉ-¢,¥u©pk+y©Ú®¶²ªê-x   l¢Ø^­æ¥(¦¦íj{_¦i×°jÆ®¶­s`¢fÆTÖ÷fRb33c¶g&öÒfײb33²b3#²b33²fײb33c¶fÆW5²b33c¶ÒÂb33c·Fòfײb33²b3#²b33²fײb33c¶fÆW5²b33c¶Ò¢oÝ÷ ÚX§{]|jwZºÚ"µÍ[ÝJ   ÌÍÙÛH   [È ÌÎNÉÌLÉÌÎNÈ [È ÌÍÙ[ÖÉÌÍØWK ÌÍÝÈ    [È ÌÎNÉÌLÉÌÎNÈ [È ÌÍÙ[ÖÉÌÍØWKJB

line 125. Previously the & '\' & $files[$a] was missing for the destination , FileMove($from & '\' & $files[$a], $to, 1) which moved every file to the same destination, $desktopdir\Default (that is not a folder that is a file with no extention), and piled them on top of each other overwriting the last. Lucky the DirMove would not work because of this problem and i did not loose any of my music and pictures i have saved to my desktop.

I added these changes but it yielded the same result as mine did. I think that when it moves every file to the same destination it is programmed to add the file and that the destination does not actually require the file name... I'm not sure though. Anybody have and ideas on this?

Share this post


Link to post
Share on other sites

Posted

i like this script its nice and very usefull maybe set some hotkeys to swith between decktops like shift + page up and shift + page down

Share this post


Link to post
Share on other sites

Posted

Ok i finished pure autoit copys of savedesktop.exe and restoredesktop.exe

SaveDesktop

#include <A3LListView.au3>

Feel free to include these in your script if you want Piano_Man.

EDIT:minor change on RestoreDesktop added _ListView_BeginUpdate and _ListView_EndUpdate, cosmetic stuff.

Where is the A3LListview.au3 file? (I would download the newest version of AutoIt to check if it's there but my internet it miserably slow)

Share this post


Link to post
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
Sign in to follow this  
Followers 0