ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

Change Desktop Folder

<< < (8/11) > >>

perlguy:
Ok, cleaned up, refactored the bits that do all the real work into a function...  In addition to the menu, I set Win+1/2/3/4 as hotkeys as well.  Changed to pickup the user's profile directory from the environment.  Registry is used to remember which desktop is current between sessions, and if restarting the script.

The only thing missing is a routine to do the initial setup... you need to move your current %USERPROFILE%\Desktop to %USERPROFILE%\Desktop1, create %USERPROFILE%\Desktop2 thru 4, and then run junction.exe manually to point Desktop to Desktop1.  I thought it might be best for anyone wanting to use this to understand how junction.exe works, rather than just doing it for them.

For me, having the ini seemed overkill, so I left out those bits.


--- ---;
; Change the location of the Default Desktop Folder through right-click menu on the systray icon.
;

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#Persistent

HotKey, #1, DIR1
HotKey, #2, DIR2
HotKey, #3, DIR3
HotKey, #4, DIR4

SetDesktop(N){
  EnvGet, PROFILE, USERPROFILE
  RegWrite, REG_SZ, HKCU, Environment, DESKTOP, %N%
  RunWait, junction.exe Desktop Desktop%N%,%PROFILE%,Hide
  DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
  Loop 4 {
    Menu,Tray,Uncheck,Desktop &%A_Index%
  }
  Menu,Tray,Check,Desktop &%N%
}

TRAYMENU:
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,Desktop &1,DIR1
Menu,Tray,Add,Desktop &2,DIR2
Menu,Tray,Add,Desktop &3,DIR3
Menu,Tray,Add,Desktop &4,DIR4
Menu,Tray,Add,&Reload,RELOAD
Menu,Tray,Add,E&xit,EXIT
Menu,Tray,Tip,%A_ScriptName%

RegRead, DESKTOP, HKCU, Environment, DESKTOP
If (ERRORLEVEL = 1 or !DESKTOP)
  DESKTOP=1
SetDesktop(DESKTOP)
Return

DIR1:
SetDesktop(1)
Return

DIR2:
SetDesktop(2)
Return

DIR3:
SetDesktop(3)
Return

DIR4:
SetDesktop(4)
Return

RELOAD:
Reload
Return

EXIT:
ExitApp

inshadow:
Ok, cleaned up, refactored the bits that do all the real work into a function...  In addition to the menu, I set Win+1/2/3/4 as hotkeys as well.  Changed to pickup the user's profile directory from the environment.  Registry is used to remember which desktop is current between sessions, and if restarting the script.
-perlguy (November 24, 2007, 01:45 AM)
--- End quote ---
Great. Clever enough.

The only thing missing is a routine to do the initial setup... you need to move your current %USERPROFILE%\Desktop to %USERPROFILE%\Desktop1, create %USERPROFILE%\Desktop2 thru 4, and then run junction.exe manually to point Desktop to Desktop1.  I thought it might be best for anyone wanting to use this to understand how junction.exe works, rather than just doing it for them.
-perlguy (November 24, 2007, 01:45 AM)
--- End quote ---
Why not just have folder called DesktopJunction which could be the Desktop Folder Location and then keep the default Desktop folder.
Also I think that junction part should be automated. An warning could be displayed when starting the app.

For me, having the ini seemed overkill, so I left out those bits.
-perlguy (November 24, 2007, 01:45 AM)
--- End quote ---
I agree on this.

Wishing list:
Switch folder for the the quick launch. (will this work?)

inshadow:
Wishing list:

* Save and restore desktop icon positions (this should be possible somehow, as I have seen other small apps for this).
* Switch folder for the the quick launch. (will this work?)
I don't know yet what is possible with autohotkey. Would it be possible to control a Virtual Desktop application with a autohotkey application?
This way we could combine this script with a Virtual Desktop application.

psionics:
hey thanks perlguy..  :)

 :tellme: im still using fat32 fs for my xp sp2.. but the ahk script didn't work for me(or ... coz of I didn't try the junction.exe from sysinternals yet)..  anyways, the program "ManageDesk" 's  folder switching did work, but not free (meow  :( ) . can we ask them how they did it?

inshadow:
hey thanks perlguy..  :)

 :tellme: im still using fat32 fs for my xp sp2.. but the ahk script didn't work for me(or ... coz of I didn't try the junction.exe from sysinternals yet)..  anyways, the program "ManageDesk" 's  folder switching did work, but not free (meow  :( ) . can we ask them how they did it?
-psionics (November 24, 2007, 02:53 PM)
--- End quote ---
As far as I know - junctions only works with NTFS.
There is also something called Shell Links. It's a parallel to the SymLinks of Linux - I think. But not completely the same.
Anyway. I tried to create such a Shell Link with the Winbolic Link program, and I think it will work for this purpose (not the Winbolic app but the Shell Link method).
The only problem, is that I haven't found any command line program which creates Shell Links.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version