; 按快捷键`(即波浪号~所在的键盘按键)立即打开随身U盘中的办公专用文件夹
; 按快捷键`(即波浪号~所在的键盘按键)立即打开随身U盘中的办公专用文件夹
; WorkFolderHotkey.ahk
;
; http://www.autoahk.com/
; https://www.cnblogs.com/delphixx/p/12129024.html
; http://autohotkey.bokee.com/507525091.html
Hotkey,``,打开随身办公专用U盘
:*:/wk::
打开随身办公专用U盘()
return
;
打开随身办公专用U盘()
{
; 检测操作是否成功的定时器周期应当大于操作定时器的周期(即500大于100)
SetTimer,AllMissionComplete,500
SetTimer,OpenWorkFolder,100
SetTimer,ActivateWorkFolder,100
SetTimer,ReSizeWorkFolder,100
}
;
AllMissionComplete()
{
if(OpenCount >100)
{
SetTimer,AllMissionComplete,Delete
SetTimer,OpenWorkFolder,Delete
SetTimer,ActivateWorkFolder,Delete
SetTimer,ReSizeWorkFolder,Delete
ToolTip,没有找到随身U盘_请连接随身U盘到电脑
SetTimer, RemoveToolTip, 3000
}
IfWinActive,,01_办公文件
{
WinGetPos,X,Y,,,,01_办公文件
if(A_ScreenWidth/2-X=0)
{
SetTimer,AllMissionComplete,Delete
SetTimer,OpenWorkFolder,Delete
SetTimer,ActivateWorkFolder,Delete
SetTimer,ReSizeWorkFolder,Delete
}
}
}
;
OpenWorkFolder()
{
OpenCount++
IfWinNotExist,,01_办公文件
{
DriveGet,DriveList,List
loop,Parse,DriveList
{
DriveGet,USBDriveLabel,Label,%A_LoopField%:
IfInString,USBDriveLabel, 随身U盘
{
FileCreateDir,%A_LoopField%:1_办公文件
Run,%A_LoopField%:1_办公文件
}
}
}
}
;
ActivateWorkFolder()
{
WinShow,,01_办公文件
WinActivate,,01_办公文件
}
;
ReSizeWorkFolder()
{
WinMove,,01_办公文件,A_ScreenWidth/2,0,A_ScreenWidth/2,A_ScreenHeight-35
}
;
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return