AHK管理器 AHKManager.ahk 2019年12月15日

AHK管理器  AHKManager.ahk  2019年12月15日

; AHKManager.ahk
; AHK管理器
; 河许人:一个网友仿照我的承影做的AHK源码管理器
;~ http://www.autoahk.com/archives/11509; 徐晓亮:好像这个脚本挺好用的样子,决定今后一直使用,一直改进,一直优化此脚本
; ===== 此AutoHotkey脚本源代码的备份网址有3个,网址如下所示 =====
;~ http://autoHotkey.bokee.com/507504381.html
;~ https://www.cnblogs.com/delphixx/p/12042093.html
;~ https://gitee.com/weiyunwps618/codes/gt5baqw0msfu61lihzy9v98 
;源码
////////////////////////////////////////////////////////////////////////////////////////////////

; AHKManager.ahk

 

; AHK管理器

; 河许人:一个网友仿照我的承影做的AHK源码管理器

;~ http://www.autoahk.com/archives/11509

 

; 徐晓亮:好像这个脚本挺好用的样子,决定今后一直使用,一直改进,一直优化此脚本

; ===== 此AutoHotkey脚本源代码的备份网址有3个,网址如下所示 =====

;~ http://autoHotkey.bokee.com/507504381.html

;~ https://www.cnblogs.com/delphixx/p/12042093.html

;~ https://gitee.com/weiyunwps618/codes/gt5baqw0msfu61lihzy9v98

 

;源码

 

 

 

 

 

;by Sixtyone At 2016.4.10

 

 

 

;更新说明

 

 

 

/*

 

 

 

2016.4.24:

 

 

 

1.运行#脚本后,gui自动隐藏;

 

 

 

2.启动脚本目录后,gui自动隐藏。

 

 

 

2016.4.17:

 

 

 

1. 增加过滤中使用%A_ScriptDir%变量。

 

 

 

2016.4.14:

 

 

 

1.修复2016.4.13版本中的1个bug;

 

 

 

2.添加文件(夹)过滤功能:添加到过滤中的文件(夹),将不会被读取到AHK管理器中;

 

 

 

3.修复之前版本某些脚本不能关闭问题;

 

 

 

4.修复脚本不能正确读取ini配置问题。

 

 

 

2016.4.13:

 

 

 

1.更新添加“Scripts文件夹内的第一层子文件夹脚本”,但所有脚本不能同名。

 

 

 

2016.4.11:

 

 

 

1.脚本库中启动条目后,焦点自带设置为上一条,正在运行库同;

 

 

 

2.更新脚本库双击运行脚本,正在运行库双击关闭脚本;

 

 

 

3.脚本库增加右键菜单:"编辑","运行"--正在运行库增加右键菜单:"编辑","重载","关闭"。

 

 

 

*/

 

 

 

#SingleInstance Force

 

 

 

#NoEnv

 

 

 

;#Warn

 

 

 

SetWorkingDir %A_ScriptDir%

 

 

 

Process, Priority,, High

 

 

 

DetectHiddenWindows,On

 

 

 

Menu, Tray, NoStandard                  ;删除自带托盘菜单

 

 

 

Menu, tray, add, 管理,ShowGui  ;  显示Gui

 

 

 

Menu, tray, add  ; 创建分隔线.

 

 

 

Menu, tray, add ,过滤,Menu_Tray_过滤        ;  过滤

 

 

 

Menu, tray, add ,脚本目录,Menu_Tray_OpenDir          ;  脚本目录

 

 

 

Menu, tray, add ,重启管理器,Menu_Tray_Reload          ; 重启

 

 

 

Menu, tray, Add

 

 

 

Menu, tray, Add,帮助,Help ;Help

 

 

 

Menu, tray, Add,关于,About ;关于

 

 

 

Menu, tray, Add

 

 

 

Menu, tray, Add, 退出, ExitSub                  ; 创建    退出

 

 

 

Menu, Tray, Default, 管理  ;;默认  菜单:配置

 

 

 

Menu, Tray, Icon, Shell32.dll, 258

 

 

 

;IntelligentScript:

 

 

 

Gui,Destroy

 

 

 

Gui Add, ListView, x8 y30 w200 h400 AltSubmit vScriptLibrary g运行 , 脚本名称

 

 

 

Gui Add, Text, x10 y3 w120 h23 +0x200, 脚本库

 

 

 

Gui Add, ListView, x233 y30 w200 h400 AltSubmit vScriptRun g运行2, 脚本名称

 

 

 

Gui Add, Text, x234 y3 w120 h23 +0x200, 已运行脚本

 

 

 

Gui Add, Button, x440 y30 w60 h42 gtsk_open, 启动脚本

 

 

 

Gui Add, Button, x440 y100 w60 h42 gtsk_restart, 重载脚本

 

 

 

Gui Add, Button, x440 y170 w60 h42 gtsk_close, 关闭脚本

 

 

 

Gui Add, Button, x440 y240 w60 h42 gMenu_Tray_OpenDir, 脚本目录

 

 

 

Gui Add, Button, x440 y310 w60 h42 gMenu_Tray_Reload, 重启管理器

 

 

 

Gui Add, Button, x440 y380 w60 h42 gExitSub, 退出

 

 

 

;Gui Show,, AHK管理器

 

 

 

Gui Default

 

 

 

Gui,ListView,ScriptLibrary

 

 

 

scriptCount = 0

 

 

 

IniRead,Golv,过滤.ini,过滤

 

 

 

OpenList := Array()

 

 

 

UnOpenList := Array()

 

FileCreateDir,%A_ScriptDir%scripts

 

loop, %A_ScriptDir%scripts*.ahk,,1

 

 

 

{

 

 

 

      _Golv=0

 

 

 

      loop,Parse,Golv,`n,`r                  ;增加过滤判断

 

 

 

      {

 

 

 

           StringReplace,_GolvPath,A_LoopField,`%A_ScriptDir`%,%A_ScriptDir%

 

 

 

           IfInString,A_LoopFileLongPath ,%_GolvPath%

 

 

 

           {

 

 

 

                 _Golv=1

 

 

 

                 break

 

 

 

           }

 

 

 

      }

 

 

 

      if  _Golv=1

 

 

 

           continue

 

 

 

      if !(A_LoopFileLongPath~="i).+?scripts[^]*?[^]+.ahk")                          ;增加一层子文件读取

 

 

 

           continue

 

 

 

      StringReplace, MenuName, A_LoopFileName, .ahk

 

 

 

      scriptCount += 1

 

 

 

      %MenuName%_Path :=A_LoopFileLongPath

 

 

 

      %MenuName%_Dir :=A_LoopFileDir

 

 

 

      scriptsName%scriptCount% := A_LoopFileName

 

 

 

      ;scriptsOpened%scriptCount% = 0

 

 

 

      UnOpenList.Insert(MenuName)

 

 

 

}

 

 

 

InsertionSort(UnOpenList)

 

 

 

for Index, MenuName in UnOpenList

 

 

 

{

 

 

 

      LV_Add("",MenuName)

 

 

 

}

 

 

 

LV_ModifyCol()

 

 

 

gosub tsk_openAll

 

 

 

;Gui,Show

 

 

 

return

 

 

 

运行:

 

 

 

if A_GuiEvent = DoubleClick

 

 

 

{

 

 

 

      goto,tsk_open

 

 

 

}

 

 

 

return

 

 

 

运行2:

 

 

 

      if A_GuiEvent = DoubleClick

 

 

 

           goto,tsk_close

 

 

 

return

 

 

 

GuiContextMenu:  ; 运行此标签来响应右键点击或按下 Appskey.

 

 

 

      if A_GuiControl = ScriptLibrary  ; 这个检查是可选的. 让它只为 ListView 中的点击显示菜单.

 

 

 

      {

 

 

 

           Gui,Default

 

 

 

           Gui,ListView,ScriptLibrary

 

 

 

           RowNumber = 0

 

 

 

           loop,%scriptCount%

 

 

 

           {

 

 

 

                 RowNumber := LV_GetNext(RowNumber)

 

 

 

                 if not RowNumber

 

 

 

                      return

 

 

 

                 break

 

 

 

           }

 

 

 

           Menu,PopC,Add,编辑,P_edit

 

 

 

           Menu,PopC,Add,运行,tsk_open

 

 

 

           Menu,PopC,Show

 

 

 

           return

 

 

 

      }

 

 

 

      if  A_GuiControl = ScriptRun

 

 

 

      {

 

 

 

           Gui,Default

 

 

 

           Gui,ListView,ScriptRun

 

 

 

           RowNumber = 0

 

 

 

           loop,%scriptCount%

 

 

 

           {

 

 

 

                 RowNumber := LV_GetNext(RowNumber)

 

 

 

                 if not RowNumber

 

 

 

                      return

 

 

 

                 break

 

 

 

           }

 

 

 

           Menu,PopC2,Add,编辑,P_edit

 

 

 

           Menu,PopC2,Add,重载,tsk_restart

 

 

 

           Menu,PopC2,Add,关闭,tsk_close

 

 

 

           Menu,PopC2,Show

 

 

 

           return

 

 

 

      }

 

 

 

return

 

 

 

P_edit:

 

 

 

      LV_GetText(thisScript, RowNumber)

 

 

 

      P_editpath :=%thisScript%_path

 

 

 

      Run, D:ProgramAutoHotkeySciTESciTE.exe  "%P_editpath%"

 

 

 

return

 

 

 

tsk_open:

 

 

 

      Gui,Default

 

 

 

      Gui,ListView,ScriptLibrary

 

 

 

      RowNumber = 0

 

 

 

      loop,%scriptCount%

 

 

 

      {

 

 

 

           RowNumber := LV_GetNext(RowNumber)

 

 

 

           if not RowNumber

 

 

 

                 return

 

 

 

           LV_GetText(thisScript, RowNumber)

 

 

 

           Run,% %thisScript%_Path,% %thisScript%_Dir,,%thisScript%

 

 

 

           IfInString, thisScript, #

 

 

 

           {

 

 

 

                 Gui, Hide

 

 

 

                 return

 

 

 

           }

 

 

 

           ;scriptsOpened%A_Index% := 1

 

 

 

           break

 

 

 

      }

 

 

 

      Gui,ListView,ScriptRun

 

 

 

      LV_Add("",ThisScript)

 

 

 

      LV_ModifyCol()

 

 

 

      Gui,ListView,ScriptLibrary

 

 

 

      loop, %scriptCount%

 

 

 

      {

 

 

 

           LV_GetText(outputname,A_Index,1)

 

 

 

           if (outputname=ThisScript)

 

 

 

           {

 

 

 

                 LV_Delete(A_Index)

 

 

 

                 if A_Index<>1

 

 

 

                 {

 

 

 

                      LV_Modify(A_Index-1, "Select")

 

 

 

                 }

 

 

 

                 else

 

 

 

                 {

 

 

 

                      LV_Modify(1, "Select")

 

 

 

                 }

 

 

 

                 break

 

 

 

           }

 

 

 

      }

 

 

 

      LV_ModifyCol()

 

 

 

return

 

 

 

tsk_close:

 

 

 

      Gui,Default

 

 

 

      Gui,ListView,ScriptRun

 

 

 

      RowNumber = 0

 

 

 

      loop,%scriptCount%

 

 

 

      {

 

 

 

           RowNumber := LV_GetNext(RowNumber)

 

 

 

           if not RowNumber

 

 

 

                 return

 

 

 

           LV_GetText(thisScript, RowNumber)

 

 

 

           ID:=%thisScript%

 

 

 

           WinClose, ahk_pid %ID%

 

 

 

           IfWinExist,ahk_pid %ID%

 

 

 

                 Process,Close,%ID%

 

 

 

           ;scriptsOpened%A_Index% := 0

 

 

 

           break

 

 

 

      }

 

 

 

      Gui,ListView,ScriptLibrary

 

 

 

      LV_Add("",ThisScript)

 

 

 

      LV_ModifyCol()

 

 

 

      Gui,ListView,ScriptRun

 

 

 

      loop, %scriptCount%

 

 

 

      {

 

 

 

           LV_GetText(outputname,A_Index,1)

 

 

 

           if (outputname=thisScript)

 

 

 

           {

 

 

 

                 LV_Delete(A_Index)

 

 

 

                 if A_Index<>1

 

 

 

                 {

 

 

 

                      LV_Modify(A_Index-1, "Select")

 

 

 

                 }

 

 

 

                 else

 

 

 

                 {

 

 

 

                      LV_Modify(1, "Select")

 

 

 

                 }

 

 

 

                 break

 

 

 

           }

 

 

 

      }

 

 

 

      LV_ModifyCol()

 

 

 

return

 

 

 

tsk_restart:

 

 

 

      Gui,Default

 

 

 

      Gui,ListView,ScriptRun

 

 

 

      RowNumber = 0

 

 

 

      loop,%scriptCount%

 

 

 

      {

 

 

 

           RowNumber := LV_GetNext(RowNumber)

 

 

 

           if not RowNumber

 

 

 

                 return

 

 

 

           LV_GetText(thisScript, RowNumber)

 

 

 

           ID:=%thisScript%

 

 

 

           WinClose, ahk_pid %ID%

 

 

 

           IfWinExist,ahk_pid %ID%

 

 

 

                 Process,Close,%ID%

 

 

 

           Run,% %thisScript%_Path,% %thisScript%_Dir,,%thisScript%

 

 

 

           break

 

 

 

      }

 

 

 

return

 

 

 

tsk_openAll:

 

 

 

      loop, %scriptCount%

 

 

 

      {

 

 

 

           thisScript := scriptsName%A_Index%

 

 

 

           StringReplace, thisScript, thisScript, .ahk

 

 

 

           ;if scriptsOpened%A_Index% = 0

 

 

 

           ;{

 

 

 

           IfInString, thisScript, _          ;IfInString,%thisScript%_Path,%A_ScriptDir%Scripts_    不自动启动_文件夹内的脚本

 

 

 

           {

 

 

 

                 continue

 

 

 

           }

 

 

 

           IfInString, thisScript, #

 

 

 

           {

 

 

 

                 continue

 

 

 

           }

 

 

 

           Run, % %thisScript%_Path,% %thisScript%_Dir,,%thisScript%

 

 

 

           ;scriptsOpened%A_Index% = 1

 

 

 

           Gui,Default

 

 

 

           Gui,ListView,ScriptRun

 

 

 

           LV_Add("",thisScript)

 

 

 

           LV_ModifyCol()

 

 

 

           Gui,ListView,ScriptLibrary

 

 

 

           loop, %scriptCount%

 

 

 

           {

 

 

 

                 LV_GetText(outputname,A_Index,1)

 

 

 

                 if (outputname=thisScript)

 

 

 

                 {

 

 

 

                      LV_Delete(A_Index)

 

 

 

                      break

 

 

 

                 }

 

 

 

           }

 

 

 

           LV_ModifyCol()

 

 

 

           ;}

 

 

 

      }

 

 

 

      ;Gui,Show

 

 

 

return

 

 

 

Menu_Tray_过滤:

 

 

 

      Run, Notepad.exe  过滤.ini

 

 

 

return

 

 

 

Menu_Tray_OpenDir:

 

      FileCreateDir,%A_ScriptDir%scripts

 

      Run, %A_ScriptDir%scripts

 

 

 

      Gui,Hide

 

 

 

return

 

 

 

Menu_Tray_Reload:

 

 

 

      Gui,Hide

 

 

 

      Gui,Default

 

 

 

      Gui,ListView,ScriptRun

 

 

 

      loop % LV_GetCount()

 

 

 

      {

 

 

 

           LV_GetText(thisScript, A_Index)

 

 

 

           ID:=%thisScript%

 

 

 

           WinClose, ahk_pid %ID%

 

 

 

           IfWinExist,ahk_pid %ID%

 

 

 

                 Process,Close,%ID%

 

 

 

      }

 

 

 

      Reload

 

 

 

return

 

 

 

GuiEscape:

 

 

 

GuiClose:

 

 

 

      Gui, Hide

 

 

 

return

 

 

 

ExitSub:

 

 

 

      MsgBox,260,是否退出?,退出脚本,将退出所有经过AHK管理器启动的脚本,你是否确认退出?

 

 

 

      IfMsgBox No

 

 

 

           return

 

 

 

      Gui,Hide

 

 

 

      Gui,Default

 

 

 

      Gui,ListView,ScriptRun

 

 

 

      loop % LV_GetCount()

 

 

 

      {

 

 

 

           LV_GetText(thisScript, A_Index)

 

 

 

           ID:=%thisScript%

 

 

 

           WinClose, ahk_pid %ID%

 

 

 

           IfWinExist,ahk_pid %ID%

 

 

 

                 Process,Close,%ID%

 

 

 

      }

 

 

 

      Gui,Destroy

 

 

 

      ExitApp

 

 

 

return

 

 

 

InsertionSort(ByRef array)

 

 

 

{

 

 

 

      target := Array()

 

 

 

      count := 0

 

 

 

      for Index, Files in array

 

 

 

      {

 

 

 

           files%Index% := Files

 

 

 

           count += 1

 

 

 

      }

 

 

 

      j := 2

 

 

 

      while (j <= count)

 

 

 

      {

 

 

 

           key := files%j%

 

 

 

           i := j-1

 

 

 

           while (i >= 0 && key < files%i%)

 

 

 

           {

 

 

 

                 k := i+1

 

 

 

                 files%k% := files%i%

 

 

 

                 i -= 1

 

 

 

           }

 

 

 

           k := i+1

 

 

 

           files%k% := key

 

 

 

           j += 1

 

 

 

      }

 

 

 

      loop, %count%

 

 

 

      {

 

 

 

           target.Insert(files%A_Index%)

 

 

 

      }

 

 

 

      array := target

 

 

 

}

 

 

 

About:

 

 

 

      MsgBox,AHK管理器`n版本号:2016.4.24`nCopyRight?2016 Sixtyone.  All Rights Reserved.`n`n关于作者:`n`tName:Sixtyone`n`tQQ:576642385

 

 

 

return

 

 

 

Help:

 

 

 

      MsgBox,将AHK脚本放在脚本目录下进行管理:`n1.以_开头的脚本不会自动加载`n2.以#开头的脚本为临时脚本即运行完就退出`n3.脚本名字不能有空格及除_、#以为的符号`n4.脚本不能为快捷方式

 

 

 

return

 

 

 

!F1::

 

      ;~ isShow:=!isShow

 

      ;~ if(isShow)

 

      ;~ {

 

ShowGui:

 

 

 

      Gui,Show,,AHK管理器

 

      ;~ }

 

      ;~ else

 

      ;~ Gui,Hide

 

return

 

 

 

;~ 作者:sixtyone

 

;~ 链接:https://www.jianshu.com/p/d88f47fa431d

 

;~ 來源:简书

 

;~ 简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

 

////////////////////////////////////////////////////////////////////////////////////////////////

 

;~ 打开启动文件夹.ahk

Run,shell:startup

ExitApp

 

////////////////////////////////////////////////////////////////////////////////////////////////

;~ 小部分AutoHotkey脚本源代码测试模板样板.ahk

 

;~ 请把一行或几行少量代码放到此文件中实际测试一下,

;~ 看看测试结果如何,等到能够实现代码功能时再复制到自己的脚本代码文件中

;~ 不断测试,不断改进,不断提炼,不断优化,

;~ 把代码封装到标签子程序或函数功能过程或者类(对象) 名字之中,从而便于今后重复使用类似代码

;~ 请在SciTE4AutoHotkey脚本编辑器中按快捷键运行此脚本并测试代码片段

;~ 选中源代码块后按快捷键数字小键盘的减号 或者 Ctrl+Q 注释代码块

 

TestAutoHotkeyCode测试代码片段_第1个函数()

{

      WinActivate,SciTE4AutoHotkey ahk_class SciTEWindow ahk_exe SciTE.exe

      WinWaitActive,SciTE4AutoHotkey ahk_class SciTEWindow ahk_exe SciTE.exe

      Send,{AltDown}fs{AltUp}

      ; ========== 按F5热键后运行的测试代码从下一行开始 ==========

 

      SetTimer,RunExeFile运行程序_03,-100

      SetTimer,SwitchToThisWindow激活窗口_04,100

      SetTimer,ControlSend发送模拟键击到控件_06,100

      SetTimer,ControlClick发送鼠标按钮或鼠标滚轮事件到控件_07,100

      SetTimer,SetTimerDelete禁用并删除所有Timer自动重复周期运行子程序_08,100

 

      ;~ IfExist,C:Program Files (x86)TencentQQBinQQ.exe

      ;~ Run,C:Program Files (x86)TencentQQBinQQ.exe

      ;~ WinWait, QQ ahk_class TXGuiFoundation ahk_exe QQ.exe, ,9

      ;~ WinActivate, QQ ahk_class TXGuiFoundation ahk_exe QQ.exe, ,9

      ;~ IfWinNotActive,QQ ahk_class TXGuiFoundation ahk_exe QQ.exe

      ;~ goto,QQend

 

 

 

      ; ========== 按F5热键后运行的测试代码到上一行结束 ==========

}

 

ConfigThisScript设置此脚本的参数_第2个函数() ;通过函数名直接调用函数,就像函数体的代码就在此处

TestAutoHotkeyCode测试代码片段_第1个函数()

Hotkey,F5,使用新的脚本实例替换当前正在运行的实例_第3个函数 ;创建并启用热键,当用户输入热键时立即执行热键所指向的函数。

return ;由于此脚本设置了热键所以脚本将会等待快捷键按下,此时脚本不会退出

 

使用新的脚本实例替换当前正在运行的实例_第3个函数()

{

      Reload

}

 

ConfigThisScript设置此脚本的参数_第2个函数()

{

#SingleInstance,force ;当此脚本已经运行时自动替换旧实例再次运行。

#Persistent ;让脚本持久运行(即直到用户关闭或遇到 ExitApp)。

#NoEnv ;不检查空变量是否为环境变量(建议所有新脚本使用)。

#WinActivateForce ;用强制的方法激活窗口。阻止任务栏按钮的闪烁.

      ;~ #NoTrayIcon ;不显示托盘图标。

      ;~ #Warn ;应用指定的 WarningMode 支持的所有警告类型.

      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,

}

 

; ========== 函数定义代码块段落代码从下一行开始,接下来集中定义各类函数,函数名以两位数字序号后缀结尾 ==========

 

RunExeFile运行程序_03()

{

      IfWinNotExist,记事本 ahk_class Notepad

           Run,notepad

}

 

SwitchToThisWindow激活窗口_04()

{

      IfWinNotActive,记事本

      {

           ;~ WinActivate [, WinTitle, WinText, ExcludeTitle, ExcludeText]

           WinGet, WinID, ID,记事本

           DllCall("SwitchToThisWindow", "UInt", WinID, "UInt", 1)

           ;~ WinGetActiveTitle,WinActiveTitlekp

           ;~ IfInString,WinActiveTitlekp,窗口标题

      }

}

 

ControlFocus设置焦点到指定控件_05()

{

      ;~ ControlFocus [, Control, WinTitle, WinText, ExcludeTitle, ExcludeText]

}

 

ControlSend发送模拟键击到控件_06()

{

      IfWinActive,记事本

      {

           IfWinNotExist,打开 ahk_class #32770, 地址

           {

                 ControlSend, Edit1,{CtrlDown}o{CtrlUp},记事本 ahk_class Notepad

           }

      }

}

 

ControlClick发送鼠标按钮或鼠标滚轮事件到控件_07()

{

      ;~ IfWinActive,记事本

      ;~ ControlClick [, Control-or-Pos, WinTitle, WinText, WhichButton, ClickCount, Options, ExcludeTitle, ExcludeText]

}

 

SetTimerDelete禁用并删除所有Timer自动重复周期运行子程序_08()

{

      IfWinExist,记事本 ahk_class Notepad

      {

           IfWinActive,打开 ahk_class #32770, 地址

           {

                 SetTimer,RunExeFile运行程序_03,Delete

                 SetTimer,SwitchToThisWindow激活窗口_04,Delete

                 ;~ 不要使用某个功能函数时只需注释掉调用代码即可,无需注释函数体定义部分的代码

                 ;~ SetTimer,ControlFocus设置焦点到指定控件_05,Delete

                 SetTimer,ControlSend发送模拟键击到控件_06,Delete

                 SetTimer,ControlClick发送鼠标按钮或鼠标滚轮事件到控件_07,Delete

                 SetTimer,SetTimerDelete禁用并删除所有Timer自动重复周期运行子程序_08,Delete

 

                 ToolTip,并发运行脚本测试完毕

                 SetTimer, RemoveToolTip定时关闭置顶提示窗口_09, 5000

           }

      }

}

 

; 让ToolTip提示在一段时间后消失

RemoveToolTip定时关闭置顶提示窗口_09:

      SetTimer, RemoveToolTip定时关闭置顶提示窗口_09, Off

      ToolTip

return

 

无条件终止此脚本()

{

      ExitApp

}

 

; ===== 此脚本到此行结束 =====

 

 

 

 

 

 

 

 

 

 

 

;~ 【管理员】徐晓亮(595076941)

;~ 有了此QQ群和代码测试模板和百度这3个法宝就可以玩AutoHotkey脚本源代码

;~ 【管理员】徐晓亮(595076941)

;~ 就可以轻轻松松的玩AHK源代码了

;~ 【管理员】徐晓亮(595076941)

;~ 开始接受ahk的SciTE了,先搜集大量小工具(类似AHKInfo 1.3.5)或者用Delphi或Visual Studio 自制一些有特殊要求的小工具软件并手动集成到SciTE4AutoHotkey的工具栏中(最好有2行工具栏用于存放常用自制工具,这样在写源代码时比较方便快捷),最后还是要注意资源搜集,资源备份,资源全文检索,全网源代码搜索

 

;~ 小部分AutoHotkey源代码片段测试模板2019年9月22日.ahk

 

;~ 此脚本用于测试执行一行或多行AHK脚本源代码的效果

;~ 此脚本最后修改于2019年9月22日20时03分

;~ 把此源代码复制到SciTE4AutoHotkey文本编辑器中

;~ 在SciTE4AutoHotkey文本编辑器窗口中按快捷键F5运行脚本

;~ 在SciTE4AutoHotkey文本编辑器窗口中按快捷键Ctrl+Break终止此脚本运行

;~ 按快捷键F9运行需要测试的代码

;~ 选中源代码块后按快捷键 Ctrl+Q 注释代码块

;~ 请使用 "星雨朝霞" 制作的 "AHKInfo 1.3.5.ahk" 窗口信息抓取工具来获取控件操作源代码和控件的ClassNN类别名称

 

; 源代码作用:并发运行AHK脚本演示,脚本测试模板 打印日期:2019年10月10日 源代码作者:徐晓亮(aahk6188) 第X页【共Y页】

 

 

;~ Sleep,500

;~ WinClose, 桌面控制 ahk_class SDL_app ahk_exe SunloginClient.exe,

;~ Sleep,500

;~ WinKill, 桌面控制 ahk_class SDL_app ahk_exe SunloginClient.exe,

;等待指定标题窗口出现

;~ WinKill, 向日葵远程控制 ahk_class SDL_app ahk_exe SunloginClient.exe,

 

;~ WinKill, 桌面控制 ahk_class SDL_app ahk_exe SunloginClient.exe,

;~ Sleep,500

;~ Process,Close,SunloginClient.exe

 

;~ IfExist,C:Program Files (x86)OraySunLoginSunloginClientSunloginClient.exe

;~ Run,C:Program Files (x86)OraySunLoginSunloginClientSunloginClient.exe

;~ Sleep,5000

;~ IfWinNotExist,,连接服务器成功

;~ MsgBox,99999999999

 

;等待指定标题窗口出现

;~ Process,Exist,Executor.exe

;~ if (%ErrorLevel%=0)

;~ {

;~ MsgBox

;~ ToolTip,2222a

;~ }

 

;~ SetTimer,RunExeFile运行程序_03,-500

;~ SetTimer,SwitchToThisWindow激活窗口_04,500

;~ SetTimer,ControlSend发送模拟键击到控件_06,500

;~ SetTimer,ControlClick发送鼠标按钮或鼠标滚轮事件到控件_07,500

;~ SetTimer,SetTimerDelete禁用并删除所有Timer自动重复周期运行子程序_08,500

 

;~ 经过试验得知运行程序每次都成功所以这里用负数-500表示0.5秒后运行定时器函数

;~ 单次运行 [v1.0.46.16+]: 使用负的 周期 来表示计时器只运行一次.

;~ 例如,指定 -100 将会从现在开始的 100 ms 后运行计时器,

;~ 然后就像使用 SetTimer, Label, Off 那样禁用计时器。

;~ 不要使用某个功能函数时只需注释掉调用代码即可,无需注释函数体定义部分的代码

;~ SetTimer,ControlFocus设置焦点到指定控件_05,500

 

;~ 并发运行的AutoHotkey脚本真机实际测试模板参考20191010.ahk

 

;~ 在SciTE4AutoHotkey窗口中选中代码块并按+Q 注释代码

;~ 在SciTE4AutoHotkey窗口中按运行脚本

;~ 按测试AHK代码片段

;~ 按+无条件终止此脚本

;~ 按重新启动此脚本并测试代码片段

;~ 在SciTE4AutoHotkey窗口中按+终止运行脚本

 

;~ 2019年10月10日

;~ 徐晓亮(aahk6188)

;~ 操作系统测试环境: Windows 7 专业版 32位 系统 On Website https://msdn.itellyou.cn/

;~ AHK系统测试环境: AutoHotkey_1.1.31.00_setup.exe On Website https://www.autohotkey.com/

;~ 并发运行可以防止错过对一些窗口的操作

;~ 并发运行可以精确等待操作时机的出现

;~ 并发运行可以使脚本运行更流畅,可以有效防止脚本应等待窗口或控件的出现而出现卡死现象

 

;~ Hotkey,F6,Hotkey_F6定义F6热键_01 ;创建并启用热键,当用户输入热键时立即执行热键所指向的函数。

;~ Hotkey,^F6,无条件终止此脚本

;~ Hotkey,F7,重新启动此脚本并测试代码片段

;~ 请在SciTE4AutoHotkey窗口中按运行脚本,, 在SciTE4AutoHotkey窗口中按+终止运行脚本

;~ MsgBox,按快捷键打开记事本

 

;显示热键提示信息窗口并暂停脚本执行直到用户按确定按钮控件。

 

;~ 接下来定义函数名是“ConfigThisScript设置此脚本的参数_01() ”的函数,

;~ 便于用SetTimer定时器或直接通过函数名调用此函数,

;~ 函数类似于子程序 (Gosub), 不过它可以从调用者那里接受参数 (输入).

;~ 同时, 函数还可以返回值给其调用者.

;~ 函数可以减少代码书写量(代码复用,代码重用),只在一处统一定义函数可以有效防止代码不一致出错,

;~ 只在一处定义便于今后修改维护,实现模块化积木化编程,

;~ 把大的任务用SetTimer定时器函数的形式切割细分为很多小功能函数使得比较困难的事情容易实现,

;~ 在工作、学习、生活、社交、人生规划等方面也可以用笔在A4纸上切割和细分,以此类推,触类旁通。

 

;

; 本文的最后修改日期是 公元2019年11月07日

; 晓亮(weiyunwps618)的腾讯QQ邮箱地址是 595076941@qq.com )

; 晓亮(weiyunwps618)的中国移动手机号码是 138####5488 )

; 此AHK脚本的测试环境是 Windows 7 Pro SP1 VL 和 AutoHotkey v1.1.30.01

;

 

////////////////////////////////////////////////////////////////////////////////////////////////

 

;~ 定时关闭广告窗口.ahk

 

;~ 定时自动关闭弹出广告窗口

;~ 请使用 AHK管理器AHKManager.ahk 管理和调用此脚本

 

 

SetTimer,设置此脚本的运行参数ConfigThisScript,-1000

SetTimer,关广告窗口删除广告文件,3000

return

;

关广告窗口删除广告文件()

{

      WinClose,USB KEY PIN ahk_class #32770 ahk_exe Aisino.Framework.Startup.exe, 请输入KEY的PIN

      WinHide,USB KEY PIN ahk_class #32770 ahk_exe Aisino.Framework.Startup.exe, 请输入KEY的PIN

      ; 请用 AHKInfo 1.3.5 窗口信息查询工具来获取窗口标题和窗口类名

      WinClose, FF新推荐

      WinClose,热点资讯

      WinClose,ahk_class Q360RemindSClass ahk_exe 360Speedld.exe,

      WinClose, ahk_class SGPopBubbleWindow ahk_exe SGTool.exe,

      WinHide, ahk_class Suspension,

      WinClose, 今日推荐

      WinHide, 今日推荐

      WinClose,USB KEY PIN ahk_class #32770 ahk_exe Aisino.Framework.Startup.exe, 请输入KEY的PIN

      WinHide,USB KEY PIN ahk_class #32770 ahk_exe Aisino.Framework.Startup.exe, 请输入KEY的PIN

 

      ;~ Process,Close,Notepad.exe

      ;~ FileDelete,C:abcdef.exe

}

设置此脚本的运行参数ConfigThisScript()

{

      ;当此脚本已经运行时自动替换旧实例再次运行。

#SingleInstance,force

      ;让脚本持久运行(即直到用户关闭或遇到 ExitApp)。

#Persistent

      ;不检查空变量是否为环境变量(建议所有新脚本使用)。

#NoEnv

      ;用强制的方法激活窗口。阻止任务栏按钮的闪烁.

#WinActivateForce

      ;不显示托盘图标。

#NoTrayIcon

      ;启用或禁用可能产生错误的特定状况时的警告,例如书写错误或缺少全局声明

      ;~ #Warn

      ;改变脚本的当前工作目录。

      SetWorkingDir,%A_ScriptDir%

      ;设置脚本可以“看见”隐藏的窗口。

      DetectHiddenWindows,On

      ;窗口标题匹配模式改成只需某个位置必须包含WinTitle。而不是完全匹配。

      SetTitleMatchMode,2

      ;SendInput 通常更快更可靠. 缓存了发送期间任何物理的键盘或鼠标活动, 避免了在发送时夹杂用户的键击.

      SendMode,Input

      ;要看源代码语句的解释请自己搜索AutoHotkey的CHM中文帮助文件吧,选中单词后按帮助快捷键 F1

      CoordMode,Mouse,Screen

      CoordMode,Pixel,Screen

      CoordMode,ToolTip,Screen

      ListLines,Off

      SetBatchLines,-1

      SetStoreCapsLockMode, On

      ;~ SetBatchLines,

      ;~ SetKeyDelay,

      ;~ SetWinDelay,

      ;~ SetControlDelay,

}

;

 

;===== 脚本结束 =====

 

////////////////////////////////////////////////////////////////////////////////////////////////

 

;~ 定时隐藏个人窗口可临时停止运行.ahk

 

;~ 定时隐藏个人窗口

;~ 请使用 AHK管理器AHKManager.ahk 管理和调用此脚本

 

 

SetTimer,设置此脚本的运行参数ConfigThisScript,-1000

SetTimer,定时隐藏个人窗口,3000

return

;

定时隐藏个人窗口()

{

      ;~ 隐藏迅雷下载软件的主窗口

      WinHide, 迅雷 ahk_class Chrome_WidgetWin_0, Chrome Leg

 

      ;~ 隐藏迅雷下载软件的悬浮小窗口

 

      ;~ Process,Close,Notepad.exe

      ;~ FileDelete,C:abcdef.exe

}

设置此脚本的运行参数ConfigThisScript()

{

      ;当此脚本已经运行时自动替换旧实例再次运行。

#SingleInstance,force

      ;让脚本持久运行(即直到用户关闭或遇到 ExitApp)。

#Persistent

      ;不检查空变量是否为环境变量(建议所有新脚本使用)。

#NoEnv

      ;用强制的方法激活窗口。阻止任务栏按钮的闪烁.

#WinActivateForce

      ;不显示托盘图标。

#NoTrayIcon

      ;启用或禁用可能产生错误的特定状况时的警告,例如书写错误或缺少全局声明

      ;~ #Warn

      ;改变脚本的当前工作目录。

      SetWorkingDir,%A_ScriptDir%

      ;设置脚本可以“看见”隐藏的窗口。

      DetectHiddenWindows,On

      ;窗口标题匹配模式改成只需某个位置必须包含WinTitle。而不是完全匹配。

      SetTitleMatchMode,2

      ;SendInput 通常更快更可靠. 缓存了发送期间任何物理的键盘或鼠标活动, 避免了在发送时夹杂用户的键击.

      SendMode,Input

      ;要看源代码语句的解释请自己搜索AutoHotkey的CHM中文帮助文件吧,选中单词后按帮助快捷键 F1

      CoordMode,Mouse,Screen

      CoordMode,Pixel,Screen

      CoordMode,ToolTip,Screen

      ListLines,Off

      SetBatchLines,-1

      SetStoreCapsLockMode, On

      ;~ SetBatchLines,

      ;~ SetKeyDelay,

      ;~ SetWinDelay,

      ;~ SetControlDelay,

}

;

 

;===== 脚本结束 =====

 

////////////////////////////////////////////////////////////////////////////////////////////////

;~ 设置常驻内存的程序加快窗口显示的速度.ahk

;

; 开机时自动启动的AutoHotkey脚本 2019年10月09日

;

; 计时器创建代码段 -----------------------------------------------------------------------------------------

; SetTimer可以模拟多线程从而不影响主线程的流畅执行

; 请在SciTE4AutoHotkey中选中单词并按快捷键F12跳转到函数定义处

; 绿色免安装程序,统一都分类保存在本地磁盘D分区文件夹 D:DIYTOOLSram 中

; 例如: MasterSeeker就长期坚持固定不变保存位置在 D:DIYTOOLSramMasterSeekerMasterSeeker.exe

; 例如: FileLocator Pro就长期坚持固定不变保存位置在 D:DIYTOOLSramFileLocatorFileLocator.exe

; #####################################################################

;

global ProgramDir

;~ ProgramDir=%A_ScriptDir%......

ProgramDir=D:Program

;~ SetTimer,01设置全局无窗口快捷键,-1000

;  请养成按 + 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,``,00打开随身U盘_办公专用盘

      Hotkey,`#n,02激活或隐藏窗口EmEditor

      Hotkey,`#e,03激活或隐藏窗口TotalCommander  ;  按热键 Win+E 激活 TotalCommander

      Hotkey,`#f,04激活或隐藏窗口MasterSeeker

      Hotkey,`#g,05激活或隐藏窗口Everything

      Hotkey,`#b,06激活或隐藏窗口SogouExplorer

      Hotkey,`#c,07激活或隐藏窗口计算器Calc  ;  按热键 Win + C,打开计算器

      Hotkey,`^!E,08用SciTE4AutoHotkey编辑此脚本

      Hotkey,`^!R,09重启此脚本

      Hotkey,^F12,10终止此脚本执行  ;按Ctrl+Alt+F10键此脚本立即停止执行并退出

}

;

 

;  ;智能命令,双击ALT执行

;  Alt::

;    if winc_presses > 0 ; SetTimer 已经启动, 所以我们记录键击.

;    {

;         winc_presses += 1

;         return

;    }

;    ; 否则, 这是新开始系列中的首次按下. 把次数设为 1 并启动

;    ; 计时器:

;    winc_presses = 1

;    SetTimer, KeyWinC, -400 ; 在 400 毫秒内等待更多的键击.

;  return

;

;  ;双击执行跳转

;  KeyWinC:

;    if winc_presses = 2 ; 此键按下了两次.

;    {

;         Gui, Show

;

;    }

;    ; 不论触发了上面的哪个动作, 都对 count 进行重置

;    ; 为下一个系列的按下做准备:

;    winc_presses = 0

;  return

 

 

; 00打开随身U盘_办公专用盘()

; {

;    随身U盘的盘符:=搜索随身U盘并设置盘符()

;    if (随身U盘的盘符<>0)

;    {    ToolTip

;          FileCreateDir,     %随身U盘的盘符%:1_办公文件

;          DetectHiddenWindows,On

;          SetTitleMatchMode,2

;          ;~ 需要设置一下系统,工具->文件夹选项->查看->在标题栏显示完整路径

;          IfWinExist,9.22

;          {

;               WinShow,9.22

;               WinActivate,9.22

;               WinMaximize,9.22

;          }

;          else

;          {

;

;               IfExist,D:ProgramTotalCMDTotalCMD.exe

;               {

;                     Run,D:ProgramTotalCMDTotalCMD.exe %随身U盘的盘符%:1_办公文件

;               }

;               else

;                     MsgBox,找不到文件 D:ProgramTotalCMDTotalCMD.exe

;               ;~ Run,%随身U盘的盘符%:1_办公文件

;          }

;          loop,5

;          {

;               WinMove,01_办公文件 ahk_class CabinetWClass,,A_ScreenWidth/2,0,A_ScreenWidth/2,A_ScreenHeight-35

;               Sleep,100

;          }

;    }

;    else

;          ToolTip,没有找到随身U盘

; }

; ;

; ;

 

00打开随身U盘_办公专用盘()

{

      随身U盘的盘符:=搜索随身U盘并设置盘符()

      if (随身U盘的盘符<>0)

      {    ToolTip

           FileCreateDir,     %随身U盘的盘符%:1_办公文件

           DetectHiddenWindows,On

           SetTitleMatchMode,2

           ;~ 需要设置一下系统,工具->文件夹选项->查看->在标题栏显示完整路径

           IfWinExist,,01_办公文件

           {

                 WinShow,,01_办公文件

                 WinActivate,,01_办公文件

                 ;~ WinMaximize,01_办公文件

           }

           else

           {

                 Run,%随身U盘的盘符%:1_办公文件

           }

           loop,5

           {

                 WinMove,,01_办公文件,A_ScreenWidth/2,0,A_ScreenWidth/2,A_ScreenHeight-35

                 Sleep,100

           }

      }

      else

           ToolTip,没有找到随身U盘

}

;

;

搜索随身U盘并设置盘符()

{    找到U盘:=false

      DriveGet,盘符清单,List

      loop,Parse,盘符清单

      {    DriveGet,卷标,Label,%A_LoopField%:

           IfInString,卷标, 随身U盘

           {    找到U盘:=true

                 return,%A_LoopField%

           } }

           if (not   找到U盘)

           {    return,0

           } }

           ;

           ;

           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()

{

      ToolTip,正在启动搜狗高速浏览器_请稍候 . . .

      根据窗口类名激活或者隐藏窗口("SogouExplorer","SE_SogouExplorerFrame")

}

;

07激活或隐藏窗口计算器Calc()

{

      Run,calc

}

;

08用SciTE4AutoHotkey编辑此脚本()

{

      IfExist,%ProgramDir%AutoHotkeySciTESciTE.exe

           Run,%ProgramDir%AutoHotkeySciTESciTE.exe %A_ScriptName%

      else

      {

           ToolTip,找不到文件%ProgramDir%AutoHotkeySciTESciTE.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%MasterSeekerMasterSeeker.exe

                            Run,%ProgramDir%MasterSeekerMasterSeeker.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运行国税金税盘开票软件()

{

      SetTimer,运行开票软件,-500

      SetTimer,激活登录窗口,500

      SetTimer,单击登录窗口中的确定按钮,500

      SetTimer,关闭上报汇总已成功提示窗口,500

      SetTimer,等待主窗口出现后停止并删除所有Timer定时器,500

}

运行开票软件()

{

      IfExist,D:开票软件MainExecute.exe

      {

           Process,Exist,Aisino.Framework.Startup.exe

           if (%ErrorLevel%=0)

           {

                 IfWinNotExist,SysMessageBox ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 提示

                 {

                      IfWinNotExist,增值税发票税控开票软件

                            Run,D:开票软件MainExecute.exe

                 }

           }

      }

}

激活登录窗口()

{

      WinGet, WinID, ID,税控发票开票软件

      DllCall("SwitchToThisWindow", "UInt", WinID, "UInt", 1)

}

单击登录窗口中的确定按钮()

{

      ControlClick, WindowsForms10.BUTTON.app.0.2bb23b_r11_ad12, 税控发票开票软件 ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 增值税发票税控开票软

}

关闭上报汇总已成功提示窗口()

{

      WinClose,SysMessageBox ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 提示

}

等待主窗口出现后停止并删除所有Timer定时器()

{

      ;等待指定标题窗口出现

      IfWinExist, 增值税发票税控开票软件(金税盘版) ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 系统设置

           停止并删除所有Timer定时器()

      IfWinExist, 增值税发票税控开票软件(金税盘版) ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 发票管理

           停止并删除所有Timer定时器()

      IfWinExist, 增值税发票税控开票软件(金税盘版) ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 报税处理

           停止并删除所有Timer定时器()

      IfWinExist, 增值税发票税控开票软件(金税盘版) ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 系统维护

           停止并删除所有Timer定时器()

}

 

停止并删除所有Timer定时器()

{

      SetTimer,运行开票软件,Delete

      SetTimer,激活登录窗口,Delete

      SetTimer,单击登录窗口中的确定按钮,Delete

      SetTimer,关闭上报汇总已成功提示窗口,Delete

      SetTimer,等待主窗口出现后停止并删除所有Timer定时器,Delete

      ;~ MsgBox,开票软件启动成功

      Run,C:WindowsSystem32Rundll32.Exe user32.dll LockWorkStation,,Hide

}

;

17运行一些软件应用程序()

{

      SetTimer,定时重启向日葵远程控制保持远程访问可用,3600000

      IfExistRun("WiseDesktop")  ; WiseDesktop 1.3 虚拟桌面管理程序

      ;~ IfExistRun("Rolan")

      IfExistRun("PCOff")  ;定时强制关机精灵1.0 在 17:05 下班后定时强制关闭电脑

      SetTimer,超时锁定桌面,30000

      ;~ Run,"D:DIYTOOLSAHKManageAHKManage.ahk"

      ;~ FileCreateShortcut,http://www.weiyun.com,%A_DesktopCommon%微云网页版.lnk

      ; D:DIYTOOLSAutoHotkeySciTE 文件夹用于保存AHK脚本编辑器程序,此程序可用uTools搜索并运行

      FileCreateDir,D:DIYTOOLSAutoHotkeySciTE

      ; D:DIYTOOLSMasterSeeker 文件夹用于保存MasterSeeker程序,此程序需要微软的dotNetFx2.0运行库支持才能运行

      FileCreateDir,D:DIYTOOLSMasterSeeker

      ; D:DIYTOOLSAutoRun 文件夹用于保存开机自动启动的AHK脚本

      FileCreateDir,D:DIYTOOLSAutoRun

      ; D:DIYTOOLSuToolslnks 文件夹用于保存uTools的自定义快捷方式,可用uTools缓存和搜索快捷方式,网址可以保存在批处理脚本的快捷方式中

      FileCreateDir,D:DIYTOOLSuToolslnks

}

;

定时重启向日葵远程控制保持远程访问可用()

{

      loop,9

      {

           ;~ 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

           Process,Close,SunloginClient.exe

      }

      loop,2

      {

           Sleep,3000

           IfExist,"C:Program FilesOraySunLoginSunloginClientSunloginClient.exe"

                 Run,"C:Program FilesOraySunLoginSunloginClientSunloginClient.exe"

      }

}

;

超时锁定桌面()

{

      if(A_TimeIdle>50000)

      {

           if(A_TimeIdlePhysical>50000)

           {

                 Run,C:WindowsSystem32Rundll32.Exe user32.dll LockWorkStation,,Hide

                 SendMessage, 0x112, 0xF170, 2,, Program Manager   ; 关闭显示器: 0x112 为 WM_SYSCOMMAND, 0xF170 为 SC_MONITORPOWER. ; 可使用 -1 代替 2 打开显示器,1 代替 2 激活显示器的节能模式

           }

}

}

18关广告窗口删除广告文件()

{

      ;等待指定标题窗口出现

      WinHide, USB KEY PIN ahk_class #32770 ahk_exe Aisino.Framework.Startup.exe, 请输入KEY的PIN

      WinClose, USB KEY PIN ahk_class #32770 ahk_exe Aisino.Framework.Startup.exe, 请输入KEY的PIN

      ;等待指定标题窗口出现

      WinHide, ahk_class TXGuiFoundation ahk_exe QQPCTray.exe,

      WinClose, Microsoft Windows ahk_class #32770, 稍后重新启动(&L)

      WinClose, ahk_class TXGuiFoundation ahk_exe QQPCTray.exe,

      WinClose,头条新闻

      WinClose,向日葵远程控制 ahk_class SDL_app,

      WinClose,今日热点 ahk_class SGNewsWindow,

      WinClose,到期抄报税提示 ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe,

 

      ; 请用 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,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

; 此脚本到此行结束

 

ExitApp

 

////////////////////////////////////////////////////////////////////////////////////////////////

 

;~ 无窗口全局热键定义.ahk

;

; 开机时自动启动的AutoHotkey脚本 2019年10月09日

;

; 计时器创建代码段 -----------------------------------------------------------------------------------------

; SetTimer可以模拟多线程从而不影响主线程的流畅执行

; 请在SciTE4AutoHotkey中选中单词并按快捷键F12跳转到函数定义处

; 绿色免安装程序,统一都分类保存在本地磁盘D分区文件夹 D:DIYTOOLSram 中

; 例如: MasterSeeker就长期坚持固定不变保存位置在 D:DIYTOOLSramMasterSeekerMasterSeeker.exe

; 例如: FileLocator Pro就长期坚持固定不变保存位置在 D:DIYTOOLSramFileLocatorFileLocator.exe

; #####################################################################

;

global ProgramDir

;~ ProgramDir=%A_ScriptDir%......

ProgramDir=D:Program

SetTimer,01设置全局无窗口快捷键,-1000

;  请养成按 + 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,``,00打开随身U盘_办公专用盘

      Hotkey,`#n,02激活或隐藏窗口EmEditor

      Hotkey,`#e,03激活或隐藏窗口TotalCommander  ;  按热键 Win+E 激活 TotalCommander

      Hotkey,`#f,04激活或隐藏窗口MasterSeeker

      Hotkey,`#g,05激活或隐藏窗口Everything

      Hotkey,`#b,06激活或隐藏窗口SogouExplorer

      Hotkey,`#c,07激活或隐藏窗口计算器Calc  ;  按热键 Win + C,打开计算器

      Hotkey,`^!E,08用SciTE4AutoHotkey编辑此脚本

      Hotkey,`^!R,09重启此脚本

      Hotkey,^F12,10终止此脚本执行  ;按Ctrl+Alt+F10键此脚本立即停止执行并退出

}

;

 

;  ;智能命令,双击ALT执行

;  Alt::

;    if winc_presses > 0 ; SetTimer 已经启动, 所以我们记录键击.

;    {

;         winc_presses += 1

;         return

;    }

;    ; 否则, 这是新开始系列中的首次按下. 把次数设为 1 并启动

;    ; 计时器:

;    winc_presses = 1

;    SetTimer, KeyWinC, -400 ; 在 400 毫秒内等待更多的键击.

;  return

;

;  ;双击执行跳转

;  KeyWinC:

;    if winc_presses = 2 ; 此键按下了两次.

;    {

;         Gui, Show

;

;    }

;    ; 不论触发了上面的哪个动作, 都对 count 进行重置

;    ; 为下一个系列的按下做准备:

;    winc_presses = 0

;  return

 

 

; 00打开随身U盘_办公专用盘()

; {

;    随身U盘的盘符:=搜索随身U盘并设置盘符()

;    if (随身U盘的盘符<>0)

;    {    ToolTip

;          FileCreateDir,     %随身U盘的盘符%:1_办公文件

;          DetectHiddenWindows,On

;          SetTitleMatchMode,2

;          ;~ 需要设置一下系统,工具->文件夹选项->查看->在标题栏显示完整路径

;          IfWinExist,9.22

;          {

;               WinShow,9.22

;               WinActivate,9.22

;               WinMaximize,9.22

;          }

;          else

;          {

;

;               IfExist,D:ProgramTotalCMDTotalCMD.exe

;               {

;                     Run,D:ProgramTotalCMDTotalCMD.exe %随身U盘的盘符%:1_办公文件

;               }

;               else

;                     MsgBox,找不到文件 D:ProgramTotalCMDTotalCMD.exe

;               ;~ Run,%随身U盘的盘符%:1_办公文件

;          }

;          loop,5

;          {

;               WinMove,01_办公文件 ahk_class CabinetWClass,,A_ScreenWidth/2,0,A_ScreenWidth/2,A_ScreenHeight-35

;               Sleep,100

;          }

;    }

;    else

;          ToolTip,没有找到随身U盘

; }

; ;

; ;

 

00打开随身U盘_办公专用盘()

{

      随身U盘的盘符:=搜索随身U盘并设置盘符()

      if (随身U盘的盘符<>0)

      {    ToolTip

           FileCreateDir,     %随身U盘的盘符%:1_办公文件

           DetectHiddenWindows,On

           SetTitleMatchMode,2

           ;~ 需要设置一下系统,工具->文件夹选项->查看->在标题栏显示完整路径

           IfWinExist,,01_办公文件

           {

                 WinShow,,01_办公文件

                 WinActivate,,01_办公文件

                 ;~ WinMaximize,01_办公文件

           }

           else

           {

                 Run,%随身U盘的盘符%:1_办公文件

           }

           loop,5

           {

                 WinMove,,01_办公文件,A_ScreenWidth/2,0,A_ScreenWidth/2,A_ScreenHeight-35

                 Sleep,100

           }

      }

      else

           ToolTip,没有找到随身U盘

}

;

;

搜索随身U盘并设置盘符()

{    找到U盘:=false

      DriveGet,盘符清单,List

      loop,Parse,盘符清单

      {    DriveGet,卷标,Label,%A_LoopField%:

           IfInString,卷标, 随身U盘

           {    找到U盘:=true

                 return,%A_LoopField%

           } }

           if (not   找到U盘)

           {    return,0

           } }

           ;

           ;

           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()

{

      ToolTip,正在启动搜狗高速浏览器_请稍候 . . .

      根据窗口类名激活或者隐藏窗口("SogouExplorer","SE_SogouExplorerFrame")

}

;

07激活或隐藏窗口计算器Calc()

{

      Run,calc

}

;

08用SciTE4AutoHotkey编辑此脚本()

{

      IfExist,%ProgramDir%AutoHotkeySciTESciTE.exe

           Run,%ProgramDir%AutoHotkeySciTESciTE.exe %A_ScriptName%

      else

      {

           ToolTip,找不到文件%ProgramDir%AutoHotkeySciTESciTE.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%MasterSeekerMasterSeeker.exe

                            Run,%ProgramDir%MasterSeekerMasterSeeker.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运行国税金税盘开票软件()

{

      SetTimer,运行开票软件,-500

      SetTimer,激活登录窗口,500

      SetTimer,单击登录窗口中的确定按钮,500

      SetTimer,关闭上报汇总已成功提示窗口,500

      SetTimer,等待主窗口出现后停止并删除所有Timer定时器,500

}

运行开票软件()

{

      IfExist,D:开票软件MainExecute.exe

      {

           Process,Exist,Aisino.Framework.Startup.exe

           if (%ErrorLevel%=0)

           {

                 IfWinNotExist,SysMessageBox ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 提示

                 {

                      IfWinNotExist,增值税发票税控开票软件

                            Run,D:开票软件MainExecute.exe

                 }

           }

      }

}

激活登录窗口()

{

      WinGet, WinID, ID,税控发票开票软件

      DllCall("SwitchToThisWindow", "UInt", WinID, "UInt", 1)

}

单击登录窗口中的确定按钮()

{

      ControlClick, WindowsForms10.BUTTON.app.0.2bb23b_r11_ad12, 税控发票开票软件 ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 增值税发票税控开票软

}

关闭上报汇总已成功提示窗口()

{

      WinClose,SysMessageBox ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 提示

}

等待主窗口出现后停止并删除所有Timer定时器()

{

      ;等待指定标题窗口出现

      IfWinExist, 增值税发票税控开票软件(金税盘版) ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 系统设置

           停止并删除所有Timer定时器()

      IfWinExist, 增值税发票税控开票软件(金税盘版) ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 发票管理

           停止并删除所有Timer定时器()

      IfWinExist, 增值税发票税控开票软件(金税盘版) ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 报税处理

           停止并删除所有Timer定时器()

      IfWinExist, 增值税发票税控开票软件(金税盘版) ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe, 系统维护

           停止并删除所有Timer定时器()

}

 

停止并删除所有Timer定时器()

{

      SetTimer,运行开票软件,Delete

      SetTimer,激活登录窗口,Delete

      SetTimer,单击登录窗口中的确定按钮,Delete

      SetTimer,关闭上报汇总已成功提示窗口,Delete

      SetTimer,等待主窗口出现后停止并删除所有Timer定时器,Delete

      ;~ MsgBox,开票软件启动成功

      Run,C:WindowsSystem32Rundll32.Exe user32.dll LockWorkStation,,Hide

}

;

17运行一些软件应用程序()

{

      SetTimer,定时重启向日葵远程控制保持远程访问可用,3600000

      IfExistRun("WiseDesktop")  ; WiseDesktop 1.3 虚拟桌面管理程序

      ;~ IfExistRun("Rolan")

      IfExistRun("PCOff")  ;定时强制关机精灵1.0 在 17:05 下班后定时强制关闭电脑

      SetTimer,超时锁定桌面,30000

      ;~ Run,"D:DIYTOOLSAHKManageAHKManage.ahk"

      ;~ FileCreateShortcut,http://www.weiyun.com,%A_DesktopCommon%微云网页版.lnk

      ; D:DIYTOOLSAutoHotkeySciTE 文件夹用于保存AHK脚本编辑器程序,此程序可用uTools搜索并运行

      FileCreateDir,D:DIYTOOLSAutoHotkeySciTE

      ; D:DIYTOOLSMasterSeeker 文件夹用于保存MasterSeeker程序,此程序需要微软的dotNetFx2.0运行库支持才能运行

      FileCreateDir,D:DIYTOOLSMasterSeeker

      ; D:DIYTOOLSAutoRun 文件夹用于保存开机自动启动的AHK脚本

      FileCreateDir,D:DIYTOOLSAutoRun

      ; D:DIYTOOLSuToolslnks 文件夹用于保存uTools的自定义快捷方式,可用uTools缓存和搜索快捷方式,网址可以保存在批处理脚本的快捷方式中

      FileCreateDir,D:DIYTOOLSuToolslnks

}

;

定时重启向日葵远程控制保持远程访问可用()

{

      loop,9

      {

           ;~ 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

           Process,Close,SunloginClient.exe

      }

      loop,2

      {

           Sleep,3000

           IfExist,"C:Program FilesOraySunLoginSunloginClientSunloginClient.exe"

                 Run,"C:Program FilesOraySunLoginSunloginClientSunloginClient.exe"

      }

}

;

超时锁定桌面()

{

      if(A_TimeIdle>50000)

      {

           if(A_TimeIdlePhysical>50000)

           {

                 Run,C:WindowsSystem32Rundll32.Exe user32.dll LockWorkStation,,Hide

                 SendMessage, 0x112, 0xF170, 2,, Program Manager   ; 关闭显示器: 0x112 为 WM_SYSCOMMAND, 0xF170 为 SC_MONITORPOWER. ; 可使用 -1 代替 2 打开显示器,1 代替 2 激活显示器的节能模式

           }

}

}

18关广告窗口删除广告文件()

{

      ;等待指定标题窗口出现

      WinHide, USB KEY PIN ahk_class #32770 ahk_exe Aisino.Framework.Startup.exe, 请输入KEY的PIN

      WinClose, USB KEY PIN ahk_class #32770 ahk_exe Aisino.Framework.Startup.exe, 请输入KEY的PIN

      ;等待指定标题窗口出现

      WinHide, ahk_class TXGuiFoundation ahk_exe QQPCTray.exe,

      WinClose, Microsoft Windows ahk_class #32770, 稍后重新启动(&L)

      WinClose, ahk_class TXGuiFoundation ahk_exe QQPCTray.exe,

      WinClose,头条新闻

      WinClose,向日葵远程控制 ahk_class SDL_app,

      WinClose,今日热点 ahk_class SGNewsWindow,

      WinClose,到期抄报税提示 ahk_class WindowsForms10.Window.8.app.0.2bb23b_r11_ad1 ahk_exe Aisino.Framework.Startup.exe,

 

      ; 请用 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,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

;

; 此脚本到此行结束

 

////////////////////////////////////////////////////////////////////////////////////////////////

 

;~ 无窗口全局热字串定义.ahk

 

; 用AutoHotkey的热字串功能启动常用电脑程序软件 Version 2 Build 20191214

 

; 电脑上的快捷键太多了,记都记不住,容易冲突和搞混,所以做了个热字串启动

; 用法:运行此脚本后在键盘上输入字符串  /np

; 此脚本的写作和调试完成日期:2019年12月12日

; 此脚本的作者:徐晓亮 (aahk)

; 此脚本作者的腾讯QQ电子邮箱地址:595076941@QQ.com

 

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.

; #Warn  ; Enable warnings to assist with detecting common errors.

SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.

SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#SingleInstance,force ;当此脚本已经运行时自动替换旧实例再次运行。

#Persistent  ;让脚本持久运行(即直到用户关闭或遇到 ExitApp)。

DetectHiddenWindows,On  ;设置脚本可以“看见”隐藏的窗口。

SetTitleMatchMode,2  ;窗口标题匹配模式改成某个位置必须包含WinTitle。

;~ global exename

;~ exename=Notepad2

:*:/np::

      Hotstrings("Notepad2")

return

 

:*:/qq::

      Hotstrings2("qq")

return

 

:*:/tc::

      Hotstrings("TotalCMD")

return

 

:*:/wk::

      打开随身U盘_办公专用盘()

      ToolTip,正在启动EverEdit_请稍后...

      SetTimer, RemoveToolTip, 3000

return

 

:*:/ee::

      IfExist,C:UsersAdministratorAppDataLocalEverEditEverEdit.exe

      {

           Run,C:UsersAdministratorAppDataLocalEverEditEverEdit.exe

      }

      else

      {

           MsgBox,没有找到可执行文件C:UsersAdministratorAppDataLocalEverEditEverEdit.exe

      }

      ToolTip,正在启动EverEdit_请稍后...

      SetTimer, RemoveToolTip, 3000

return

 

Hotstrings(ExeName)

{

 

      IfExist,D:Program%ExeName%%ExeName%.exe

      {

           Run,D:Program%ExeName%%ExeName%.exe

      }

      else

      {

           MsgBox,没有找到可执行文件D:Program%ExeName%%ExeName%.exe

      }

      ToolTip,正在启动%ExeName%_请稍后...

      SetTimer, RemoveToolTip, 3000

}

Hotstrings2(ExeName2)

{

 

      IfExist,D:Program%ExeName2%Bin%ExeName2%.exe

      {

           Run,D:Program%ExeName2%Bin%ExeName2%.exe

      }

      else

      {

           MsgBox,没有找到可执行文件D:Program%ExeName2%Bin%ExeName2%.exe

      }

      ToolTip,正在启动%ExeName2%_请稍后...

      SetTimer, RemoveToolTip, 3000

}

 

:*:/sg::

      IfExist,D:ProgramSogouExplorerSogouExplorer.exe

           Run,D:ProgramSogouExplorerSogouExplorer.exe

      ToolTip,正在启动搜狗高速浏览器_请稍后...

      SetTimer, RemoveToolTip, 3000

return

 

; ===== 函数定义段 =====

 

打开随身U盘_办公专用盘()

{ 随身U盘的盘符:=搜索随身U盘并设置盘符()

      if (随身U盘的盘符<>0)

      { ToolTip

           FileCreateDir, %随身U盘的盘符%:1_办公文件

           DetectHiddenWindows,On

           SetTitleMatchMode,2

           ;~ 需要手动或用脚本语句设置一下系统,工具->文件夹选项->查看->在标题栏显示完整路径

           IfWinExist,01_办公文件

           {

                 WinShow,01_办公文件

                 WinActivate,01_办公文件

           }

           else

           {

                 Run,%随身U盘的盘符%:1_办公文件

           }

           loop,5

           {

                 WinMove,01_办公文件 ahk_class CabinetWClass,,A_ScreenWidth/2,0,A_ScreenWidth/2,A_ScreenHeight-35

                 Sleep,100

           } }

           else

                 ToolTip,没有找到随身U盘

      }

      ;

      ; 根据磁盘卷标搜索到盘符后,可以再使用 IfExist 命令检查文件或文件夹是否存在。先检测,后执行。

      搜索随身U盘并设置盘符()

      { 找到U盘:=false

           DriveGet,盘符清单,List

           loop,Parse,盘符清单

           { DriveGet,卷标,Label,%A_LoopField%:

                 IfInString,卷标, 随身U盘

                 { 找到U盘:=true

                      return,%A_LoopField%

                 } }

                 if (not 找到U盘)

                 { return,0

                 } }

                 ;

                 ;

 

RemoveToolTip:

      SetTimer, RemoveToolTip, Off

      ToolTip

return

; ===== 脚本结束 =====

 

////////////////////////////////////////////////////////////////////////////////////////////////

 


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

用AutoHotkey的热字串功能启动常用电脑程序软件

2019-12-14 17:15:44

其他教程

0.1-课程内容和课程安排

2019-12-17 21:30:42

4 条回复 A文章作者 M管理员
  1. AHK中文社区

    ✗咧嘴笑✗

  2. 阿瑞

    空行太多了呀,何许人

  3. 布君

    看的累啊,空行不要钱

个人中心
购物车
优惠劵
有新私信 私信列表
搜索