Ok, I'm using WinXP SP3 and this is what I got.
Click for .jpg of error.
... Tim Gott
Hi, this is the update.
Note: This code must be used on
AutoHotkey_Usince I couldn't get the icons from DllCall shell32.dll\SHGetFileInfo.
(It seems Vista's normal account can't use shell32.dll in DllCall. Maybe not but I've tried everything I found this couple days, nothing worked)
I'm not sure if icons will load in other Windows other than Vista too so
if you're not using Vista I'd appreciate it if you can report what happened.
-Added Delete Item/ Copy Path functionBtw, I am Mon, the original author of this script.
I made new account as Mon+ because I've lost the password to Mon account. (I now use different e-mail here I couldn't re-assign my passowrd either)
Code:
; Select menu item with Ctrl = Delete item from Recent & Menu
; Select menu item with Shift = Copy full path of selected item
; Select menu item with Ctrl + Shift = Copy name of selected item
;======================================================
; Your Setting
;======================================================
TR_WhatType= .ahk,.txt ; File type which will show in the menu
TR_Hotkey= ^P
;======================================================
; Main
;======================================================
if A_OSVersion in WIN_NT4,WIN_95,WIN_98,WIN_ME
{
; MsgBox This script requires Windows 2000/XP or later.
TR_RecentD := A_WinDir . "\Recent"
ExitApp
}
else if if WIN_XP
{
TR_RecentD := RegExReplace(A_AppData, "Application Data$","")
TR_RecentD := TR_RecentD . "Recent"
}
else
TR_RecentD := A_AppData . "\Microsoft\Windows\Recent"
;MsgBox,%TR_RecentD%
Loop, parse, TR_WhatType,`,
{
RegRead, TR_OutputVar, HKEY_CLASSES_ROOT, %A_LoopField%
RegRead, TR_OutputVar, HKEY_CLASSES_ROOT, %TR_OutputVar%\DefaultIcon
if TR_OutputVar =
{
TR_Icon%A_Index% = shell32.dll
TR_Icon_no%A_Index% = 1
}
else
{
StringSplit, TR_OutputVar, TR_OutputVar,`,
TR_Icon%A_Index% := TR_OutputVar1
TR_Icon_no%A_Index% := TR_OutputVar2
}
}
TR_FileExist = 0
TR_FirstBuild = 0
Hotkey, %TR_Hotkey%,TR_SHOW
Gosub TR_CreateMenu
;======================================================
; Show if menu is not under build
;======================================================
TR_SHOW:
if TR_UnderBuild = 1
{
MsgBox,4096,TidyRecentAccessMenu,Creating Menu... Please Wait.
return
}
if TR_FirstBuild = 0
{
TR_FirstBuild = 1
return
}
if (TR_FileExist = 0) AND (TR_FileFolder = 0)
MsgBox,4096,TidyRecentAccessMenu,No Recent File/Folder was currently Found.
else
Menu,TR_File,show
return
;=========================================
; Exectute / CopyPath / Delete item on select
;=========================================
TR_LinkRun:
TR_KeyState = 0
if GetKeyState("Shift")
TR_KeyState = 1
if GetKeyState("Ctrl")
TR_KeyState += 2
if TR_KeyState = 1
clipboard := A_ThisMenuItem
else if TR_KeyState = 2
{
msgbox,4100,TidyRecentAccessMenu,Do you wish to remove this shortcut from recent?
IfMsgBox, Yes
{
SplitPath,A_ThisMenuItem,TR_Temp
filedelete,%TR_RecentD%\%TR_Temp%.lnk
Menu,%A_ThisMenu%,Delete,%A_ThisMenuItem%
}
}
else if TR_KeyState = 3
{
SplitPath,A_ThisMenuItem,TR_Temp
clipboard := TR_Temp
}
else
{
SplitPath,A_ThisMenuItem,TR_Temp
FileGetShortcut,%TR_RecentD%\%TR_Temp%.lnk,TR_Path,,TR_WF_Path
run %TR_Path%,%TR_WF_Path%,UseErrorLevel
if ErrorLevel
msgbox,4096,TidyRecentAccessMenu,Error on launching,This file extension type does not have any program assigned. `nPlease assign default program to run for this extension.
}
return
;=========================================
; Create menu
;=========================================
TR_CreateMenu:
TR_UnderBuild = 1
TR_CNT = 0
TR_ListFile =
Loop, %TR_RecentD%\*.*,1
{
if A_LoopFileName = desktop.ini
continue
TR_ListFile = %TR_ListFile%%A_LoopFileTimeModified%`t%A_LoopFileLongPath%`n
Sort, TR_ListFile, R ; Sort by date.
}
Loop, parse, TR_ListFile, `n
{
if A_LoopField = ; Omit the last linefeed (blank item) at the end of the list.
continue
StringSplit, TR_ItemPath, A_LoopField, %A_Tab%
FileGetShortcut,%TR_ItemPath2%,TR_Path
IfNotExist, %TR_Path% ; Delete link if actual file is re/moved
{
filedelete,%TR_RecentD%\%TR_ItemPath2%
continue
}
SplitPath,TR_Path,,,TR_Whatisit
if TR_Whatisit =
{
TR_FolderExist = 1
Menu,TR_Folder,add,%TR_Path%,TR_LinkRun
Menu,TR_Folder,Icon,%TR_Path%,shell32.dll,4
}
else if TR_ItemPath2 contains %TR_WhatType%
{
TR_FileExist = 1
Menu,TR_File,add,%TR_Path%,TR_LinkRun
Loop, parse, TR_WhatType,`,
{
TR_Whatisit := "." . TR_Whatisit
if TR_Whatisit contains %A_LoopField%
{
TR_OutputVar1 := TR_Icon%A_Index%
TR_OutputVar2 := TR_Icon_no%A_Index%
Menu,TR_File,Icon,%TR_Path%,%TR_OutputVar1%,%TR_OutputVar2%
}
}
}
}
Menu,TR_File,add,
Menu,TR_File,add,Refresh,TR_ReCreateMenu
Menu,TR_File,Icon,Refresh,shell32.dll,81
if TR_FolderExist = 1
{
Menu,TR_File,add,
Menu,TR_File,add,Folder,:TR_Folder
Menu,TR_File,Icon,Folder,shell32.dll,4
}
Sleep 600
TR_UnderBuild = 0
return
;=========================================
; ReCreate menu
;=========================================
TR_ReCreateMenu:
Menu,TR_File,Delete
if TR_FolderExist = 1
Menu,TR_Folder,Delete
Gosub TR_CreateMenu
Gosub TR_Show
return