AutoHotKey脚本模板:初始化、配置、退出

AutoHotKey脚本模板实现初始化、配置、退出

#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Screen
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
; WinSet, Transparent, Off

#NoEnv
#Warn
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

toggle_get_blood := 0
get_blood_count := 0
is_show_gui := 0
is_create_gui :=0
NewHotKey := "^F9"

MsgBox , 64, 使用提示, 系统要求:xxxxxxxxxxxx, 30

;;先配置默认快捷键
Hotkey, ^F1, Change_HotKey_Show
Hotkey, ^F2, Exit_App
Hotkey, ^F9, Run_arkAutoGetBlood
Return

;;;
Change_HotKey_Show:
if is_create_gui = 0
{
    is_create_gui = 1
    Gui, Add, Text,   x8 y8 w100 h24 +0x200, 自动抽血快捷键:
    Gui, Add, Hotkey, x128 y8 w268 h24 vNewHotKey, %NewHotKey%
    Gui, Add, Button, x40 y56 w80 h25 default gChange_HotKey, 确认(&O) 
    Gui, Add, Button, x288 y56 w80 h25 gCloseForm, 取消(&C)
    Gui, Show, w412 h97, 配置快捷键
} else
{
     if is_show_gui = 0
    {
        is_show_gui = 1
        Gui, Show, w412 h97, 配置快捷键
    } else {
        MsgBox , 64, 提示, 重复按键, 1
    }
}
Return

Change_HotKey:
Gui Submit
display_hot_key = %NewHotKey%
StringReplace, display_hot_key,  display_hot_key, +,Shift + , All
StringReplace, display_hot_key,  display_hot_key, ^,Ctrl + , All
StringReplace, display_hot_key,  display_hot_key, !,Alt + , All
MsgBox , 64, 提示, 新快捷键: %display_hot_key%, 3
Hotkey, %NewHotKey%, Run_arkAutoGetBlood
Return

CloseForm:
Gui, Hide
is_show_gui = 1
Return

;;;

脚本下补充自己的主体功能实现体:

Run_arkAutoGetBlood
即可

 

posted @ 2020-04-03 10:31  日月王  阅读(751)  评论(0编辑  收藏  举报