sebastian___ wrote:
I wish someone could repair this script because is very useful. And I have the same problems with this script as the previous posted here.
I implemented a version where
- is shown the full path of the folders
- one can choose to see the tree folder to the left using the menu
- one can set the hotkey by the menu
- one can set the number of folders by the menu
- one can set the WatchDelay by the menu
#LButton is the default hotkey
All values are saved in a file together with to last subfolders.
I programmed it on WinXP SP2 (not seriously tested), let me know the if it is running without many errors.
Code:
; from CarlosTheTackle ; changed by robiandi
#singleinstance force
autoexec:
SetTitleMatchMode, Slow
tempBat = %a_temp%\ahk.bat
IniFile=RecentFolderslist.log
setworkingdir %a_scriptdir%
ifexist %IniFile%
{
fileread foldersIni ,%IniFile%
iniread foldernum ,%IniFile%,Settings,foldernum
iniread Hkey ,%IniFile%,Settings,Hotkey
iniread TreeFolderToTheLeft,%IniFile%,Settings,TreeFolderToTheLeft
iniread timer ,%IniFile%,Settings,timer
loop parse,foldersIni,`n
{
if (a_index >5)
folders .= a_loopField "`n"
}
}
else
{
foldernum=10
timer=5000
folders = C:\`n
}
if hkey =
hkey=#LButton
hotkey %hkey%,menuShow
gosub menu_build
gosub guiBuild
SetTimer, rf_trackfolders, %timer%
return
guiBuild:
Gui add, hotkey ,w200 vHK
gui add, checkbox, vLButton , LButton
gui add, checkbox,x+0 vMButton , MButton
gui add, checkbox,x+0 vRButton , RButton
gui add, checkbox,xm y+15 vWin,Win
Gui add, button ,x+35 yp-5 gHotkeySet, Submit
Gui add, button ,x+5 gCancel , Cancel
return
Cancel:
gui hide
return
HotkeySet:
gui submit
hotkey %hkey%,off
hkey = %hk%
if lbutton
hkey .= "LButton"
if mbutton
hkey .="MButton"
if rbutton
hkey .="RButton"
if win
hkey = #%hkey%
hotkey %hkey%,menuShow,on
tooltip `n hotkey: %hkey% `n
sleep 4000
tooltip
return
rf_trackfolders:
;formattime time,,mm:ss tooltip %time%
IfWinNotActive ahk_class CabinetWClass
return
SetTimer, rf_trackfolders, off
WinGetTitle, rf_current_win,ahk_class CabinetWClass
WinGetText, rf_win_info, %rf_current_win%, %rf_current_win%,
StringSplit, rf_new_folder, rf_win_info,`n
rf_new_folder= %rf_new_folder1%
StringTrimRight, rf_new_folder, rf_new_folder, 1
SecondLetter := substr(rf_new_folder,2,1)
permitted := false
if Secondletter = :
permitted := true
if rf_new_folder in Desktop,My Documents,Eigene Dateien
permitted := true
if (! permitted)
return
IsNew = 1
loop %folders0%
{
folder := folders%a_index%
if rf_new_folder = %folder%
IsNew =
}
if IsNew
{
folders =%rf_new_folder%`n%folders%
gosub menu_build
}
SetTimer, rf_trackfolders, %timer%
return
rf_launch:
if A_ThisMenuItem = Desktop
{
Run, %A_Desktop%
return
}
If A_ThisMenuItem in My Documents,Eigene Dateien
{
Run, %A_MyDocuments%
return
}
if (TreeFolderToTheLeft)
{
ifexist %tempBat%
filedelete %tempBat%
fileappend cmd /k explorer.exe %A_ThisMenuItem%`,/e,%tempBat%
run %tempBat%
; PostMessage, 0x111, 41525,,, A ; <== would be another possibility
}
else
run %A_ThisMenuItem%
return
menu_build:
stringreplace folders,folders,`r,,A
stringsplit folders,folders,`n
folders =
folders0 -= 1
menu tray, useErrorLevel
Menu Tray, NoStandard
menu tray, deleteAll
Menu Tray, Add, Exit Recent Folders, rf_close
menu tray, add ,Hotkey
menu tray, add ,WatchDelay
menu tray, add ,No. of Folders ,noOfFolders
menu tray, add ,ToggleTreeFolderToTheLeft
menu tray, Add
Menu Tray, Default, Exit Recent Folders
Loop, %folders0%
{
if (a_index > foldernum)
{
folders0 := foldernum
break
}
folders .= folders%a_index% "`n"
Menu, Tray, Add, % folders%a_index%, rf_launch
}
return
hotkey:
gui show,,New Hotkey
return
ToggleTreeFolderToTheLeft:
TreeFolderToTheLeft := not TreeFolderToTheLeft
tooltip `n TreeFolderToTheLeft = %TreeFolderToTheLeft% `n
sleep 4000
tooltip
return
WatchDelay:
inputbox watchdelay,WatchDelay in Seconds,,,220,100
if ErrorLevel
return
if watchdelay is integer
if watchdelay between 1 and 60
timer := 1000 * watchdelay
SetTimer, rf_trackfolders, %timer%
tooltip `n WatchDelay = %timer% (milliseconds) `n
sleep 4000
tooltip
return
noOfFolders:
inputbox foldernum1,No. of Folders,,,150,100
if ErrorLevel
return
if foldernum1 is integer
if foldernum1 between 10 and 70
foldernum := foldernum1
tooltip `n foldernum = %foldernum% `n
sleep 4000
tooltip
return
rf_close:
FileDelete, %IniFile%
txt =
(Ltrim
[Settings]
foldernum=%foldernum%
Hotkey=%hkey%
timer=%timer%
TreeFolderToTheLeft=%TreeFolderToTheLeft%
%folders%
)
fileappend %txt%,%IniFile%
ExitApp
return
MenuShow:
Menu, Tray, Show
return