;General Window Settings
Gui, Font, s11 w700
Gui, -Caption +E0x200 +ToolWindow
TransColor = D4D1C8
Gui, Color, %TransColor% ; This color will be made transparent later below.
bgColor = White ; Background color
;Button number, as found using the number pad
Seven = x10 y10 w100 h100 cWhite
Eight = x120 y10 w100 h100 cBlue
Nine = x230 y10 w100 h100 cRed
Four = x10 y120 w100 h100 c6698cb
Five = x120 y120 w100 h100 cFFC128
Six = x230 y120 w100 h100 c90D8EF
One = x10 y230 w100 h100 cf7f7e8
Two = x120 y230 w100 h100 c99cc99
Three = x230 y230 w100 h100 ceeee22
Gui, Add, Button, %Seven%, 破解
Gui, Add, Button, %Eight%, 教程
Gui, Add, Button, %Nine%, 关闭
Gui, Add, Button, %Four%, 研究
Gui, Add, Button, %Five%, 课题
Gui, Add, Button, %Six%, 自动化
Gui, Add, Button, %One%, 美女
Gui, Add, Button, %Two%, 杂项
Gui, Add, Button, %Three%, 广告
Gui, Show, x400 y400 h340 w340
WinGet, k_ID, ID, A ; Get its window ID.
WinSet, AlwaysOnTop, On, ahk_id %k_ID%
WinSet, TransColor, %TransColor% 170, ahk_id %k_ID%
Gui, 2:-Caption +E0x200 +ToolWindow
Gui, 2:Color, %bgColor% ; Set background color here
Gui, 2:Add, Progress, %Seven%, 100
Gui, 2:Add, Progress, %Eight%, 100
Gui, 2:Add, Progress, %Nine%, 100
Gui, 2:Add, Progress, %Four%, 100
Gui, 2:Add, Progress, %Five%, 100
Gui, 2:Add, Progress, %Six%, 100
Gui, 2:Add, Progress, %One%, 100
Gui, 2:Add, Progress, %Two%, 100
Gui, 2:Add, Progress, %Three%, 100
Gui, 2:Show, x400 y400 h340 w340
Return
Button关闭:
ExitApp
Button自动化:
Run, http://www.autohotkey.com/
ExitApp
Button课题:
Run, http://www.yahoo.com/
ExitApp
Button研究:
MsgBox , 插入您的代码
ExitApp
Button教程:
Run, http://blog.csdn.net/menghuanruanjian/article/details/52742231
ExitApp
Button破解:
Run, http://www.drudgereport.com
ExitApp
Button广告:
Run, mmc %systemroot%\system32\dsa.msc
WinWait, Active Directory Users and Computers, Active Directory Use
GoSub, LastFoundWindow
Send, {ALTDOWN}ai{ALTUP}
WinWait, Find Users`, Contacts`, and Groups, Select the storage f
GoSub, LastFoundWindow
Send, {SHIFTDOWN}{INS}{SHIFTUP}{ENTER}
Sleep 100
Send, {SPACE}{ALTDOWN}f{ALTUP}
Sleep 200
Send, r
ExitApp
LastFoundWindow: ;Duh
IfWinNotActive ;automatically uses Last Found Window
WinActivate ;automatically uses Last Found Window
WinWaitActive ;automatically uses Last Found Window
Return
StatusWaitDone: ; Used to wwait for a webpage to load before conintue
SLEEP 100
AHKID := WinExist("A")
Ctr=0
Loop
{
Sleep, 10
Ctr+=1
ControlGet, Progress, Visible,, msctls_progress321, ahk_id %AHKID%
If (Progress=1)
{
Ctr=0
Continue
}
If (Progress=0 AND Ctr>10)
Break
}
StatusBarWait, Done, 10
RETURN
补充说明(本文为趣味示例):这是一个用 AutoHotkey v1 编写的九宫格彩色按钮界面示例。脚本通过叠加两个 GUI 窗口实现:底层窗口借助 Gui, -Caption +E0x200 +ToolWindow 做成无边框、置顶的小窗,并用 WinSet TransColor 把指定颜色(D4D1C8)设为透明;上层窗口用 3×3 的 Progress 控件铺满九种不同颜色,形成九个彩色方块。每个方块对应一个按钮,点击后触发不同动作——打开指定网页、退出程序,或弹出消息框等。
该示例主要演示了 Gui, Add 添加 Button/Progress 控件并控制布局、WinSet TransColor 实现透明背景、以及用 Gui 2: 前缀管理第二个窗口的用法。在 AutoHotkey v2 中,GUI 已改为面向对象的写法(MyGui := Gui()、MyGui.Add(...),事件通过 OnEvent 回调注册),透明背景可改用 SetTransColor 方法,但九宫格控件的整体布局思路仍然适用。
![[趣味]漂亮的九宫格颜色实例](https://www.autoahk.com/wp-content/uploads/2017/02/Peitu26-290x300.jpg)

