开机时自动启动的AutoHotkey脚本

 

开机时自动启动的AutoHotkey脚本

 

;
; 开机时自动启动的AutoHotkey脚本

;
; 此脚本最后修改时间 2019年10月30日
; 如果需要另存为副本备份脚本请在SciTE4AutoHotkey编辑器中按快捷键 Ctrl + Shift + S
; 如果需要设置书签请在SciTE4AutoHotkey编辑器中按快捷键 Ctrl + F2
; 如果需要跳转到函数定义源代码处请在SciTE4AutoHotkey编辑器中双击选中函数名并按快捷键 F12
; 如果需要无条件终止此脚本(停止运行并退出)请按快捷键 Ctrl + F12
;
; http://www.autoahk.com/archives/16110
;
; https://gitee.com/weiyunwps618/codes/d6hni2ft1yzeps0wul87g65
;
; https://www.cnblogs.com/delphixx/p/11775102.html
;
global ProgramDir
ProgramDir=%A_ScriptDir%\..
SetTimer,01设置全局无窗口快捷键,-1000
; Rolan 1.3.8 脱壳稳定版 应用程序快速启动工具软件 完美版 永久版 自用修改版
SetTimer,12保持Wox_快捷键Alt和空格键常驻内存,3000
; 请养成按<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%日
	;~ NowTimeString=%A_YYYY%年%A_MM%月%A_DD%日%A_Hour%时%A_Min%分
	Clipboard=%NowTimeString%
	Send ^v
return
return
;
; 此脚本相关信息说明段 ---------------------------------------------------------------------------------------
; 用法 把此AHK脚本文件复制到 “shell:startup”文件夹中
; shell:startup”文件夹一般位于开始菜单->所有程序->启动 文件夹
; 作者 徐晓亮 weiyunwps618
; 电子邮箱地址 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,^F12,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
}
;
; Rolan 1.3.8 脱壳稳定版 应用程序快速启动工具软件 完美版 永久版 自用修改版
;~ Wox 是一个开源免费的快速启动器工具,安装后可以通过快捷键 Ctrl + space 呼出,可以快速高效率打开软件/搜索文件等。
12保持Wox_快捷键Alt和空格键常驻内存()
{
	Process,Exist,Wox.exe
	if (%ErrorLevel%=0)
	{
		IfExist,C:\Users\Administrator\AppData\Local\Wox\Wox.exe
			Run,C:\Users\Administrator\AppData\Local\Wox\Wox.exe
	}
}
;
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
					WinHide, MasterSeeker 1.5.1 by DxCK ahk_class WindowsForms10.Window.8.app.0.218f99c ahk_exe MasterSeeker.exe, statusStri

					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,C:\Windows\System32\Rundll32.Exe user32.dll LockWorkStation
		Sleep,2000
		WinClose,USB KEY PIN,请输入KEY的PIN码
	}
}
;
17运行一些软件应用程序()
{
	SetTimer,定时检查uTools_V083beta简体中文汉化版是否退出如果退出则重新运行,5000
	SetTimer,定时重启向日葵远程控制保持远程访问可用,900000
	SetTimer,闲置超时锁定桌面,30000
	IfExistRun("WiseDesktop") ; WiseDesktop 1.3 虚拟桌面管理程序
	IfExistRun("PCOff") ;定时强制关机精灵1.0 在 17:05 下班后定时强制关闭电脑
}
;
定时检查uTools_V083beta简体中文汉化版是否退出如果退出则重新运行()
{
	Process,Exist,uTools.exe
	if (%ErrorLevel%=0)
	{
		IfExist,D:\DIYTOOLS\uTools\uTools.exe
			Run,D:\DIYTOOLS\uTools\uTools.exe
		;~ IfExist,C:\Program Files\uTools\uTools.exe
		;~ Run,C:\Program Files\uTools\uTools.exe
	}
}

;
定时重启向日葵远程控制保持远程访问可用()
{
	loop,5
	{
		;~ WinMove
		;~ WinMaximize
		;~ WinHide
		;~ WinClose
		;~ WinKill
		;~ Process,Close,
		;~ WinGet, active_id, PID, A
		;~ run, taskkill /PID %active_id% /F,,Hide
		;~ Run, Target [, WorkingDir, Max|Min|Hide|UseErrorLevel, OutputVarPID]
		;~ 要想得到pid, 需要把WorkingDir的参数置空,否则就得不到,真是坑爹
		Sleep,500
		WinClose, 桌面控制 ahk_class SDL_app ahk_exe SunloginClient.exe,
		Sleep,500
		WinKill, 桌面控制 ahk_class SDL_app ahk_exe SunloginClient.exe,
		Sleep,500
		WinClose, 向日葵远程控制 ahk_class SDL_app ahk_exe SunloginClient.exe,
		Sleep,500
		WinKill, 向日葵远程控制 ahk_class SDL_app ahk_exe SunloginClient.exe,
		Sleep,500
		Process,Close,SunloginClient.exe
	}
	loop,2
	{
		Sleep,5000
		IfExist,D:\DIYTOOLS\SunloginClient\SunloginClient.exe
			Run,D:\DIYTOOLS\SunloginClient\SunloginClient.exe
		IfExist,C:\Program Files\Oray\SunLogin\SunloginClient\SunloginClient.exe
			Run,C:\Program Files\Oray\SunLogin\SunloginClient\SunloginClient.exe
		IfExist,C:\Program Files (x86)\Oray\SunLogin\SunloginClient\SunloginClient.exe
			Run,C:\Program Files (x86)\Oray\SunLogin\SunloginClient\SunloginClient.exe
	}
}
;
闲置超时锁定桌面()
{
	if(A_TimeIdle>300000)
	;~ if(A_TimeIdlePhysical>300000)
	{
		Send,{AltDown}4{AltUp} ; 发送模拟按键到 WiseDesktop 1.3 虚拟桌面管理程序 隐藏所有工作窗口
		Run,C:\Windows\System32\Rundll32.Exe user32.dll LockWorkStation
	}
}
18关广告窗口删除广告文件()
{
	; 请用 AHKInfo 1.3.5 窗口信息查询工具来获取窗口标题和窗口类名
	;等待指定标题窗口出现
	WinClose, FF新推荐
	;~ 广告弹窗专杀语句格式 WinClose,ahk_exe SohuNews.exe
	;~ ;; ;; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	WinHide, ahk_class Suspension,
	WinHide, 迅雷 ahk_class Chrome_WidgetWin_0, Chrome Leg
	WinClose, 今日推荐
	WinHide, 今日推荐
	;~ 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
	}
}
;
; 本文的最后修改日期是 公元2019年11月07日
; 本文的网址是 https://gitee.com/weiyunwps618/codes
; 本文的网址是 https://www.cnblogs.com/delphixx
; 晓亮(weiyunwps618)的腾讯QQ邮箱地址是 595076941@qq.com )
; 晓亮(weiyunwps618)的中国移动手机号码是 138####5488 )
; 此AHK脚本的测试环境是 Windows 7 Pro SP1 VL 和 AutoHotkey v1.1.30.01
;
RemoveToolTip:
	SetTimer, RemoveToolTip, Off
	ToolTip
return
; ####################################
; 计时器创建代码段 ---------------------------------
; SetTimer可以模拟多线程从而不影响主线程的流畅执行
; 请在SciTE4AutoHotkey中选中单词并按快捷键F12跳转到函数定义处
; 绿色免安装程序,统一都分类保存在本地磁盘D分区文件夹 D:\Program 中
; 例如: MasterSeeker就长期坚持固定不变保存位置在 D:\Program\MasterSeeker\MasterSeeker.exe
; 例如: FileLocator Pro就长期坚持固定不变保存位置在 D:\Program\FileLocator\FileLocator.exe
; ####################################
; 此脚本到此行结束

 

给TA捐赠
共{{data.count}}人
人已捐赠
其他

AHK源代码加密

2019-11-5 8:59:52

其他

uTools电脑软件快速启动工具

2019-11-7 12:04:53

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
有新私信 私信列表
搜索