標籤

顯示具有 AutoHotKey 標籤的文章。 顯示所有文章
顯示具有 AutoHotKey 標籤的文章。 顯示所有文章

AutoHotKey MsgBox with parameter

使用參數方式,傳入title及內容,可當node.js或batch程式的訊息顯示
呼叫方式:
C:\Program Files\AutoHotKey\AutoHotkey.exe D:\MsgBox.ahk "This Is Title" "This Is Message"
C:\Program Files\AutoHotKey\AutoHotkey.exe D:\MsgBox2.ahk "Storm" "發現新主題,是否開啟?" "http://www.google.com.tw"


MsgBox

TimerExist

註1:可搭配這款stopwatch使用。
註2:GLOBAL interval可調整偵測頻率(預設3秒/次)。

Transparentizing Window (透明化視窗)

  • Win + 滾輪上:增加透明度
  • Win + 滾輪下:減少透明度
  • Win + O:還原正常
  • 註:排除桌面透明化

Transparentizing Window

How To Change Window Transparency in Windows 7 with a Hotkey

MyHotKey

  • Press ESC twice to close current window.
  • Press middle button in Expolorer to go parent folder. 
  • Press hold LButton and Press RButton to open quick menu.
  • Press MButton in taskbar to mute.
  • Win + Wheel down, window to minimize.
  • Win + Wheel up, window to maximize.
  • Win + MButton, Pin on top.
  • Win + NumpadAdd, Increase the transparency of the active window.
  • Win + NumpadSub, Decrease the transparency of the active window.
  • Win + Numpad0, Reset the transparency of the active window.
  • Win + V, Pure text.
  • Win + X, Exit App.
  • Win + S, Folder "MySoftware".
  • Win + G, Greenshot.
  • Win + C, Copy file/folder path.
  • Win + N, NotePad++.
  • Win + T, Paste FormatTime "yyMMddHHmmss".
  • Win + Q, Quick App Menu.
  • Win + E, Open My Computer without folder list.
  • Win + W, Resize the active window to 800x600.
  • Win + LButton, Move the active window without having to click on the title bar.

Detect a key double press

~Esc::
if (A_PriorHotkey <> A_ThisHotkey or A_TimeSincePriorHotkey > 400)
{
    ; Too much time between presses, so this isn't a double-press.
    KeyWait, Esc
    return
}
WinMinimize, A    ; Assign a hotkey to minimize the active window.
;another example ↓ using to quick close the application
;Run, cmd /c TASKKILL /IM chrome.exe
return

keyboard shortcuts - Detect a double key press in AutoHotkey - Stack Overflow

Middle Paste 2

熊熊想到AHK可以寫入txt,故再次精減流程
  • 在Firefox裡,按中鍵,寫入剪貼簿內容至list.txt,每三次就自動多換一行 
  • 在SMG主畫面,按中鍵,貼上下載碼
  • 在SMG新增下載檔案,按中鍵,自動貼上剪貼簿內容至下載路徑且送出確定
  • 在SMG新增下載檔案,Ctrl + C,自動組成下載路徑,並複製編號部份
  • 在SMG新增下載檔案,Ctrl + Z,跳至『儲存到』
  • Win + Z 開啟list.txt

;開啟list.txt
#z::Run notepad "K:\list.txt"

;Firefox 中鍵新增剪貼簿內容至list.txt
#IfWinActive ahk_class MozillaWindowClass
MButton::
L++
IF ( L = 1 )
{
    ;StringUpper, Clipboard, Clipboard
    FileAppend, %Clipboard%`n, K:\list.txt
    TrayTip, MiddlePaste, 新增編號`n%Clipboard%,1
}
IF ( L = 2 )
{
    IfInString, Clipboard, http://
    {
        FileAppend, %Clipboard%`n, K:\list.txt
        TrayTip, MiddlePaste, 新增網址`n%Clipboard%,1
    }
    Else
    {
        SoundBeep
        TrayTip, MiddlePaste, 格式錯誤,1
    }
}
IF ( L = 3 )
{
    FileAppend, %Clipboard%`n, K:\list.txt
    TrayTip, MiddlePaste, 新增解壓縮密碼,1
    FileAppend, `n, K:\list.txt
    L=0
}
Return

;SMG新增下載檔案 中鍵貼上編號
#IfWinActive ahk_class TAddDownloads.UnicodeClass
MButton::
ControlFocus, 一般設定
Send {TAB 6}
;StringUpper, Clipboard, Clipboard
Send K:\%Clipboard%
Send {Enter}
Return

;SMG新增下載檔案 Ctrl + C 自動組成下載路徑,並複製編號部份,自動轉大寫
#IfWinActive ahk_class TAddDownloads.UnicodeClass
^c::
Send {End}
Send +{Home}
Send ^c
;StringUpper, Clipboard, Clipboard
Send K:\%Clipboard%\
Return

;SMG新增下載檔案 Ctrl + Z 跳至『儲存到』
#IfWinActive ahk_class TAddDownloads.UnicodeClass
^z::
ControlFocus, 一般設定
Send {TAB 6}
Return

;SMG主視窗 中鍵貼上
#IfWinActive ahk_class TMainForm.UnicodeClass
MButton::
Send {F4}
Return

Resize Window

; win + w Resize Winodw to 1024(w), 1052(h)
#W::ResizeWin(1024,1052)

ResizeWin(Width = 0,Height = 0)
{
    WinGetPos,X,Y,W,H,A
    If %Width% = 0
        Width := W
    If %Height% = 0
        Height := H
    WinMove,A,,%X%,%Y%,%Width%,%Height%
}

Create a Hotkey to Resize Windows to a Specific Size with AutoHotkey - How-To Geek

檔案總管反向選取

在檔案總管裡,使用Win + A進行反向選取

#x::ExitApp
#IfWinActive ahk_class CabinetWClass
#A:: Send !ei ;編輯(E) → 反向選擇(I)

Middle Paste

  • 在Notepad2裡,按中鍵,每貼上三次,自動多換一行 
  • 在SMG主畫面,按中鍵,貼上下載碼
  • 在SMG新增下載檔案畫面,按中鍵,自動貼上剪貼簿內容且確定

#IfWinActive ahk_class Notepad2U
MButton::
Send ^v
Send {Enter}
L++
IF(L =3)
{
    Send {Enter}
    L=0
}
Return
#IfWinActive ahk_class TAddDownloads.UnicodeClass
MButton::
Send {TAB 6}
Send E:\%Clipboard%
Send {Enter}
Return
#IfWinActive ahk_class TMainForm.UnicodeClass
MButton::
Send {F4}
Return

Quick Tetris

因為懶得動滑鼠按按鈕,故寫AHK用鍵盤按
目前功能如下:
  • W鍵,自動置中視窗
  • S鍵,Start (Sprint、2P)
  • A鍵,Play Again (Sprint、2P)
  • R鍵,Restart (Sprint)

#IfWinActive ahk_class Chrome_WidgetWin_1
$W::ResizeWin(1075,1052)

;Sprint Restart
#IfWinActive ahk_class Chrome_WidgetWin_1, Tetris Sprint
$R::
Send {Esc}
ControlClick, x710 y570
Return

;Sprint Play Again
#IfWinActive ahk_class Chrome_WidgetWin_1, Tetris Sprint
$A::ControlClick, x258 y558

;Sprint Start
#IfWinActive ahk_class Chrome_WidgetWin_1, Tetris Sprint
$S::ControlClick, x722 y503

;2P Start
#IfWinActive ahk_class Chrome_WidgetWin_1, Battle 2P
$S::ControlClick, x332 y345

;2P Play Again
#IfWinActive ahk_class Chrome_WidgetWin_1, Battle 2P
$A::ControlClick, x258 y560

ResizeWin(Width = 0,Height = 0)
{
    WinGetPos,X,Y,W,H,A
    If %Width% = 0
        Width := W
    If %Height% = 0
        Height := H
   
    X:=(A_ScreenWidth - Width) / 2
    Y:=0
    WinMove,A,,%X%,%Y%,%Width%,%Height%
}

滑鼠左右鍵切換視窗

~LButton & RButton::AltTab

Create Shortcut URL

簡化下載檔案時,常會使用的動作流程

;建立URL(Win + V)
#v::
if WinActive("ahk_class CabinetWClass")    ;Explorer才執行
{
    strlen:=StrLen(Clipboard)    ;取得剪貼簿字串長度
    if(strlen > 0)
    {
        URL=%Clipboard%    ;從剪貼簿取得URL
        Send !d    ;焦點移至網址列 Alt + D
        Send ^c    ;Ctrl + C
        ClipWait 1    ;等待OS 1秒
        Send +{Tab}    ;取消焦點
        FileAppend,[InternetShortcut]`nURL=%URL%`nIconFile=`nIconIndex=1,%Clipboard%\URL.url
    }
}
Return
;複製URL(Win + C)
#c::
if WinActive("ahk_class CabinetWClass")    ;Explorer才執行
{
    Send !{Enter}    ;開啟內容
    WinWaitActive, 內容, , 1
    Send ^c    ;Ctrl + C
    ClipWait 1    ;等待OS 1秒
    Send !{F4}    ;關閉內容
}
Return
;反向選取(Win + A)
#a::
if WinActive("ahk_class CabinetWClass")    ;Explorer才執行
{
    Send {Alt}
    Send e
    Send i
}
Return
;滑鼠左右鍵切換視窗
~LButton & RButton::AltTab
;關閉主程式(Win + X)
#x::
ExitApp

全域Google, Yahoo字典查詢

#g::    ;定義按 Win + G 鍵,啟用 Google 字典
    Clipboard =     ;清空剪貼簿
    Send, ^c    ;送出 Ctrl + C
    strlen:=StrLen(Clipboard)    ;取得剪貼簿字串長度
    if(strlen > 0)
    {
        ClipWait, 1    ;等待OS,剪貼簿等待1秒
        Run , firefox.exe "http://www.google.com.tw/dictionary?aq=f&langpair=en|zh-TW&hl=zh-TW&q=%Clipboard%"
    }
Return
#y::    ;定義按 Win + Y 鍵,啟用 Yahoo 字典
    Clipboard =     ;清空剪貼簿
    Send, ^c    ;送出 Ctrl + C
    strlen:=StrLen(Clipboard)    ;取得剪貼簿字串長度
    if(strlen > 0)
    {
        ClipWait, 1    ;等待OS,剪貼簿等待1秒
        Run , firefox.exe "http://tw.dictionary.yahoo.com/dictionary?p=%Clipboard%"
    }
Return

Click Rex

/****************************************************
 * Copyright (c) 2010, NKid. All Rights Reserved.  
 * PROJECT:Click Rex                               
 * DESCRIPTION:全自動背景傳送MSN來電震動                         
 * VERSION:2                                       
 ****************************************************/
#x::    ;按下win + x執行程式
    SetCapsLockState, off    ;把CapsLock設為關
    TrayTip, Click Rex, Turn On, 1    ;顯示開始訊息
    Loop
    {
        ;按下CapsLock即停止程式
        if GetKeyState("CapsLock", "T") {
        TrayTip, Click Rex, Turn Off, 1
        SetCapsLockState, off
        Break 
          }
    SetTitleMatchMode,2
    ControlClick ,x130 y487,rexob7w
    ;Click    ;按左鍵
    ;Send, ...{enter}
    Sleep 10
    }