一位网友请求在Total Commander中实现 “TC 文件夹 空白处双击返回上级目录”, 这个方案解决实现该要求, 立此存照
代码可能有点难以阅读,部分地方不完善,希望批评指正。该方案并没有完全严格符合需求者要求,但本人认为“右键双击”代替“左键双击空白处”更为恰当原因有二:
- TC的panel页条目较多时候(出现滚动条),无法找到空白处来双击以实现操作
- 本人认为在Total Commander中“双击空白”这个条件很难捕获,也许广大智慧的同胞们有思路,期待您的复习。
以下是代码:
/** * Function: GoToParentDirInTC * Go to parent dir when the user double-clicks the right mouse button in Total Commander * Requirements: * stable version of Total Commander,AHK v1.1 * Remarks: * - Go to "my computer" dir from driver root path * - Go to "desktop" dir from "my computer" dir * Author: * 风子 2713708366@qq.com */ #Persistent #SingleInstance force #NoEnv SetWorkingDir %A_ScriptDir% DetectHiddenWindows on Menu, Tray, NoStandard ;Create GUI Menu Menu, Tray, add, +开机启动 ,fMenu Menu, Tray, add, -开机启动 ,fMenu Menu, Tray, add, 暂停 , fMenu Menu, Tray, add, 重载 , fMenu Menu, Tray, add, 退出 , fMenu return RegRead,nSpeed,HKEY_CURRENT_USER,Control Panel\Mouse,DoubleClickSpeed ;Get DoubleClickSpeed. ~RButton:: bTrue:=(vID:=WinActive("ahk_exe Totalcmd.exe ahk_class TTOTAL_CMD")) ;Boolean for operation. and A_PriorHotkey=A_ThisHotkey and A_ThisHotkey="~RButton" and A_TimeSincePriorHotkey<(nSpeed?nSpeed:500) if (bTrue){ vText:="",tcFocus:="" ControlGetFocus,vFocus vMyPanel:=vFocus="TMyListBox1"?"TMyPanel9":"TMyPanel5" ;Identify panel,whose control ClassNN appear due to different versions of TC ControlGetText,vText,%vMyPanel%,ahk_id %vID% ;get current path nMs:=(vText~="^[a-z]:\\\*\.\*$"?2122:vText="\\Pc\*.*"?2121:2002) ;Specified message number Postmessage,1075, %nMs%,0,,ahk_id %vID% ;Postmessage } return fMenu(ItemName){ ;Function for GUI Menu IfEqual,ItemName,+开机启动, RegWrite,reg_sz,HKCU\Software\Microsoft\Windows\CurrentVersion\Run,%A_ScriptName%,%A_ScriptFullPath% IfEqual,ItemName,-开机启动, RegDelete,HKCU\Software\Microsoft\Windows\CurrentVersion\Run,%A_ScriptName% if ItemName~="开机启动" MsgBox,完成 IfEqual,ItemName,暂停,Pause IfEqual,ItemName,重载,Reload IfEqual,ItemName,退出,ExitApp }
可不可以实现,随TC打开而触发启动呢
我没测试 应该可以
可不可以帮忙修改下代码呢,小弟红包答谢,QQ2880424
可以 有空我看下的!