Skip to content

Instantly share code, notes, and snippets.

@tmplinshi
tmplinshi / class_mProcess.ahk
Last active August 29, 2015 14:09
多进程
class mProcess
{
static pidList := []
; 等待进程小于指定数量
wait(MaxRun = 1) {
Loop {
count := 0
newList := []
#IfWinActive, ahk_class PX_WINDOW_CLASS ; Sublime Text 窗口
F5::st_ahk.run()
^F5::st_ahk.compile()
; F2::WinMenuSelectItem,,, 6&, 10&, 2&
#If
; 功能: 运行/编译在 Sublime Text 中打开的 ahk 文件。
;
; * 编译的时候,会自动将需要的 ahk 文件复制到“脚本目录\Lib\”。
; (注:不会覆盖旧文件)
@tmplinshi
tmplinshi / GDI.ahk
Last active August 29, 2015 14:12 — forked from G33kDude/GDI.ahk
class GDI
{
__New(hWnd, CliWidth=0, CliHeight=0)
{
if !(CliWidth && CliHeight)
{
VarSetCapacity(Rect, 16, 0)
DllCall("GetClientRect", "Ptr", hWnd, "Ptr", &Rect)
CliWidth := NumGet(Rect, 8, "Int")
CliHeight := NumGet(Rect, 12, "Int")
#c::cmdHere()
cmdHere() {
If WinActive("ahk_class CabinetWClass") || WinActive("ahk_class ExploreWClass")
WinGetText, data
Run, cmd, % RegExMatch(data, "i`am)^地址: \K.*", dir) ? dir : A_Desktop
}
/*
cmdHere() {
/*
ObjRegisterActive(Object, CLSID, Flags:=0)
Registers an object as the active object for a given class ID.
Requires AutoHotkey v1.1.17+; may crash earlier versions.
Object:
Any AutoHotkey object.
CLSID:
A GUID or ProgID of your own making.
; ======================================================================================================================
; Namepace: ScrollGUI
; Function: Create a scrollable GUI as a parent for GUI windows.
; Tested with: AHK 1.1.19.02
; Tested on: Win 8.1 (x64)
; Change log: 1.0.00.00/2015-02-06/just me - initial release on ahkscript.org
; License: The Unlicense -> http://unlicense.org
; ======================================================================================================================
Class ScrollGUI {
Static Instances := []
StdOutToVar( sCmd ) { ; GAHK32 ; Modified Version : SKAN 05-Jul-2013 http://goo.gl/j8XJXY
Static StrGet := "StrGet" ; Original Author : Sean 20-Feb-2007 http://goo.gl/mxCdn
DllCall( "CreatePipe", UIntP,hPipeRead, UIntP,hPipeWrite, UInt,0, UInt,0 )
DllCall( "SetHandleInformation", UInt,hPipeWrite, UInt,1, UInt,1 )
VarSetCapacity( STARTUPINFO, 68, 0 ) ; STARTUPINFO ; http://goo.gl/fZf24
NumPut( 68, STARTUPINFO, 0 ) ; cbSize
NumPut( 0x100, STARTUPINFO, 44 ) ; dwFlags => STARTF_USESTDHANDLES = 0x100
NumPut( hPipeWrite, STARTUPINFO, 60 ) ; hStdOutput
; TrayMenu.ahk
; AHK 版本: 1.1.20.00+
TrayMenu() {
static Init := %A_ThisFunc%()
static winTitle := "ahk_pid " DllCall("GetCurrentProcessId")
If (A_ThisMenuItem = "显示/隐藏窗口") {
If WinExist(winTitle) {
winTitle := "ahk_id " WinExist()
WinHide, % winTitle
剪贴板_全角数字转半角(p*) {
; 函数内部调用
If (p.1 = "ToolTip") {
ToolTip, % p.2
fn := Func(A_ThisFunc).Bind("Remove_ToolTip")
SetTimer, %fn%, -2000
Return
}
Else If (p.1 = "Remove_ToolTip") {
; Menu_SetSysMenu.ahk
/*
__ __ __ __ __ __ __ _ __
/ /_ / /_/ /_____ _ / // /____ _/ /_ / /________________(_)___ / /_ ____ _______
/ __ \/ __/ __/ __ \(_) // // __ '/ __ \/ //_/ ___/ ___/ __/ / __ \/ __// __ \/ __/ _ \
/ / / / /_/ /_/ /_/ / / // // /_/ / / / / ,< (__ ) /__/ / / / /_/ / /__/ /_/ / / / // /
/_/ /_/\__/\__/ .___(_) // / \__,_/_/ /_/_/|_/____/\___/_/ /_/ .___/\__(_)____/_/ \__ /
/_/ /_//_/ /_/ (___/