;
;
; 開機時自動啟動的AutoHotkey腳本
;
; 此腳本修改時間 2019年06月18日20時48分
;
; 計時器創建代碼段 -----------------------------------------------------------------------------------------
; SetTimer可以模擬多線程從而不影響主線程的流暢執行
; 請在SciTE4AutoHotkey中選中單詞並按快捷鍵F12跳轉到函數定義處
; 綠色免安裝程序,統一都分類保存在本地磁盤D分區文件夾 D:\Program 中
; 例如: MasterSeeker就長期堅持固定不變保存位置在 D:\Program\MasterSeeker\MasterSeeker.exe
; 例如: FileLocator Pro就長期堅持固定不變保存位置在 D:\Program\FileLocator\FileLocator.exe
; #####################################################################
;
global ProgramDir
ProgramDir=%A_ScriptDir%\..
SetTimer,01設置全局無窗口快捷鍵,-1000
; 請養成按<Win> + F 隱藏MasterSeeker窗口的習慣
SetTimer,12保持MasterSeeker窗口常駐內存,9000
SetTimer,13設置此腳本的運行參數,-1000
SetTimer,14設置此腳本用戶自定義變量,-1000
SetTimer,15防止重復運行此腳本,-1000
SetTimer,16運行國稅金稅盤開票軟件,-100
SetTimer,17運行一些軟件應用程序,-1000
SetTimer,18關廣告窗口刪除廣告文件,3000
; 設置插入當前日期和時間的熱字串WT ( What is the time now )
::wt::
NowTimeString=%A_YYYY%年%A_MM%月%A_DD%日%A_Hour%時%A_Min%分
Clipboard=%NowTimeString%
Send ^v
return
return
;
; 此腳本相關信息說明段 ---------------------------------------------------------------------------------------
; 用法 把此AHK腳本文件復制到 “shell:startup”文件夾中
; shell:startup”文件夾一般位於開始菜單->所有程序->啟動 文件夾
; 作者 徐曉亮 vlanweiyun618
; 電子郵箱地址 595076941@QQ.com
; 手機號碼
;
; 函數子程序定義段 --------------------------------------------------------------------------------------------
;
01設置全局無窗口快捷鍵()
{
Hotkey,`#n,02激活或隱藏窗口EmEditor
Hotkey,`#e,03激活或隱藏窗口TotalCommander ; 按熱鍵 Win+E 激活 TotalCommander
Hotkey,`#f,04激活或隱藏窗口MasterSeeker
Hotkey,`#g,05激活或隱藏窗口Everything
Hotkey,`#s,06激活或隱藏窗口SogouExplorer
Hotkey,`#c,07激活或隱藏窗口計算器Calc ; 按熱鍵 Win + C,打開計算器
Hotkey,`^!E,08用SciTE4AutoHotkey編輯此腳本
Hotkey,`^!R,09重啟此腳本
Hotkey,^!F10,10終止此腳本執行 ;按Ctrl+Alt+F10鍵此腳本立即停止執行並退出
}
;
02激活或隱藏窗口EmEditor()
{
根據窗口類名激活或者隱藏窗口()
}
;
03激活或隱藏窗口TotalCommander()
{
根據窗口類名激活或者隱藏窗口("TotalCMD","TTOTAL_CMD")
}
;
04激活或隱藏窗口MasterSeeker()
{
根據窗口類名激活或者隱藏窗口("MasterSeeker","WindowsForms10.Window.8.app.0.218f99c")
;----- 全選激活MasterSeeker窗口的搜索編輯框:
loop,3
{
ControlFocus,Filename,ahk_class WindowsForms10.Window.8.app.0.218f99c
Sleep,10
ControlSend,Filename,{End},ahk_class WindowsForms10.Window.8.app.0.218f99c
}
Sleep,10
ControlSend,Filename,{ShiftDown}{Home}{ShiftUp},ahk_class WindowsForms10.Window.8.app.0.218f99c
Sleep,10
}
;
05激活或隱藏窗口Everything()
{
; 當窗口標題測試不通過的話只好用窗口類了
Process,Close,Everything.exe
根據窗口類名激活或者隱藏窗口("Everything","EVERYTHING")
}
;
06激活或隱藏窗口SogouExplorer()
{
根據窗口類名激活或者隱藏窗口("SogouExplorer","SE_SogouExplorerFrame")
}
;
07激活或隱藏窗口計算器Calc()
{
Run,calc
}
;
08用SciTE4AutoHotkey編輯此腳本()
{
IfExist,%ProgramDir%\AutoHotkey\SciTE\SciTE.exe
Run,%ProgramDir%\AutoHotkey\SciTE\SciTE.exe %A_ScriptName%
else
{
ToolTip,找不到文件%ProgramDir%\AutoHotkey\SciTE\SciTE.exe ,% A_ScreenWidth/2-150,% A_ScreenHeight/2-150
SetTimer, RemoveToolTip, 5000
Sleep,3000
}
}
;
09重啟此腳本()
{
Reload
}
;
10終止此腳本執行()
{
ToolTip,%A_ScriptName% (即此腳本)已經退出
SetTimer, RemoveToolTip, 500
Sleep,500
ExitApp
}
;
12保持MasterSeeker窗口常駐內存()
{
Process,Exist,MasterSeeker.exe
if (%ErrorLevel%=0)
{
IfWinNotExist,MasterSeeker 1.5.1 by DxCK
{
IfWinNotExist,ahk_exe MasterSeeker.exe
{
IfExist,%ProgramDir%\MasterSeeker\MasterSeeker.exe
Run,%ProgramDir%\MasterSeeker\MasterSeeker.exe
WinWait,ahk_class WindowsForms10.Window.8.app.0.218f99c
loop,3
{
WinHide,ahk_class WindowsForms10.Window.8.app.0.218f99c
Sleep,100
}
}
}
}
}
;
13設置此腳本的運行參數()
{
#SingleInstance,force ;當此腳本已經運行時自動替換舊實例再次運行。
#Persistent ;讓腳本持久運行(即直到用戶關閉或遇到 ExitApp)。
#NoEnv ;不檢查空變量是否為環境變量(建議所有新腳本使用)。
#WinActivateForce ;用強制的方法激活窗口。阻止任務欄按鈕的閃爍.
;~ #NoTrayIcon ;不顯示托盤圖標。
;~ #Warn
SetWorkingDir,%A_ScriptDir% ;改變腳本的當前工作目錄。
DetectHiddenWindows,On ;設置腳本可以“看見”隱藏的窗口。
SetTitleMatchMode,2 ;窗口標題匹配模式改成某個位置必須包含WinTitle。
SendMode,Input ;SendInput 通常更快更可靠. 緩存了發送期間任何物理的鍵盤或鼠標活動, 避免了在發送時夾雜用戶的鍵擊.
CoordMode,Mouse,Screen
CoordMode,Pixel,Screen
CoordMode,ToolTip,Screen
ListLines,Off
SetBatchLines,-1
SetStoreCapsLockMode, On
;~ SetBatchLines,
;~ SetKeyDelay,
;~ SetWinDelay,
;~ SetControlDelay,
}
;
14設置此腳本用戶自定義變量()
{
;~ global 移動硬盤盤符 ;帶冒號:
}
;
15防止重復運行此腳本()
{
#SingleInstance,force
loop,33
{
DetectHiddenWindows,On
Sleep,33
IfWinExist,QQ595076941_AutoRunAHK
ExitApp
}
Gui, Show, Hide,QQ595076941_AutoRunAHK
}
;
16運行國稅金稅盤開票軟件()
{
IfExist,D:\Progra~1\開票軟件\MainExecute.exe
{
Run,D:\Progra~1\開票軟件\MainExecute.exe
loop,333
{
WinGet, WinID, ID,LoginForm
DllCall("SwitchToThisWindow", "UInt", WinID, "UInt", 1)
WinGetActiveTitle,WinActiveTitlekp
Sleep,500
IfInString,WinActiveTitlekp,LoginForm
{
ControlClick,登錄,LoginForm
}
Sleep,500
IfWinActive,,上報匯總已成功
{
ControlClick,確認,,上報匯總已成功
}
;~ 如果成功登錄國稅開票軟件,那么立即退出本次LOOP循環
IfInString,WinActiveTitlekp,增值稅發票稅控開票軟件
{
break
}
;~ 證書口令不能為空,退出循環,手工登錄
IfWinExist,,證書口令不能為空
{
break
}
}
Sleep,100
;~ Run,%comspec% /c C:\Windows\System32\Rundll32.Exe user32.dll LockWorkStation
Sleep,2000
WinClose,USB KEY PIN,請輸入KEY的PIN碼
}
}
;
17運行一些軟件應用程序()
{
IfExistRun("WiseDesktop") ;虛擬桌面
;~ IfExistRun("Rolan")
;~ IfExistRun("PCOff") ;定時強制關機精靈1.0 在 17:05 下班后定時強制關閉電腦
}
;
18關廣告窗口刪除廣告文件()
{
; 請用 AHKInfo 1.3.5 窗口信息查詢工具來獲取窗口標題和窗口類名
;~ 廣告彈窗專殺語句格式 WinClose,ahk_exe SohuNews.exe
;~ ;; ;; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;~ WinClose,ahk_exe
;~ WinClose,USB KEY PIN,請輸入KEY的PIN碼
;~ WinClose,ahk_exe QQPCSoftTrayTips.exe
;~ WinClose,ahk_exe QQPCTray.exe
;~ WinClose,ahk_exe SohuNews.exe
;~ WinClose,ahk_exe SGTool.exe
;~ WinClose,ahk_exe PicFaceTool.exe
;~ WinClose,ahk_exe wpscEnter.exe
;~ WinClose,ahk_exe WindowsForms10.Window.20008.app.0.261f82a_r13_ad1
;~ WinClose,ahk_exe AutoShow.exe
;~ WinClose,ahk_exe skinbox.exe
;~ WinClose,ahk_exe WnComMgr.exe
;~ WinClose,ahk_exe WnMoniter.exe
;~ WinClose,ahk_exe WnHelper64.exe
;~ WinClose,ahk_exe WnUserPage.exe
;~ WinClose,ahk_class TXGuiFoundation
;~ WinClose,頭條新聞
;~ WinClose,到期抄報稅提示
;~ WinClose,USB KEY PIN,請輸入KEY的PIN碼
;等待指定標題窗口出現
;~ WinClose,FF新推薦 ahk_class #32770,
}
;
; 請使用 窗口信息工具 AHKInfo 1.3.5 獲取窗口的類名
根據窗口類名激活或者隱藏窗口(VarExeFileName:="EmEditor",VarWinClassName:="EmEditorMainFrame3")
{
; 1、如果程序沒有運行則運行程序
Process,Exist,%VarExeFileName%.exe
if (%ErrorLevel%=0)
{
IfExist,%ProgramDir%\%VarExeFileName%\%VarExeFileName%.exe
{
Run,%ProgramDir%\%VarExeFileName%\%VarExeFileName%.exe
return
}
else
{
MsgBox,找不到文件 %ProgramDir%\%VarExeFileName%\%VarExeFileName%.exe
return
}
}
; 2、如果窗口未置頂則顯示並激活(切換到)指定窗口
IfWinNotActive,ahk_class %VarWinClassName%
{
loop,3
{
WinShow,ahk_class %VarWinClassName%
WinMaximize,ahk_class %VarWinClassName%
WinGet, WinID, ID,ahk_class %VarWinClassName%
DllCall("SwitchToThisWindow", "UInt", WinID, "UInt", 1)
}
return
}
; 3、如果窗口已經顯示並置頂則隱藏窗口
;~ WinMinimize,ahk_class %VarWinClassName%
WinHide,ahk_class %VarWinClassName%
}
IfExistRun(TargetEXE) ;檢查文件是否存在並運行程序
{
IfExist,%ProgramDir%\%TargetEXE%\%TargetEXE%.exe
Run,%ProgramDir%\%TargetEXE%\%TargetEXE%.exe
else
{
ToolTip,未找到文件%ProgramDir%\%TargetEXE%\%TargetEXE%.exe
SetTimer, RemoveToolTip, 5000
}
}
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
;
; #####################################################################
;
; 此腳本到此行結束