AutoHotkey

概要

AutoHotkeyを流行らせるページより~

AutoHotkeyはホットキーへの機能の割り当てなど常駐ソフトの作成に特化したスクリプトエンジンである。
多彩なコマンドが用意されており、GUIを持ったプログラムの作成も可能。
GNU GENERAL PUBLIC LICENSE Version 2の下で配布されるフリーソフトで、C++で作られている。
公式サイト(http://www.autohotkey.com/)にて、インストーラー版とZIPアーカイブ版の2種類が配布されている。
インストーラーを実行すると、スタートメニュー、新規作成メニュー、関連付けに変更が加えられる。 

詳しい特徴と機能についての紹介は AutoHotkeyを流行らせるページ → イントロダクション でされています。

スクリプト

初心者 & ニューカマー へのアドバイス

Tutorial for Newbies より引用~

As a person who started using AHK having absolutely zero programming experience (never taken a class or read a book on computers in my life), I will give you my 2 cents on learning it.

I think exploring the forum works great if you have even a little bit of background in this area. If, like me, you have none, I would learn it in the following order (this is how I would do it if I had to do it over again). Razz My reasoning here is that for a person starting from scratch, you need to learn concepts before learning commands, and the forum is geared more towards commands.

First read the Tutorial, the Scripts page, and then the FAQ. Afterwards, I would recommend learning concepts in the following order:

  1. Hotstrings
  2. Hotkeys
  3. Mouse Clicks & Mouse HotKeys
  4. Variables
  5. Loops - especially Parsing Loops
  6. String commands - (e.g. StringMid, StringReplace)
  7. If,Else statements
  8. Expressions
  9. Arrays & Dynamic variables - (StringSplit)
  10. GoSub & Functions
  11. GUIs
  12. Windows Messages
  13. DllCall

The first 3 you will not necessarily use very often once you become proficient with the program; but they are the easiest to comprehend and implement. Everything from Variables through GUIs is what I would consider the "core" of the program that you will use repeatedly to write virtually all of your scripts with. Windows Messages and DLLCalls are the advanced techniques that are the most powerful but most complicated. The average user will probably never have the need and desire to master these two.

Of course this list is not set in stone, and you may be learning multiple items at once (for example you may want to scratch the surface of GUIs right away), but I think all of the items are important to learn about if you plan to use AHK more than a few times, and I tried to arrange them in an order that would be most logical and systematic.

When you're wondering how to accomplish a specific task in AHK, remember that most of the commands have a common naming scheme to identify what they do. For example:

Commands dealing with files start with File.
Commands dealing with windows start with Win.
Commands dealing with text start with String.

Similarly:

Commands that retrieve data from somewhere contain Get.
Commands that apply data to somewhere contain Set.

Combining the two previous structures, we have commands like:

FileGetSize - Retrieve the size of a file.
WinGetTitle - Retrieve the title of a window.
StringGetPos - Retrieve the position of a piece of text inside a larger piece (like a sentence in a paragraph).

FileSetTime - Apply a new Time Stamp to a file.
WinSetTitle - Apply a new title to a window.
SetTimer - Apply a new Timer, which is a command or group of commands that run at timed intervals.

Good Luck, and remember that nobody was born knowing any of this. It takes time.

_________________

http://autohotkey.net/~jaco0646/

~引用ここまで
Original Post by jaco0646

いずれ日本語にも翻訳され、どこかで公開される事でしょう。それまでは翻訳サービス等利用するなりして下さい。

引用しっぱなしで終わり、というのも乱暴すぎる気がするので、上記の引用文中の序列リスト(番号付きリスト)の部分についてだけ、 AutoHotkeyを流行らせるページ さんで対応しているであろうページを紹介してみます。

  1. Hotstring
  2. ホットキー
  3. Mouse Click & Mouse HotKeys
  4. 変数 , 演算・変数・関数関連
  5. 繰り返し処理 , Loop (parse a string)
  6. 文字列操作 (e.g. StringMid , StringReplace)
  7. If(式) & If/IfEqual/IfNotEqual/IfLess/IfLessOrEqual/IfGreater/IfGreaterOrEqual , Else
  8. 配列 & Dynamic variables,( StringSplit )
  9. Gosub & 関数
  10. GUI表示
  11. ウィンドウの指定 & PostMessage/SendMessage Tutorial
  12. DllCall()

多分、最初は AutoHotkeyを流行らせるページ さんのトップページを上から順に見ていく事と思いますが、 スクリプトを自分で書くようになるにはスクリプトの概要を理解する目的で スクリプト仕様 のページを繰り返し読むことになるかと思います。

DllCall

ホットキーへの機能の割り当て以外に、GUIがあり、DllCall*1がかなり強力な事もあり(向き不向きはありますが)大抵の事は出来ると思います。

COM

COM*2を利用する事も出来ます。

FAQ

Q.文字化け?ダメ文字?

A.

AutoHotkey スレッド part6より~
Q:「~AチЯ㌔荏柿義形港餐汁秦疏蛋伝覗描冒輿倭兪啻嫣彖拜杼歔」を含む文字列がうまく扱えないよ
A:これらの文字の2バイト目が、AHKのエスケープ文字である0x60[`]なため。
  対処としてはこれらの文字の"直後"に「`」を記述する(例:「線形`代数」)か、
  #EscapeCharでエスケープ文字を別のものに変えるべし。 

Q.コンパイルした実行ファイルがアンチウイルスソフトに怒られるんだけど?

A.Compile_AHK II を試してみて下さい(08年12月14日現在)。"No UPX"オプションがあるので、UPXで圧縮しないでコンパイルしてみて下さい。 もしかしたら改善されるかもしれません。
関連用語:実行ファイル圧縮

参考リンク

AutoHotkey - Free Mouse and Keyboard Macro Program with Hotkeys and AutoText
公式サイト
AutoHotkeyを流行らせるページ
日本に於ける総本山

スクリプト

AutoHotkey Script Showcase
スクリプトサンプル。
AutoHotkey wiki - Category:Scripts - AutoHotkey , Script Listing - AutoHotkey
目当てのスクリプト(の記事)を見つけるのにForumから検索*5*6して探すのが大変なら、先ずこのページにあるリンクからあたってみましょう。 - 中には古い記事もあるので記事の日付け、内容に注意。
AutoHotkeyを流行らせるページ → My Scripts
AutoHotkeyを流行らせるページの管理人さんが作成したスクリプト、ライブラリ各種。
Tutorials - AutoHotkey
初心者~中級者~上級者それぞれのレベルの各種チュートリアルへのリンク
Tutorial for Newbies
初心者 & ニューカマー向けの有用なチュートリアル

DllCall

API Wrappers - AutoHotkey wiki
WinAPI *7にアクセス出来ます。
Windows Data Types lookup tool - Autohotkey forums
WinAPI関連:補助スクリプト
Crazy Scripting : A handy tool to lookup Win32 Constants - Autohotkey forums
WinAPI関連:補助スクリプト "W32C_R01.CSV is a listing of 11836 Constants"
Easy WinAPI - WinAPI Parser, DllCall with single hotkey - Autohotkey forums
WinAPI関連:補助スクリプト
StructParser (for C/C++ structs) - Autohotkey forums
補助スクリプト: →Known Issues - Autohotkey forums
Crazy Scripting : WinAPI Listing
WinAPI関連:補助スクリプト - リストからWinAPI関数を検索、MSDNライブラリの該当ページをブラウザで表示。
win32help.ahk (Win32 API 用ラッパ作成ヘルパスクリプト)
DllCall() のラッパ、構造体操作ラッパ、加えて定数定義を作成するためのヘルパスクリプト - Requires: C++ コンパイラ、 Win32 API のヘッダ
OpenGL DllCalls - Autohotkey forums
OpenGL*8 in AHK. 関連:Zippos OpenGL - AHK 3D-Engine. - Autohotkey forums(独語)操作解説(英語)-Keys - Autohotkey forums
GDI+ standard library 1.26 by tic
GDI+ *9 :サンプル - [examples+minituts] The GDI+ Examplecodes thread

COM

COM Wrappers - AutoHotkey wiki
いくつかCOMラッパーの提供もされています。
COM Standard Library - Autohotkey forums
関数ライブラリスクリプト#Include - AutoHotkeyを流行らせるページ
Embed an Internet Explorer control in your AHK Gui via COM - Autohotkey forums
"This is a standard library for IE/WebBrowser controls."
関連:IE and Gui Browser Com Tutorial - Autohotkey forums
Windows Scripting for Autohotkey - official homepage
VBScript,JScriptの組み込み - "Embed VBScript or JScript directly in your Autohotkey programs." : Embedded Windows Scripting (VBScript & JScript) and COM - official thread in the Autohotkey forums
AutoHotkeyを流行らせるページ → My Scripts → ActiveX
WSH等で使われるActiveXObjectを扱えるようにする

ダメ文字問題対策

AutoHotkey駄目文字微対策版
物置 > AutoHotkey
1.0.47.06ベースにされたようです(08年12月25日現在)。
1.0.48.02ベース(タイムスタンプ:2009年4月21日)
ファイル名関連部分(のみ)について駄目文字対策を施した(つもりの)ものです。
文字列処理(正規表現も含む)には、依然として駄目文字等の Shift JIS を扱う際の問題が含まれています。
Unicode関係参考リンク
Read and Write Unicode
FileAppend Unicode text
Reading € from a file
AutoHotkey_L (Lexikos' custom build) Revision 25 - March 30, 2009 - Support for Send {U+xxxx}. Character codes can be looked up using Windows' Character Map.

デバッグ あれこれ

AutoHotkeyを流行らせるページ → スクリプト → スクリプトのデバッグ
スクリプトが期待通りに動作しているかを確認するには
AutoHotkeyを流行らせるページ → リファレンス → OutputDebug
デバッガ(DebugViewなど)に文字列を出力
110.22 Ahk script Debugger 1.1.5b (line-by-line capable)
"An interactive AHk debugger"
Debugging - Autohotkey forums
Debug helper スクリプト など
Debug() [Func] - Autohotkey forums
if you're working with #Include files
function must be called from itself rather than calling from d.ahk
to show correct info for currently executing function/filename 
debugging using A_LIneNumber - Autohotkey forums
RunDebugView.ahk - DebugView を利用。
Gui, Show bug - Autohotkey forums
Trace.ahk - DebugView を利用。
DebugBIF - debug built-in functions (was DllCallDebugger) - for AutoHotkey v1.0.48
appropriate version of LowLevel are required.

Tools

DebugViewDebugView for Windows - © Microsoft Corporation.
デバッグトレースを表示
使い方 - 参考:
差をつけるデバッグ術! ~ 知られざるログ出力 - プログラミング徹底解説
Dependency Walker (depends.exe) Home Page
最新版:2.2.6000が入手できる
Dependency Walker 日本語化パッチ+α - G-PROJECT
Dependency Walkerの文字化け対策 - G-PROJECT
[SMS] Dependency Walker for Win32 (Depends.exe) について
DLL Export Viewer
システム内のdll/指定したdllの関数をスキャン
WinAPIOverride32
WinAPI、COM、.NETのモニタリング(and フッキング)ツール - COM Auto Monitoring(see also COM Options) , .NET monitoring / Tutorial Videos
Dll Export Finder
指定したディレクトリのdllの関数をスキャン
ActiveVB - ApiViewer (en)
WinAPIビューワー
COMView
PSDK付属のOleView.Exeの代替として使用できるツール
MiTeC OLE/COM Object Explorer
PSDK付属のOleView.Exeの代替として使用できるツール
SPY for Internet Explorer
実行中のInternet Explorerで発生するイベントの監視(WebBrowser control)

mini info

AutoHotkey更新情報
AutoHotkey Changes and New FeaturesAutoHotkeyを流行らせるページ → バージョンアップしたら上げるスレ
Compile_AHK IICompile_AHK II - for those who compile! - Autohotkey forums
Update of 2008-11-05 以降、"No UPX"オプション(GUI)が付いています。(コンパイラそのものは公式サイトで配布されているものに標準で付いて来ます) - Viruses found in executable after compile , Tutorial: How to compile .AHK files and include your own ico
chm版リファレンス - スクリプト投稿スレ > 127
『AutoHotkeyを流行らせるページ』のHTML HELP版、 v1.0.47.00 対応。
SciTE4AutoHotkey v2 stable
SciTE4AutoHotkey v2 - New SciTE4AHK version in the making , SciTE4AutoHotkey v2 Stable - Released.
SciTE4AutoHotkey2-ja_1.1.zip
"SciTE4AutoHotkey v2" メニュー日本語化パック
AutoHotkey_L (Lexikos' custom build) - "pre-release" DBGp client functions written in AutoHotkey - "Hopefully we will see interactive debugging in SciTE4AutoHotkey in the not-too-distant future."
関連:AutoHotkey_L - Debugging FeaturesInteractiveDebugging.avi - 基本的なデバッグの様子を収めたスクリーンキャスト。
ironahk - Google Code
クロスプラットホーム向けに開発が進められているAutoHotkeyからのフォーク。
Forum内のスレッド:IronAHK - .NET port of AutoHotkey for Windows, Linux, Mac...
scite-4-ironahk - Google Code
IronAHK 仕様の SciTE
AutoHotkey.dll
binaries - Autohotkey.dll
source - tinku99's ahkdll at master - GitHub
Features:
* embed autohotkey in another program
* dynamically add #include type files to a running script
addFile(file). Functions and labels should work fine.
#Directives and Exit Routines may not work as expected.
* multithreading
Class library
The Class library is a toolset to add OOP (Object-Oriented Programming) to AHK

Class library (OOP) - Help ThreadClass library (OOP) - Wish list / Bug reports threadIntroduction To OOP / OOP - プログラミングスレまとめ in VIP

Jimulation - or another aproach to a oop system for ahk
The library Jimulation.ahk is the only file needed to use it. 
Rosetta Code - Category:AutoHotkey
Rosetta Code is a programming chrestomathy site.
The idea is to present solutions to the same task in as many different languages as possible,
to demonstrate how languages are similar and different,
and to aid a person with a grounding in one language in learning another.

面白い所では Bogosort , Bubble Sort ,FizzBuzz なども掲載されている。 / Challenge: translate rosettacode - Was promoting autohotkey


*1 DllCall() - AutoHotkeyを流行らせるページ
*2 Component Object Model - Wikipedia
*3 エスケープ文字 - AutoHotkeyを流行らせるページ
*4 #EscapeChar - AutoHotkeyを流行らせるページ
*5 検索用スクリプトの公開もされていたりします:Quick Search for Autohotkey
*6 Firefox用検索プラグイン - english-forum,german-forum:FF2+ Search Plugin
*7 Windowsが提供するさまざまな機能:Windows API - Wikipedia
*8 OpenGL - Wikipedia
*9 Graphics Device Interface - Wikipedia

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS