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

<< < (7/11) > >>

belkira:
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:
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:
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:
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.-perlguy (November 23, 2007, 12:33 AM)
--- End quote ---
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:
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. :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version