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