topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 6:02 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: Change Desktop Folder  (Read 62104 times)

apfel

  • Participant
  • Joined in 2006
  • *
  • Posts: 63
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #25 on: November 12, 2007, 11:25 AM »
Is WorkDeskXP in english?

psionics

  • Participant
  • Joined in 2007
  • *
  • Posts: 119
    • View Profile
    • freestyle (nunchaku) forum.net
    • Donate to Member
Re: Change Desktop Folder
« Reply #26 on: November 13, 2007, 04:05 AM »
yes..  :)

but still.. not the one i'm looking for..

inshadow

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #27 on: November 20, 2007, 03:08 PM »
I have also been experimenting with this code, to see if I could get something useful.
But nevertheless, it seems I am stuck with three problems.
1) sometimes multiple desktop refreshes are needed.
2) after having refreshed the desktop, another refresh (f5 etc) is needed to see changes - for instance copying and deleting files on the desktop
3) icon positions are not saved
I have tried to use other methods of writing to the registry and also other methods of refreshing the desktop.

Has anyone got any further?

inshadow

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #28 on: November 21, 2007, 01:29 AM »
Got a new idea which doesn't involve registry editing. It works, but I hadn't had time to test further yet if it solves any problems.
The idea is to use the subst command to create a virtual drive.
For instance: subst k: "C:\Documents and Settings\username\Desktop
This creates a drive which points to the usual Desktop folder.
Then I can just let the desktop folder location be drive k:
If I want to switch desktop folder, then I just delete virtual drive k:
subst k: /d
and create a new one pointing on another folder:
subst k: "C:\Documents and Settings\username\anotherDesktopFolder

belkira

  • Member
  • Joined in 2006
  • **
  • Posts: 52
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #29 on: November 21, 2007, 01:38 PM »
To go along with inshadow, I have tried his idea and it works great. I have not had any time to try to put it into a program yet, but if you want to see how it works you can do this.

Change the registry so it points to say....k: for the desktop folder then maybe create a batch file that has the following in it:
subst k: /d
subst k: "whatever folder"

Using it this way will require a logoff/on.

I would create a couple of those batch scripts and put different destination folders. After the initial logoff/on all that is required after running the batch file is to press F5

I will see if I can get a minute to throw a script together unless someone beats me to it....

belkira

  • Member
  • Joined in 2006
  • **
  • Posts: 52
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #30 on: November 21, 2007, 06:35 PM »
Well, in theory this should work, but it is untested so who knows.....

I am still unsure about the refresh method, and looking for something more reliable.

;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
;
;
; Script Function:
; 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
;Regread, current, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, Desktop
RegWrite, REG_EXPAND_SZ, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, Desktop, Z:\
runwait, %comspec% /c subst Z: "`%USERPROFILE`%\Desktop",,Hide
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
GoSub,INIREAD
GoSub,TRAYMENU

INIREAD:
IfNotExist,%A_ScriptName%.ini
{
  IniWrite,Location 1,%A_ScriptName%.ini,Locations,dir1
  IniWrite,Location 2,%A_ScriptName%.ini,Locations,dir2
  IniWrite,Location 3,%A_ScriptName%.ini,Locations,dir3
  IniWrite,Location 4,%A_ScriptName%.ini,Locations,dir4
  IniWrite,`%USERPROFILE`%\Desktop,%A_ScriptName%.ini,Locations,Default
}
IniRead,dir1,%A_ScriptName%.ini,Locations,dir1
IniRead,dir2,%A_ScriptName%.ini,Locations,dir2
IniRead,dir3,%A_ScriptName%.ini,Locations,dir3
IniRead,dir4,%A_ScriptName%.ini,Locations,dir4
IniRead,default,%A_ScriptName%.ini,Locations,Default
Return




TRAYMENU:

Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,Desktop Switcher, CURRENT
Menu,Tray,Add,
Menu,Tray,Add,"%dir1%",DIR1
Menu,Tray,Add,"%dir2%",DIR2
Menu,Tray,Add,"%dir3%",DIR3
Menu,Tray,Add,"%dir4%",DIR4
Menu,Tray,Add,Default,DEFAULT
Menu,Tray,Add
Menu,Tray,Add,Edit,EDIT
Menu,Tray,Add,Reload,RELOAD
Menu,Tray,Add,
Menu,Tray,Add,E&xit,EXIT
Menu,Tray,Tip,%A_ScriptName%
; Menu,Tray,Check,%current%
Return

CURRENT:

DIR1:
runwait %comspec% /c subst Z: /d,,Hide
runwait %comspec% /c subst Z: %dir1%,,Hide
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
Return

DIR2:
runwait %comspec% /c subst Z: /d,,Hide
runwait %comspec% /c subst Z: %dir2%,,Hide
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
Return

DIR3:
runwait %comspec% /c subst Z: /d,,Hide
runwait %comspec% /c subst Z: %dir3%
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
Return

DIR4:
runwait %comspec% /c subst Z: /d
runwait %comspec% /c subst Z: %dir4%
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntÅ, 0)
Return

DEFAULT:
RegWrite, REG_EXPAND_SZ, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, Desktop, %default%
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntÅ, 0)
ExitApp
Return

EDIT:
Runwait,%A_ScriptName%.ini
Return

RELOAD:
Reload

EXIT:
ExitApp

inshadow

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #31 on: November 22, 2007, 02:51 PM »
changed:
runwait %comspec% /c subst Z: %dir1%,,Hide
to:
runwait %comspec% /c subst Z: "%dir1%",,Hide

;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
;
;
; Script Function:
; 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
;Regread, current, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, Desktop
RegWrite, REG_EXPAND_SZ, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, Desktop, Z:\
runwait, %comspec% /c subst Z: "`%USERPROFILE`%\Desktop",,Hide
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
GoSub,INIREAD
GoSub,TRAYMENU

INIREAD:
IfNotExist,%A_ScriptName%.ini
{
  IniWrite,Location 1,%A_ScriptName%.ini,Locations,dir1
  IniWrite,Location 2,%A_ScriptName%.ini,Locations,dir2
  IniWrite,Location 3,%A_ScriptName%.ini,Locations,dir3
  IniWrite,Location 4,%A_ScriptName%.ini,Locations,dir4
  IniWrite,`%USERPROFILE`%\Desktop,%A_ScriptName%.ini,Locations,Default
}
IniRead,dir1,%A_ScriptName%.ini,Locations,dir1
IniRead,dir2,%A_ScriptName%.ini,Locations,dir2
IniRead,dir3,%A_ScriptName%.ini,Locations,dir3
IniRead,dir4,%A_ScriptName%.ini,Locations,dir4
IniRead,default,%A_ScriptName%.ini,Locations,Default
Return




TRAYMENU:

Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,Desktop Switcher, CURRENT
Menu,Tray,Add,
Menu,Tray,Add,"%dir1%",DIR1
Menu,Tray,Add,"%dir2%",DIR2
Menu,Tray,Add,"%dir3%",DIR3
Menu,Tray,Add,"%dir4%",DIR4
Menu,Tray,Add,Default,DEFAULT
Menu,Tray,Add
Menu,Tray,Add,Edit,EDIT
Menu,Tray,Add,Reload,RELOAD
Menu,Tray,Add,
Menu,Tray,Add,E&xit,EXIT
Menu,Tray,Tip,%A_ScriptName%
; Menu,Tray,Check,%current%
Return

CURRENT:

DIR1:
runwait %comspec% /c subst Z: /d,,Hide
runwait %comspec% /c subst Z: "%dir1%",,Hide
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
Return

DIR2:
runwait %comspec% /c subst Z: /d,,Hide
runwait %comspec% /c subst Z: "%dir2%",,Hide
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
Return

DIR3:
runwait %comspec% /c subst Z: /d,,Hide
runwait %comspec% /c subst Z: "%dir3%"
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
Return

DIR4:
runwait %comspec% /c subst Z: /d
runwait %comspec% /c subst Z: "%dir4%"
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntÅ, 0)
Return

DEFAULT:
RegWrite, REG_EXPAND_SZ, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, Desktop, %default%
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntÅ, 0)
ExitApp
Return

EDIT:
Runwait,%A_ScriptName%.ini
Return

RELOAD:
Reload

EXIT:
ExitApp

perlguy

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 30
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #32 on: November 23, 2007, 12:33 AM »
Rather than use up a drive letter with subst, I chose to use junction.exe (from sysinternals) to delete/create junctions when selecting a new desktop.

It's not polished (e.g. no code to setup inital desktops, no detection of current desktop to indicate on the tray menu), but it works where the registry edit/refresh code wasn't working for me (XP SP2).

inshadow

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #33 on: November 23, 2007, 01:24 AM »
Rather than use up a drive letter with subst, I chose to use junction.exe (from sysinternals) to delete/create junctions when selecting a new desktop.
That requires a NTFS partition right?
I can see that my harddrive is formattet as NTFS. Is this standard today for Windows XP and up?

/Stig

perlguy

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 30
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #34 on: November 23, 2007, 03:07 PM »
Yes, NTFS is default/standard these days...  one not so nice side effect using this method (so far) is that files copied/saved directly to the desktop folder don't show up immediately.  if you drag-n-drop to the desktop they do.

Also, the icons will auto-arrange, and sort, every time you switch desktops... so this may not be the solution for everyone... so far I like it, but only time will tell if the annoyances outweigh the benefits.

Right now, I'm just using it to split up downloads from everything else.  But I can definitely see using it for keeping project related files all together and at my fingertips.  Thank you to whoever started the thread!

Oh, one other thing - I use windows powerpro too, and used its context/contextfolder menu feature to create "Move To Desktop -> 1/2/3/4" context menus to move files between desktops, since copy/switch/paste doesn't work (for obvious reasons - you're changing the desktop folder in the middle of the operation).

If anyone knows how to do that with AHK, I'd sure appreciate a pointer/link.  I also pinged mouser on ContextMenu Commander status. :)

perlguy

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 30
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #35 on: November 24, 2007, 01:45 AM »
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

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #36 on: November 24, 2007, 03:48 AM »
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.
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.
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.
I agree on this.

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

inshadow

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #37 on: November 24, 2007, 08:43 AM »
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

  • Participant
  • Joined in 2007
  • *
  • Posts: 119
    • View Profile
    • freestyle (nunchaku) forum.net
    • Donate to Member
Re: Change Desktop Folder
« Reply #38 on: November 24, 2007, 02:53 PM »
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

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #39 on: November 24, 2007, 03:42 PM »
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?
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.

PhilB66

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,522
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #40 on: November 26, 2007, 12:47 AM »
SUperior SU - Desktop Switcher

psionics

  • Participant
  • Joined in 2007
  • *
  • Posts: 119
    • View Profile
    • freestyle (nunchaku) forum.net
    • Donate to Member
Re: Change Desktop Folder
« Reply #41 on: November 29, 2007, 09:03 AM »
SUperior SU - Desktop Switcher

its a windows profile changer  :huh:

inshadow

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #42 on: November 29, 2007, 10:41 AM »
SUperior SU - Desktop Switcher

its a windows profile changer  :huh:

Yes it is.
But the functionality of the Desktop Folder Switcher script resembles it very much.
Anyway, I tried it out and think it's overkill. I think it takes too many resource for each "desktop" when comparing to our simple solution.
I still want to try to help developing our script, as I need this myself. I don't have much time for this in December though.

apfel

  • Participant
  • Joined in 2006
  • *
  • Posts: 63
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #43 on: January 03, 2008, 08:05 AM »
FOUND ONE!
A beta program, whiche will expire on January 28, 2008.
http://www.extradesktops.com/

I kind of explorer folder layer over desktop.
« Last Edit: January 03, 2008, 08:21 AM by apfel »

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,958
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #44 on: January 03, 2008, 09:23 AM »
FOUND ONE!
A beta program, whiche will expire on January 28, 2008.
http://www.extradesktops.com/

I kind of explorer folder layer over desktop.

it's not very clear what exactly that does -
have you tried it apfel?

wonder is it more like virtual desktops or psionics idea :-\
Tom

apfel

  • Participant
  • Joined in 2006
  • *
  • Posts: 63
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #45 on: January 03, 2008, 10:01 AM »
Yes, I tested on Xp and it works.
You need to set a folder, which you want to display as new desktop and a hotkey.
With the hotkeys you can simply switch the displayed desktop/icons to another folder's files/icons without explorer.exe restart.
« Last Edit: January 03, 2008, 10:03 AM by apfel »

psionics

  • Participant
  • Joined in 2007
  • *
  • Posts: 119
    • View Profile
    • freestyle (nunchaku) forum.net
    • Donate to Member
Re: Change Desktop Folder
« Reply #46 on: January 04, 2008, 03:01 PM »
nice find! you have to install the visual C++ 2005 first before installing Extra Desktop. its works great just what i wanted! i don't mind if the icons doesn't have shadows (very good thing there is that it is layered to desktop even if you press win+D while dragging a file). (expires on January 28) :(  it got everything i need but i think its not free..  :-\

and the bug i've discovered in, when you click a folder, the whole desktop goes to that folder instead of opening a window for it. and it cannot be reverted back to it's root desktop profile even if you press the backspace key. i think each desktop must have a "back" icon(if folders opening aren't implemented as floating windows) and a "recycle bin". (theres a desktop scrollbar and view as thumbnails which is cool :P )  but still not it..
« Last Edit: January 04, 2008, 03:46 PM by psionics »

apfel

  • Participant
  • Joined in 2006
  • *
  • Posts: 63
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #47 on: January 04, 2008, 04:50 PM »
@psionics You need to unclick the box with "browsing.." in the settings.
Its free, but in development status...

I discoverd a small Hotkey bug, too.
« Last Edit: January 04, 2008, 04:52 PM by apfel »

psionics

  • Participant
  • Joined in 2007
  • *
  • Posts: 119
    • View Profile
    • freestyle (nunchaku) forum.net
    • Donate to Member
Re: Change Desktop Folder
« Reply #48 on: January 05, 2008, 07:32 AM »
ohh. that is good to hear that it is free.. yeah i know to troubleshoot those thanks btw.. i was hoping for its improvement from the bug. what is great is that it works like in DLL, not an application. but when it hangs.. you have to refresh exporer.exe but not a serious issue i think.

apfel

  • Participant
  • Joined in 2006
  • *
  • Posts: 63
    • View Profile
    • Donate to Member
Re: Change Desktop Folder
« Reply #49 on: January 05, 2008, 11:13 AM »
I hope a big Bugfixed Version will arrive on January 28, 2008.