//////////////////////////////////////////////////////
001、在电脑桌面上新建批处理文件
文件名改成“dn电脑操作规范-2019年03月.bat”
并添加如下一行脚本语句:
002、安装并设置打开“百度网盘PC版”桌面快捷方式的
右键菜单的属性自定义快捷键为F8
所有办公类文档表格图片文件都在百度网盘中
新建改名编辑移动和删除
003、新建当前工作的桌面上的非办公本地文件夹的桌面快捷方式
并设置快捷键为F4
004、安装EmEditor软件用于编辑TXT纯文本文件
立即保存
EmEditor定时备份和自动保存设置
工具->当前配置->自动保存
工具->所有配置
005、安装WPSOffice2016专业版用于编辑doc文档和xls表格
WPS定时备份设置
文件->选项->备份设置
切换标签
关闭当前文件标签
关闭所有文件
///////////////////////////////////////////////////////////
006、安装PhotoshopCS6用于编辑jpg图片
007、对需要一般保密的文件用极品私人密盘加密
008、文件关闭后自动备份
采用AutoHotkey脚本定时自动压缩备份和百度网盘上传备份相结合的方式进行文件备份
009、安装Rolan1.3.6.1用于快速搜索并打开程序
把Rolan的窗口呼出热键设置为
010、安装MasterSeeker用于搜索本地文件
011、安装FileLocatorPro用于搜索本地文件正文内容
05、最后清理一下鼠标右键的新建菜单,还是用软件,MenuMgr右键管家
由于我只用Word97-2003和Excel97-2003文档表格格式的文件,从不使用现在的现代全新docx和xlsx文档表格格式的文件所以不讨论有关新格式的作者属性修改方法,(新格式作者修改的是带宏的模板文件修改比较麻烦需要先编辑好文档另存为带宏的模板格式的文件然后再重命名覆盖文件,其他格式文件的默认新建修改也与WPS文字的修改相似)06、一键设置文档表格作者和清理鼠标右键菜单的AutoHotkey脚本源代码(开发中。。。)07、批量设置文档表格作者的AutoHotkey脚本源代码(支持无限级别子文件夹中的文档表格)(FileCopy、RegDelete开发中。。。)(敬请期待);;loop,Files,%A_ScriptDir%\*.*,R;递归遍历穷举文件夹和子文件夹中的文件08、最后WinRAR手动压缩带日期掩码备份所有修改过的文件供今后使用文件1:C:\ProgramFiles\Kingsoft\WPSOffice\11.8.2.8053\office6\mui\zh_CN\templates\newfile.wpsC:\ProgramFiles\Kingsoft\WPSOffice\11.8.2.8053\office6\mui\zh_CN\templates\newfile.etC:\ProgramFiles\Kingsoft\WPSOffice\11.8.2.8053\oem\companylogo.PNG
博客园网址用户名密码
boai
g-3###
014、为了避免用“杏雨梨云启动U盘”安装Windows7专业版操作系统,请用一键GHOST硬盘版备份操作系统C盘磁盘分区。
//////////////////////////////////////////////////
015、安装AutoHotkey并设置自动启动AutoRun脚本
rem一键安装AutoHotkey自动化热键脚本语言编程环境
D:cd\Program\AutoHotkey
rem设置ahk文件类型关联到AutoHotkeyU32.exerem以便运行脚本rem解压缩“AutoHotkey_1.1.30.01_setup.exe”安装文件得到setup.exe
rem由于AutoHotkey的安装包会记住上次安装的位置,rem为了软件安装位置固定到D:\Program\AutoHotkey文件夹所以此处必需指定安装目标文件夹D:\Program\AutoHotkey\ahksetup.exe/S/D=D:\Program\AutoHotkey
rem添加ahk文件类型鼠标右键菜单rem运行、编辑、编译脚本的关联,感谢作者写出这么好的脚本D:\Program\AutoHotkey\autohotkeyu32.exeD:\Program\AutoHotkey\MenuSetup.ahk
///////////////////////////////////////////////
;---20190207晓亮修改---
#NoEnv#SingleInstance,forceSendModeInputSetWorkingDir%A_ScriptDir%
;版本(仅用于显示)Script_Version=v1.0.3.2
ifIsLimitedUser=0;非受限用户操作HKCR键{RootKey=HKCRSubkey=}else;受限用户操作HKCU键{RootKey=HKCUSubkey=Software\Classes\;<--为简化后面的脚本,此子键须以“\”结尾}
;检查是否存在AHK注册表项RegRead,FileType,%RootKey%,%Subkey%.ahkifFileType<>{RegRead,value,%RootKey%,%Subkey%%FileType%\Shell\Open\Command;AHK路径AHK_Path:=PathGetPath(value)RegRead,value,%RootKey%,%Subkey%%FileType%\Shell\Edit\Command;编辑器路径Editor_Path:=PathGetPath(value)RegRead,value,%RootKey%,%Subkey%%FileType%\Shell\Compile\Command;编译器路径Compiler_Path:=PathGetPath(value)RegRead,Template_Name,%RootKey%,%Subkey%.ahk\ShellNew,FileName;模板文件名}elseFileType=AutoHotkeyScript
ifAHK_Path={IfExist,%A_ScriptDir%\AutoHotkey.exeAHK_path=%A_ScriptDir%\AutoHotkey.exe}
ifEditor_Path={IfExist,%A_ScriptDir%\SciTE\SciTE.exeEditor_Path=%A_ScriptDir%\SciTE\SciTE.exe}
ifCompiler_Path={IfExist,%A_ScriptDir%\Compiler\Ahk2Exe.exeCompiler_Path=%A_ScriptDir%\Compiler\Ahk2Exe.exe}
ifTemplate_Name=Template_Name=Template.ahk
;---20190207晓亮修改---;设置AHK默认文件夹为D:\Program\AutoHotkeyAHK_path=D:\Program\AutoHotkey\AutoHotkeyU32.exeEditor_Path=D:\Program\AutoHotkey\SciTE\SciTE.exeCompiler_Path=D:\Program\AutoHotkey\Compiler\Ahk2Exe.exe
Gui,Add,Tab,x10y10w480h250Choose1,设置|说明Gui,Tab,1Gui,Add,GroupBox,x20y40w460h50,“运行脚本”关联的AutoHotkeyGui,Add,Edit,x35y60w340h20vAHK_Path,%AHK_path%Gui,Add,Button,x385y60w40h20gFind_AHK,浏览
Gui,Add,GroupBox,x20y100w460h50,“编辑脚本”关联的编辑器Gui,Add,Edit,x35y120w340h20vEditor_Path,%Editor_Path%Gui,Add,Button,x385y120w40h20gChoose_Editor,浏览Gui,Add,Button,x430y120w40h20gDefault_Editor,默认
Gui,Add,GroupBox,x20y160w460h50,“编译脚本”关联的编译器Gui,Add,Edit,x35y180w340h20vCompiler_Path,%Compiler_Path%Gui,Add,Button,x385y180w40h20gChoose_Compiler,浏览Gui,Add,Button,x430y180w40h20gDefault_Compiler,默认
Gui,Add,Checkbox,x35y230w270h20gNew_ScriptvNew_Script,右键“新建”菜单中增加“AutoHotkey脚本”Gui,Add,Button,x310y230w80h20vEdit_TemplategEdit_Template,编辑脚本模板Gui,Add,Button,x400y230w80h20vDelete_TemplategDelete_Template,删除脚本模板
Gui,TabGui,Add,Button,x100y270w60h20DefaultgInstall,设置Gui,Add,Button,x200y270w60h20gUninstall,卸载Gui,Add,Button,x300y270w60h20gCancel,取消
Gui,Show,x250y200h300w500CEnter,ScriptSetting%Script_Version%GuiControl,Disable,Edit_Template;使“编辑脚本模板”按钮无效IfNotExist,%A_WinDir%\ShellNew\%Template_Name%GuiControl,Disable,Delete_Template;使“删除脚本模板”按钮无效
;当鼠标指向链接时,指针变成手形hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt");IDC_HANDOnMessage(0x200,"WM_MOUSEMOVE")
;---20190207晓亮修改---goto,Installreturn
;改变鼠标指针为手形WM_MOUSEMOVE(wParam,lParam){globalhCursMouseGetPos,,,,ctrlifctrlinstatic2DllCall("SetCursor","UInt",hCurs)return}return
GuiClose:GuiEscape:Cancel:ExitApp
;查找AutoHotkey主程序Find_AHK:Gui+OwnDialogsFileSelectFile,AHK_Path,3,,查找AutoHotkey.exe,AutoHotkey.exeifAHK_Path<>GuiControl,,AHK_Path,%AHK_Path%gosubDefault_Compilerreturn
;选择脚本编辑器Choose_Editor:Gui+OwnDialogsFileSelectFile,Editor_Path,3,,选择脚本编辑器,程序(*.exe)ifEditor_Path<>GuiControl,,Editor_Path,%Editor_Path%return
;默认脚本编辑器Default_Editor:IfExist,%A_ScriptDir%\SciTE\SciTE.exeEditor_Path=%A_ScriptDir%\SciTE\SciTE.exeelseifExist,%A_WinDir%\system32\notepad.exeEditor_Path=%A_WinDir%\system32\notepad.exeGuiControl,,Editor_Path,%Editor_Path%return
;选择脚本编译器Choose_Compiler:Gui+OwnDialogsFileSelectFile,Compiler_Path,3,,选择脚本编译器,程序(*.exe)ifCompiler_Path<>GuiControl,,Compiler_Path,%Compiler_Path%return
;默认脚本编译器Default_Compiler:GuiControlGet,AHK_PathSplitPath,AHK_Path,,AHK_DirIfExist,%AHK_Dir%\Compiler\Ahk2Exe.exe{Compiler_Path=%AHK_Dir%\Compiler\Ahk2Exe.exeGuiControl,,Compiler_Path,%Compiler_Path%}return
;设置Install:Gui,SubmitIfNotExist,%AHK_Path%{MsgBox,16,ScriptSetting%Script_Version%,AutoHotkey路径错误!return}
IfNotExist,%Editor_Path%{MsgBox,16,ScriptSetting%Script_Version%,编辑器路径错误!return}
IfNotExist,%Compiler_Path%{MsgBox,16,ScriptSetting%Script_Version%,编译器路径错误!return}
;写入注册表RegWrite,REG_SZ,%RootKey%,%Subkey%.ahk,,%FileType%ifNew_Script=1{RegWrite,REG_SZ,%RootKey%,%Subkey%.ahk\ShellNew,FileName,%Template_Name%IfNotExist,%A_WinDir%\ShellNew\%Template_Name%gosubCreate_Template}else{;---20190207晓亮修改---;---此处不要删除右键新建ahk文件的菜单所以注释掉此代码;RegDelete,%RootKey%,%Subkey%.ahk\ShellNewIfExist,%A_WinDir%\ShellNew\%Template_Name%gosubDelete_Template}
RegWrite,REG_SZ,%RootKey%,%Subkey%%FileType%,,AutoHotkey脚本RegWrite,REG_SZ,%RootKey%,%Subkey%%FileType%\DefaultIcon,,%AHK_Path%`,1RegWrite,REG_SZ,%RootKey%,%Subkey%%FileType%\Shell,,OpenRegWrite,REG_SZ,%RootKey%,%Subkey%%FileType%\Shell\Open,,运行脚本RegWrite,REG_SZ,%RootKey%,%Subkey%%FileType%\Shell\Open\Command,,"%AHK_Path%""`%1"`%*RegWrite,REG_SZ,%RootKey%,%Subkey%%FileType%\Shell\Edit,,编辑脚本RegWrite,REG_SZ,%RootKey%,%Subkey%%FileType%\Shell\Edit\Command,,"%Editor_Path%""`%1"RegWrite,REG_SZ,%RootKey%,%Subkey%%FileType%\Shell\Compile,,编译脚本IfInString,Compiler_Path,Ahk2Exe.exeRegWrite,REG_SZ,%RootKey%,%Subkey%%FileType%\Shell\Compile\Command,,"%Compiler_Path%"/in"`%1"elseRegWrite,REG_SZ,%RootKey%,%Subkey%%FileType%\Shell\Compile\Command,,"%Compiler_Path%""`%1"
/*新版的scite不需要将“SciTEUser.properties”放在“USERPROFILE”目录下了ifEditor_Path=%A_ScriptDir%\SciTE\SciTE.exe{EnvGet,USERPROFILE,USERPROFILEFileCopy,%A_ScriptDir%\SciTE\SciTEUser.properties,%USERPROFILE%\SciTEUser.properties,1}*/
;MsgBox,64,ScriptSetting%Script_Version%,设置完毕!ExitApp
;卸载Uninstall:;---20190207晓亮修改---;MsgBox,36,ScriptSetting%Script_Version%;,注意:卸载后您将无法通过双击来运行脚本,也不能通过右键菜单来启动脚本编辑器...`n`n确定要取消AHK脚本的系统关联吗?;IfMsgBox,Yes;{;RegDelete,%RootKey%,%Subkey%.ahk;RegDelete,%RootKey%,%Subkey%%FileType%;gosubDelete_Template;ExitApp;}return
;编辑脚本模板Edit_Template:GuiControlGet,Editor_PathIfNotExist,%Editor_Path%{MsgBox,64,ScriptSetting%Script_Version%,脚本编辑器路径错误!return}IfNotExist,%A_WinDir%\ShellNew\%Template_Name%gosubCreate_TemplateRun,%Editor_Path%%A_WinDir%\ShellNew\%Template_Name%return
;使编辑脚本模板按钮有效/无效New_Script:GuiControlGet,New_ScriptifNew_Script=0GuiControl,Disable,Edit_TemplateelseGuiControl,Enable,Edit_Templatereturn
;新建脚本模板Create_Template:GuiControlGet,AHK_PathFileGetVersion,AHK_Ver,%AHK_Path%
#NoEnvSendModeInputSetWorkingDir`%A_ScriptDir`%
),%A_WinDir%\ShellNew\%Template_Name%
GuiControl,Enable,Delete_Template;使“删除脚本模板”按钮有效return
;删除脚本模板Delete_Template:
;---20190207晓亮修改---;MsgBox,36,ScriptSetting%Script_Version%;,要删除当前的AHK脚本模板吗?`n`n脚本模板被删除后,仍可通过本工具重建模板。;IfMsgBox,Yes;FileDelete,%A_WinDir%\ShellNew\%Template_Name%;GuiControl,Disable,Delete_Template;使“删除脚本模板”按钮无效return
;从注册表值字符串中提取路径PathGetPath(pSourceCmd){localPath,ArgsStartPos=0if(SubStr(pSourceCmd,1,1)="""")Path:=SubStr(pSourceCmd,2,InStr(pSourceCmd,"""",False,2)-2)else{ArgsStartPos:=InStr(pSourceCmd,"")ifArgsStartPosPath:=SubStr(pSourceCmd,1,ArgsStartPos-1)elsePath=%pSourceCmd%}returnPath}
//////////////////////////////////////////////////////////////////
02设置全局无窗口快捷键(){Hotkey,F10,终止此脚本执行;按F10键此脚本立即停止执行并退出Hotkey,``,08_激活或隐藏窗口唯一办公包内盘927GB的办公专用文件夹Hotkey,`#b,09_加密压缩备份唯一办公包内盘927GB的办公专用文件夹到D盘Hotkey,`#n,10_激活或隐藏窗口EmEditorHotkey,`#e,11_激活或隐藏窗口TotalCommander;按热键Win+E激活TotalCommanderHotkey,`#f,12_激活或隐藏窗口MasterSeekerHotkey,`#g,13_激活或隐藏窗口EverythingHotkey,`#s,14_激活或隐藏窗口SogouExplorerHotkey,`#c,15_激活或隐藏窗口计算器Calc;按热键Win+C,打开计算器Hotkey,`^!E,16_用SciTE4AutoHotkey编辑此脚本Hotkey,`^!H,17_激活或隐藏窗口AutoHotkey中文CHM帮助文件Hotkey,`^!R,18_重启_重新装载运行_此脚本}
03保持MasterSeeker窗口常驻内存(){Process,Exist,MasterSeeker.exeif(%ErrorLevel%=0){IfWinNotExist,MasterSeeker1.5.1byDxCK{IfWinNotExist,ahk_exeMasterSeeker.exe{IfExist,D:\Program\MasterSeeker\MasterSeeker.exeRun,D:\Program\MasterSeeker\MasterSeeker.exe;~WinWait,MasterSeeker1.5.1byDxCK;~WinMinimize,MasterSeeker1.5.1byDxCKahk_classWindowsForms10.Window.8.app.0.218f99c,statusStriWinWait,ahk_classWindowsForms10.Window.8.app.0.218f99cloop,9{WinHide,ahk_classWindowsForms10.Window.8.app.0.218f99cSleep,100}}}}}
04设置此脚本参数(){#NoEnv#Persistent;让脚本持久运行(即直到用户关闭或遇到ExitApp)。#WinActivateForce;~#NoTrayIconSetWorkingDir,%A_ScriptDir%DetectHiddenWindows,OnSetTitleMatchMode,2;~SetBatchLines,;~SetKeyDelay,;~SetWinDelay,;~SetControlDelay,CoordMode,Mouse,ScreenCoordMode,Pixel,ScreenCoordMode,ToolTip,ScreenListLines,OffSendMode,InputSetBatchLines,-1SetStoreCapsLockMode,On}
05设置此脚本用户自定义变量(){global移动硬盘盘符;带冒号:globalProgramProgram=D:\Program}/*
;~loop,333;~{;~WinWait,LoginForm,增值税发票税控开票软,1;~WinWait,LoginFormahk_classWindowsForms10.Window.8.app.0.20f9772_r11_ad1,增值税发票税控开票软,1;~WinActivate,LoginFormahk_classWindowsForms10.Window.8.app.0.20f9772_r11_ad1,增值税发票税控开票软,1;~WinWaitActive,LoginFormahk_classWindowsForms10.Window.8.app.0.20f9772_r11_ad1,增值税发票税控开票软,1;~WinGet,WinID_kp,ID,LoginForm,增值税发票税控开票软;~DllCall("SwitchToThisWindow","UInt",WinID_kp,"UInt",1);~Sleep,100
*/
07运行一些软件应用程序(){IfExist,"D:\Program\PCOff\PCOff.exe"Run,"D:\Program\PCOff\PCOff.exe";~IfExistRun("D:\Program\RunZ\RunZ.exe");快速搜索本地软件程序并启动程序工具,所有程序都安装在文件夹D:\Program中;~SetTimer,MinimizeRunZ,-100IfExistRun("D:\Program\WiseDesktop\WiseDesktop.exe");虚拟桌面IfExistRun("D:\Program\PCOff\PCOff.exe");定时强制关机精灵1.0在17:05下班后定时强制关闭电脑;~IfExistRun("D:\Program\ALMRun\ALMRun.exe");~SetTimer,MinimizeALMRun,-100;~IfExistRun("当前工作文件夹.ahk");~loop,333;~{;~ControlSend,Edit1,{Esc},ALMRun快速启动工具ahk_classwxWindowNR,panel;~}}
IfExistRun(TargetEXE);检查文件是否存在并运行程序{IfExist,%TargetEXE%Run,%TargetEXE%else{ToolTip,未找到文件%TargetEXE%SetTimer,RemoveToolTip,5000}}
RemoveToolTip:SetTimer,RemoveToolTip,OffToolTipreturn;~MinimizeRunZ();~{;~WinWait,RunZ;~loop,3;~{;~WinHide,RunZ;~};~}
MinimizeALMRun(){WinWait,ALMRunloop,3{WinHide,ALMRun}}
终止此脚本执行:ToolTipEnClose(A_ScriptName"(即此脚本)已经退出")Sleep,900ExitAppreturn
ToolTipEnClose(ToolTipText);显示会定时关闭的提示窗口{ToolTip,%ToolTipText%,%A_ScreenWidth/2-150,%A_ScreenHeight/2-150;此处使用SetTimer而不使用SleepSetTimer,关闭提示窗口,3000}
关闭提示窗口:SetTimer,关闭提示窗口,OffToolTipreturn
;######################################
08_激活或隐藏窗口唯一办公包内盘927GB的办公专用文件夹:唯一办公包内盘927GB的盘符:=搜索唯一办公包内盘927GB并设置盘符()if(唯一办公包内盘927GB的盘符<>0){;1、如果程序没有运行则运行程序Process,Exist,TotalCMD.exeif(%ErrorLevel%=0){IfWinNotExist,9.21a,%唯一办公包内盘927GB的盘符%:\{IfExist,D:\Program\TotalCMD\TotalCMD.exeRun,D:\Program\TotalCMD\TotalCMD.exe%唯一办公包内盘927GB的盘符%:\elseMsgBox,找不到文件D:\Program\TotalCMD\TotalCMD.exe}}
;2、如果窗口置顶并且已经隐藏则显示并激活(切换到)指定窗口
WinGet,WinStyle,Style,9.21aif(not(WinStyle&0x10000000)){loop,22{WinShow,9.21aWinMaximize,9.21aWinGet,WinID,ID,9.21aDllCall("SwitchToThisWindow","UInt",WinID,"UInt",1)WinActivate,9.21a#WinActivateForceWinActivate,9.21aWinGetActiveTitle,WinActiveTitle;窗口处于置顶状态,执行适当的动作.IfInString,WinActiveTitle,9.21a{IfWinNotExist,9.21a,%唯一办公包内盘927GB的盘符%:\{IfExist,D:\Program\TotalCMD\TotalCMD.exe{Process,Close,TotalCMD.exeRun,D:\Program\TotalCMD\TotalCMD.exe%唯一办公包内盘927GB的盘符%:\}elseMsgBox,找不到文件D:\Program\TotalCMD\TotalCMD.exe}return}}}
;3、如果窗口未置顶则显示并激活(切换到)指定窗口IfWinNotActive,ahk_exeTotalCMD.exe{loop,22{WinShow,9.21aWinMaximize,9.21aWinGet,WinID,ID,9.21aDllCall("SwitchToThisWindow","UInt",WinID,"UInt",1)WinGetActiveTitle,WinActiveTitle;窗口处于置顶状态,执行适当的动作.IfInString,WinActiveTitle,9.21a{IfWinNotExist,9.21a,%唯一办公包内盘927GB的盘符%:\{IfExist,D:\Program\TotalCMD\TotalCMD.exe{Process,Close,TotalCMD.exeRun,D:\Program\TotalCMD\TotalCMD.exe%唯一办公包内盘927GB的盘符%:\}elseMsgBox,找不到文件D:\Program\TotalCMD\TotalCMD.exe}return}}}
;4、如果窗口已经显示并置顶则隐藏窗口WinMinimize,9.21aWinHide,9.21a}else{ToolTip,请连接唯一办公包内盘927GB,%A_ScreenWidth/2-150,%A_ScreenHeight/2-150SetTimer,关闭提示窗口,3000Sleep,3000};~SetTimer,激活并最大化办公专用文件夹窗口;~WinMaximize,ahk_classCabinetWClass;~WinMaximize,ahk_exeexplorer.exereturn
09_加密压缩备份唯一办公包内盘927GB的办公专用文件夹到D盘:唯一办公包内盘927GB的盘符:=搜索唯一办公包内盘927GB并设置盘符()if(唯一办公包内盘927GB的盘符<>0){FileCreateDir,D:\01-单位办公文档IfExist,c:\Progra~1\WinRAR\WinRAR.exe{Pa:=%decryptstr("QUXy6xNsR+GLUgwFOPlwPAAA","my_secret_key")Run,c:\Progra~1\WinRAR\WinRAR.exeu-hp%Pa%-IBCK-INUL-m5-or-r-tkD:\01-单位办公文档\办公文档备份%A_YYYY%%A_MM%%A_DD%.rar%唯一办公包内盘927GB的盘符%:\01-单位办公文档\*.*ToolTipEnClose("正在加密压缩备份办公文档表格图片。。。")}else{ToolTip,找不到文件c:\Progra~1\WinRAR\WinRAR.exe,%A_ScreenWidth/2-150,%A_ScreenHeight/2-150SetTimer,关闭提示窗口,9000Sleep,9000}}else{ToolTip,请连接唯一办公包内盘927GB,%A_ScreenWidth/2-150,%A_ScreenHeight/2-150SetTimer,关闭提示窗口,3000Sleep,3000};这里用SetTimer是防止主线程阻塞引起下一个快捷键输入的接收和处理SetTimer,关闭WinRAR出错提示窗口,500return
encryptStr(str="",pass=""){if!(enclen:=(StrPut(str,"utf-16")*2))return"Error:NothingtoEncrypt"if!(passlen:=StrPut(pass,"utf-8")-1)return"Error:NoPass"enclen:=Mod(enclen,4)(enclen):(enclen-2)VarSetCapacity(encbin,enclen,0)StrPut(str,&encbin,enclen/2,"utf-16")VarSetCapacity(passbin,passlen+=Mod((4-Mod(passlen,4)),4),0)StrPut(pass,&passbin,StrLen(pass),"utf-8")_encryptbin(&encbin,enclen,&passbin,passlen)return_crypttobase64(&encbin,enclen)}
decryptStr(str="",pass=""){if!((StrPut(str,"utf-16")*2))return"Error:NothingtoDecrypt"if!((passlen:=StrPut(pass,"utf-8")-1))return"Error:NoPass"VarSetCapacity(passbin,passlen+=Mod((4-Mod(passlen,4)),4),0)StrPut(pass,&passbin,StrLen(pass),"utf-8")enclen:=_cryptfrombase64(str,encbin)_decryptbin(&encbin,enclen,&passbin,passlen)returnStrGet(&encbin,"utf-16")}
_MCode(mcode){statice:={1:4,2:1},c:=(A_PtrSize=8)"x64":"x86"if(!RegExMatch(mcode,"^([0-9]+),("c":|.*,"c":)([^,]+)",m))returnif(!DllCall("crypt32\CryptStringToBinary","str",m3,"uint",0,"uint",e[m1],"ptr",0,"uint*",s,"ptr",0,"ptr",0))returnp:=DllCall("GlobalAlloc","uint",0,"ptr",s,"ptr")if(c="x64")DllCall("VirtualProtect","ptr",p,"ptr",s,"uint",0x40,"uint*",op)if(DllCall("crypt32\CryptStringToBinary","str",m3,"uint",0,"uint",e[m1],"ptr",p,"uint*",s,"ptr",0,"ptr",0))returnpDllCall("GlobalFree","ptr",p)}
_encryptbin(bin1pointer,bin1len,bin2pointer,bin2len){staticencrypt:=_MCode("2,x86:U1VWV4t0JBCLTCQUuAAAAAABzoPuBIsWAcKJFinCAdAPr8KD6QR164tsJByLfCQYi3QkEItMJBSLH7gAAAAAixYBwjHaiRYx2inCAdAPr8KDxgSD6QR154PHBIPtBHXQuAAAAABfXl1bww==,x64:U1ZJicpJidNMidZMidlIAc64AAAAAEiD7gSLFgHCiRYpwgHQD6/CSIPpBHXpuAAAAABBixhMidZMidmLFgHCMdqJFjHaKcIB0A+vwkiDxgRIg+kEdeVJg8AESYPpBHXbuAAAAABeW8M=")b:=0loop%bin1len/4{a:=NumGet(bin1pointer+0,bin1len-A_Index*4,"uint")NumPut(a+b,bin1pointer+0,bin1len-A_Index*4,"uint")b:=(a+b)*a}loop%bin2len/4{c:=NumGet(bin2pointer+0,(A_Index-1)*4,"uint")b:=0loop%bin1len/4{a:=NumGet(bin1pointer+0,(A_Index-1)*4,"uint")NumPut((a+b)^c,bin1pointer+0,(A_Index-1)*4,"uint")b:=(a+b)*a}}}
_decryptbin(bin1pointer,bin1len,bin2pointer,bin2len){staticdecrypt:=_MCode("2,x86:U1VWV4tsJByLfCQYAe+D7wSLH7gAAAAAi3QkEItMJBSLFjHaKcKJFgHQD6/Cg8YEg+kEdeuD7QR11LgAAAAAi3QkEItMJBQBzoPuBIsWKcKJFgHQD6/Cg+kEde24AAAAAF9eXVvD,x64:U1ZJicpJidNNAchJg+gEuAAAAABBixhMidZMidmLFjHaKcKJFgHQD6/CSIPGBEiD6QR16UmD6QR140yJ1kyJ2UgBzrgAAAAASIPuBIsWKcKJFgHQD6/CSIPpBHXruAAAAABeW8M=")
loop%bin2len/4{c:=NumGet(bin2pointer+0,bin2len-A_Index*4,"uint")b:=0loop%bin1len/4{a:=NumGet(bin1pointer+0,(A_Index-1)*4,"uint")NumPut(a:=(a^c)-b,bin1pointer+0,(A_Index-1)*4,"uint")b:=(a+b)*a}}b:=0loop%bin1len/4{a:=NumGet(bin1pointer+0,bin1len-A_Index*4,"uint")NumPut(a:=a-b,bin1pointer+0,bin1len-A_Index*4,"uint")b:=(a+b)*a}}
_crypttobase64(binpointer,binlen){s:=0DllCall("crypt32\CryptBinaryToStringW","ptr",binpointer,"uint",binlen,"uint",1,"ptr",0,"uint*",s)VarSetCapacity(out,s*2,0)DllCall("crypt32\CryptBinaryToStringW","ptr",binpointer,"uint",binlen,"uint",1,"ptr",&out,"uint*",s)returnStrGet(&out,"utf-16")}
_cryptfrombase64(string,byrefbin){DllCall("crypt32\CryptStringToBinaryW","wstr",string,"uint",0,"uint",1,"ptr",0,"uint*",s,"ptr",0,"ptr",0)VarSetCapacity(bin,s,0)DllCall("crypt32\CryptStringToBinaryW","wstr",string,"uint",0,"uint",1,"ptr",&bin,"uint*",s,"ptr",0,"ptr",0)returns}
;摘自www.autohotkey.com/board,byWelt
;函数调用
;加密(文本,秘钥);~encrypted_pass:=encryptstr("myspassword","my_secret_key");~Clipboard:=encrypted_pass;解密(文本,秘钥);~MsgBox%decryptstr(encrypted_pass,"my_secret_key")
关闭WinRAR出错提示窗口:loop,360{WinClose,诊断信息,中断操作Sleep,500}SetTimer,关闭WinRAR出错提示窗口,Deletereturn
19_激活或隐藏窗口WPSOffice日记:;1、如果窗口不存在则运行程序IfWinNotExist,日记{IfWinNotExist,C:\Users\Administrator\AppData\Local\Kingsoft\WPSOffice\wpsoffice.exe{;~创建每日新建日记文档FileCreateDir,D:\dFileCreateDir,D:\d\每日新建日记IfNotExist,D:\d\每日新建日记\日记%A_YYYY%%A_MM%%A_DD%.docFileCopy,D:\d\每日新建日记\newdoc.doc,D:\d\每日新建日记\日记%A_YYYY%%A_MM%%A_DD%.doc,0Run,C:\Users\Administrator\AppData\Local\Kingsoft\WPSOffice\wpsoffice.exeD:\d\每日新建日记\日记%A_YYYY%%A_MM%%A_DD%.docWinWaitActive,日记,,5Sleep,500;~NowTimeString=%A_YYYY%年%A_MM%月%A_DD%日%A_Hour%时%A_Min%分Send,%A_YYYY%Sleep,100Send,年Sleep,100Send,%A_MM%Sleep,100Send,月Sleep,100Send,%A_DD%Sleep,100Send,日Sleep,100Send,%A_Hour%Sleep,100Send,时Sleep,100Send,%A_Min%Sleep,100Send,分Sleep,100Send,{Enter}Sleep,100Send,{Enter}Sleep,100Send,{Enter}Sleep,100Send,{Up}Sleep,100Send,{Up}return}elseMsgBox,找不到文件C:\Users\Administrator\AppData\Local\Kingsoft\WPSOffice\wpsoffice.exe}
;2、如果窗口置顶并且已经隐藏则显示并激活(切换到)指定窗口WinGet,WinStyle,Style,日记if(not(WinStyle&0x10000000)){loop,22{WinShow,日记;~WinMaximize,日记WinGet,WinID,ID,日记DllCall("SwitchToThisWindow","UInt",WinID,"UInt",1);~WinActivate,日记;~#WinActivateForce;~WinActivate,日记WinGetActiveTitle,WinActiveTitle;窗口处于置顶状态,执行适当的动作.IfInString,WinActiveTitle,日记{;~MsgBox,%A_Index%1return}}}
;3、如果窗口未置顶则显示并激活(切换到)指定窗口IfWinNotActive,日记{loop,22{WinShow,日记WinMaximize,日记WinGet,WinID,ID,日记DllCall("SwitchToThisWindow","UInt",WinID,"UInt",1)WinGetActiveTitle,WinActiveTitle;窗口处于置顶状态,执行适当的动作.IfInString,WinActiveTitle,日记{;~MsgBox,%A_Index%2return}}}
;4、如果窗口已经显示并置顶则隐藏窗口WinMinimize,日记WinHide,日记return
根据窗口标题激活或者隐藏窗口(VarExeFileName:="EmEditor",VarWinTitle:="EmEditor"){
;1、如果程序没有运行则运行程序Process,Exist,%VarExeFileName%.exeif(%ErrorLevel%=0){IfWinNotExist,%VarWinTitle%{IfExist,D:\Program\%VarExeFileName%\%VarExeFileName%.exeRun,D:\Program\%VarExeFileName%\%VarExeFileName%.exeelseMsgBox,找不到文件D:\Program\%VarExeFileName%\%VarExeFileName%.exe}}
WinGet,WinStyle,Style,%VarWinTitle%if(not(WinStyle&0x10000000)){loop,22{WinShow,%VarWinTitle%WinMaximize,%VarWinTitle%WinGet,WinID,ID,%VarWinTitle%DllCall("SwitchToThisWindow","UInt",WinID,"UInt",1)WinActivate,%VarWinTitle%#WinActivateForceWinActivate,%VarWinTitle%WinGetActiveTitle,WinActiveTitle;窗口处于置顶状态,执行适当的动作.IfInString,WinActiveTitle,%VarWinTitle%{;~MsgBox,%A_Index%1return}}}
;3、如果窗口未置顶则显示并激活(切换到)指定窗口IfWinNotActive,ahk_exe%VarExeFileName%.exe{loop,22{WinShow,%VarWinTitle%WinMaximize,%VarWinTitle%WinGet,WinID,ID,%VarWinTitle%DllCall("SwitchToThisWindow","UInt",WinID,"UInt",1)WinGetActiveTitle,WinActiveTitle;窗口处于置顶状态,执行适当的动作.IfInString,WinActiveTitle,%VarWinTitle%{;~MsgBox,%A_Index%2return}}}
;4、如果窗口已经显示并置顶则隐藏窗口WinMinimize,%VarWinTitle%WinHide,%VarWinTitle%}
10_激活或隐藏窗口EmEditor:;1、如果程序没有运行则运行程序Process,Exist,EmEditor.exeif(%ErrorLevel%=0){IfExist,D:\Program\EmEditor\EmEditor.exe{Run,D:\Program\EmEditor\EmEditor.exe}}
;2、如果窗口没有置顶则显示并激活(切换到)指定窗口IfWinNotActive,ahk_classEmEditorMainFrame3{WinShow,ahk_classEmEditorMainFrame3WinActivate,ahk_classEmEditorMainFrame3return}
;3、如果窗口已经显示并置顶则隐藏窗口WinHide,ahk_classEmEditorMainFrame3return
11_激活或隐藏窗口TotalCommander:根据窗口标题激活或者隐藏窗口("TotalCMD","9.21a")return
12_激活或隐藏窗口MasterSeeker:;-----1、运行MasterSeeker程序Process,Exist,MasterSeeker.exeif(%ErrorLevel%=0){IfWinNotExist,ahk_classWindowsForms10.Window.8.app.0.218f99c{IfWinNotExist,MasterSeeker1.5.1byDxCKahk_classWindowsForms10.Window.8.app.0.218f99c,statusStri{IfExist,D:\Program\MasterSeeker\MasterSeeker.exeRun,D:\Program\MasterSeeker\MasterSeeker.exe}}}
;-----2、显示或隐藏MasterSeeker窗口IfWinNotActive,ahk_classWindowsForms10.Window.8.app.0.218f99c{loop,999999{;-----显示窗口WinShow,ahk_classWindowsForms10.Window.8.app.0.218f99c
;-----激活窗口WinGet,WinID,ID,ahk_classWindowsForms10.Window.8.app.0.218f99cDllCall("SwitchToThisWindow","UInt",WinID,"UInt",1)#WinActivateForceWinActivate,ahk_classWindowsForms10.Window.8.app.0.218f99c
;-----检测窗口激活(切换到)是否成功WinGet,WinActiveID,ID,AWinGetClass,WinActiveClass,ahk_id%WinActiveID%;窗口处于置顶状态,执行适当的动作.IfInString,WinActiveClass,WindowsForms10.Window.8.app.0.218f99c{Sleep,10IfWinActive,MasterSeeker1.5.1byDxCKahk_classWindowsForms10.Window.8.app.0.218f99c,statusStri{;~MsgBox,%A_Index%;-----全选激活MasterSeeker窗口的搜索编辑框:loop,3{ControlFocus,Filename,ahk_classWindowsForms10.Window.8.app.0.218f99cControlSend,Filename,{End},ahk_classWindowsForms10.Window.8.app.0.218f99c}Sleep,10ControlSend,Filename,{ShiftDown}{Home}{ShiftUp},ahk_classWindowsForms10.Window.8.app.0.218f99cSleep,10}break}}
;-----最大化窗口;~WinMaximize,ahk_classWindowsForms10.Window.8.app.0.218f99c
}else{;4、如果窗口已经显示并置顶则隐藏窗口WinMinimize,ahk_classWindowsForms10.Window.8.app.0.218f99cWinHide,ahk_classWindowsForms10.Window.8.app.0.218f99c}return
根据窗口类激活或者隐藏窗口(VarExeFileName:="EmEditor",VarClassName:="EmEditor"){;1、如果程序没有运行则运行程序Process,Exist,%VarExeFileName%.exeif(%ErrorLevel%=0){IfWinNotExist,ahk_class%VarClassName%{;~MsgBox,%programDir%;~IfExist,%ProgramDir%\%VarExeFileName%\%VarExeFileName%.exe;我的所有绿色免安装程序都分类保存在文件夹D:\pr中;一个软件对应于一个以窗口标题命名的专有子文件夹Run,D:\Program\%VarExeFileName%\%VarExeFileName%.exe}}
WinGet,WinStyle,Style,ahk_class%VarClassName%if(not(WinStyle&0x10000000)){loop,99{WinShow,ahk_class%VarClassName%WinMaximize,ahk_class%VarClassName%WinGet,WinID,ID,ahk_class%VarClassName%DllCall("SwitchToThisWindow","UInt",WinID,"UInt",1)#WinActivateForceWinActivate,ahk_class%VarClassName%WinGet,WinActiveID,ID,AWinGetClass,WinActiveClass,ahk_id%WinActiveID%;窗口处于置顶状态,执行适当的动作.IfInString,WinActiveClass,%VarClassName%{;~msgbox,%A_Index%1return}}}
;3、如果窗口未置顶则显示并激活(切换到)指定窗口IfWinNotActive,ahk_exe%VarExeFileName%.exe{loop,99{WinShow,ahk_class%VarClassName%WinMaximize,ahk_class%VarClassName%WinGet,WinID,ID,ahk_class%VarClassName%DllCall("SwitchToThisWindow","UInt",WinID,"UInt",1)WinActivate,ahk_class%VarClassName%#WinActivateForceWinActivate,ahk_class%VarClassName%WinGet,WinActiveID,ID,AWinGetClass,WinActiveClass,ahk_id%WinActiveID%;窗口处于置顶状态,执行适当的动作.IfInString,WinActiveClass,%VarClassName%{;~msgbox,%A_Index%2return}}};4、如果窗口已经显示并置顶则隐藏窗口WinMinimize,ahk_class%VarClassName%WinHide,ahk_class%VarClassName%}
13_激活或隐藏窗口Everything:;当窗口标题测试不通过的话只好用窗口类了Process,Close,Everything.exe根据窗口类激活或者隐藏窗口("Everything","EVERYTHING")return
14_激活或隐藏窗口SogouExplorer:根据窗口类激活或者隐藏窗口("SogouExplorer","SE_SogouExplorerFrame")return
15_激活或隐藏窗口计算器Calc:Run,calcreturn
16_用SciTE4AutoHotkey编辑此脚本:;唯一办公包内盘927GB的盘符:=搜索唯一办公包内盘927GB并设置盘符();if(唯一办公包内盘927GB的盘符<>0);{;Run,D:\Program\AutoHotkey\SciTE\SciTE.exe%A_ScriptName%;}
IfExist,D:\Program\AutoHotkey\SciTE\SciTE.exeRun,D:\Program\AutoHotkey\SciTE\SciTE.exe%A_ScriptName%else{ToolTip,找不到文件D:\Program\AutoHotkey\SciTE\SciTE.exe,%A_ScreenWidth/2-150,%A_ScreenHeight/2-150SetTimer,关闭提示窗口,3000Sleep,3000}return
17_激活或隐藏窗口AutoHotkey中文CHM帮助文件:Run,D:\Program\AutoHotkey\AutoHotkey.CHMreturn
18_重启_重新装载运行_此脚本:Reloadreturn
搜索唯一办公包内盘927GB并设置盘符(){找到U盘:=falseDriveGet,盘符清单,Listloop,Parse,盘符清单{DriveGet,卷标,Label,%A_LoopField%:IfInString,卷标,唯一办公包内盘927GB{找到U盘:=truereturn,%A_LoopField%}}if(not找到U盘){return,0}}
/*;---在每天17时05分(下班后)关闭电脑;~09定时关闭电脑:;~ifA_Hour=17;~{;~ifA_Min=05;~{;~Run,Shutdown/f/r/t30;~};~};~return*/
;###此AHK脚本结束#####################################
/////////////////////////////////////////////////////////////////////////
016、为了避免用“一键GHOST硬盘版”恢复微软公司生产的Windows7专业版操作系统请安装、设置并测试ShadowDefender影子卫士