[AHK]设置快捷键快速呼出隐藏XYplorer

需求

XYplorer最小化到托盘后如何快捷呼出?

如题。 用上XYplorer后感觉不错,之前使用TC。 但最小化后会进入右下托盘位置。请问有无快捷键快速呼出? 谢谢

用AHK 解决:

; ===========================================================================
; 功能:为XYplorer增加 显示/隐藏 热键,关键是解决从托盘区呼出的问题。
;    Target - 配置为您的XYplorer路径,比如是 "E:\XYplorer\XYplorer.exe"
;    isMini2Tray - 配置为1时,则隐藏时会隐藏到托盘区.
;    常驻内存 - 配置为1时,则常驻内存,应设置下面的热键选项。
;    热键  -  配置为#e 则是设置热键为Win+e,完美替换系统自带热键。可随心来配置。

; 作者:liuyukuan
; 最新版本:https://blog.csdn.net/liuyukuan/article/details/119681945
; ===========================================================================
#SingleInstance,force
DetectHiddenWindows,on
;配置
  Target:="E:\XYplorer\XYplorer.exe"
  isMini2Tray:=1
  常驻内存:=1
  ;配置为0时,用完即退出,可代替XYplorer.exe来配合鼠标手势实现显示、隐藏
  热键:="#e"
  ;#表示Win +表示Shift !表示Alt ^表示Ctrl,需要前面配置为常驻内存。
  
  gosub main
  
if(常驻内存=1)
{
  Hotkey,%热键%,main
}
Else
{
  ExitApp
  
}
Return
  
; 激活或隐藏主函数
main:
  IfWinExist,ahk_class ThunderRT6FormDC
  {
    IfWinActive,ahk_class ThunderRT6FormDC
    {
      WinClose,ahk_class ThunderRT6FormDC
      if(isMini2Tray=1)
      {
        Gui1 := WinExist("ahk_class ThunderRT6FormDC")
        MinimizeGuiToTray(R,gui1)
      }
    }
    Else
    {
      WinShow,ahk_class ThunderRT6FormDC
      WinActivate,ahk_class ThunderRT6FormDC
    }
  }
  Else
  {
    Run,%Target% "%Parameters%",,,PID
  }
Return


MinimizeGuiToTray( ByRef R, hGui ) {
  WinGetPos, X0,Y0,W0,H0, % "ahk_id " (Tray:=WinExist("ahk_class Shell_TrayWnd"))
  ControlGetPos, X1,Y1,W1,H1, TrayNotifyWnd1,ahk_id %Tray%
  SW:=A_ScreenWidth,SH:=A_ScreenHeight,X:=SW-W1,Y:=SH-H1,P:=((Y0>(SH/3))?("B"):(X0>(SW/3))
  ? ("R"):((X0<(SW/3))&&(H0<(SH/3)))?("T"):("L")),((P="L")?(X:=X1+W0):(P="T")?(Y:=Y1+H0):)
  VarSetCapacity(R,32,0), DllCall( "GetWindowRect",UInt,hGui,UInt,&R)
  NumPut(X,R,16), NumPut(Y,R,20), DllCall("RtlMoveMemory",UInt,&R+24,UInt,&R+16,UInt,8 )
  DllCall("DrawAnimatedRects", UInt,hGui, Int,3, UInt,&R, UInt,&R+16 )
  WinHide, ahk_id %hGui%
}

使用方法:

方法1:将上面脚本存储成扩展名为ahk的文件,并将autohotkey.exe与之放到同一个目录下,并将autohotkey.exe改成与脚本同名。这样双击exe即可运行。autohotkey.exe下载 请猛戳 https://www.autohotkey.com/download/ahk.zip 。

方法2:将ahk文件编译成exe文件使用,编译工具需要下载AutoHotkey环境。AutoHotkey安装文件可从www.autohotkey.com网站下载。

如果是常驻内存的话,热键就可以用来呼出、隐藏XYplorer

如果不是常驻内存,可以结合鼠标手势软件,比如MouseInc

我配置成→ ↑ 示范如下:

Guess you like

Origin blog.csdn.net/liuyukuan/article/details/119681945