MisterW
Joined: 20 Jul 2005 Posts: 65
|
Posted: Fri Jun 16, 2006 12:36 pm Post subject: Enhancing SequoiaView |
|
|
This code provides some impetus towards turning SequoiaView into a more useful filemanager.
Currently it gets the filename under the cursor and can also retrieve the current dir. Hopefully I will get a chance to add some functionality to the menu so that you can delete/move/copy files from within sequoiaview
| Code: |
#SingleInstance force
Menu, mFileContext, Add, Copy, hFileContext
Menu, mFileContext, Add, Delete, hFileContext
Menu, mFileContext, Add, Mark, hFileContext
return
; Retrieves the Current Working Dir from the title bar
; This could also be retrieved from the Path select box
GetSequoiaCWD() {
WinGetTitle, TitlePath, ahk_class TSequoiaView
if TitlePath
StringTrimLeft, CWD,TitlePath,14
return CWD
}
; Retrieves the file the mouse is hovering on. To get the full path name
; you will need to provide the current working dir (obtained by calling
; GetSequoiaCWD). This function will work whether you are displaying
; filesizes or not in the tooltip window - see SequoiaViews options.
; This could also be retrieved from the status bar which would solve
; the hintwindow visibility issues when trigger keyboard hotkeys
GetSequoiaFile(CWD) {
ifWinExist, ahk_class THintWindow
WinGetTitle, HintPath, ahk_class THintWindow
else
return
FileSizePos := InStr(HintPath,"`r")
if FileSizePos
StringTrimRight,FilePath,HintPath, % StrLen(HintPath) - FileSizePos + 1
else
FilePath := HintPath
If InStr(FilePath,"...")
{
StringTrimLeft,FilePath,FilePath,3
FilePath = %CWD%%FilePath%
}
return FilePath
}
Show(what)
{
Clipboard=%what%
CoordMode, Tooltip,Relative
Tooltip,%what%,120,28
SetTimer,KillToolTip,2000
}
KillToolTip:
SetTimer,KillToolTip,Off
ToolTip,
return
hFileContext:
msgbox You Selected %A_ThisMenuItem% for %File%
return
/*
I have used XButtons here as key presses tend to hide the tooltip window
during the press. You could still use keys as hotkeys but you may need to
sleep till the toolwindow comes back or keep trying it in a loop.
Better Yet. Change the code to get path info from the statusbar
*/
#IfWinActive ahk_class TSequoiaView
; GetCurrentDir
XButton2::
Dir := GetSequoiaCWD()
Clipboard=%Dir%
Show(Dir)
return
; GetFileUnderCursor
XButton1::
Dir := GetSequoiaCWD()
File := GetSequoiaFile(Dir)
Menu, mFileContext, Show
;Show(File)
return
|
|
|